710c0b3695
This change addresses a technical debt issue in dart2js, where errors sometimes get reported as a binary offset location, instead of a line/column position with contextual data from the source file. The reason for this behavior is that dartj2s reports binary offsets when it can't recover line/column data and show the contents of the file. This typically happens if the file cannot be read directly from disk. The fix consits of adding an API to record the contents of files that are not read directly by the compiler. We then use this API to provide all sources collected by the CFE when parsing components from .dill files. Note: this CL also deletes the `autoread` feature in source-file-provider. That feature was added for the same purpose. The way it worked was that instead of registering source content, it tried to read the sources from disk on-demand as errors got reported. This doesn't always work for three reasons: * First, we often use custom schemes (like the multi-root scheme) in dill files to make the .dill deterministic in distributed build systems, the autoload feature had no understanding of how to translate those custom URIs to file URIs (that translation is only define at the time the .dill is being built). * Second, sometimes the files are simply not available, for example, in hermetic build systems like bazel we have no access to those files. * Third, when files were found, there was no guarantee that the contents were consistent. That is, the current version of the file on disk could have been modified and have different contents than those used when the .dill file was built. I tested this manually by adding a crash in SSA and observing the location in multiple scenarios, including running from source, running from a .dill with file URIs, running from a .dill with multi-root URIs, crashing in SDK locations in regular files and patch files. Change-Id: Ief09be577f4c9c4b345b4e2641918cafbe93c3fc Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251700 Reviewed-by: Mayank Patke <fishythefish@google.com> Commit-Queue: Sigmund Cherem <sigmund@google.com>