-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backoff SourceExcerptProvider from attempting to get source code of s…
…tub files when reporting errors. When JSCompiler generates an error report, it tries to format the error message with the relevant source code snippet. To do that, it relies on a SourceExcerptProvider to give it the relevant snippet. The implementation for this SourceExcerptProvider interface is provided by the compiler. This CL makes the SourceExcerptProvider (i.e. the compiler implementing it) backoff when the source file is a stub source file. The sequence of calls is: `ThreadSafeDelegatingErrorManager.generateReport()` --> `BasicErrorManager.generateReport()` --> .. --> `LightweightMessageFormatter.formatError()` --> `SourceExcerptProvider$SourceExcerpt$1.get()` --> `compiler.getSourceLine()` Also adds a unit test to check that compiler reports an error without crashing. Fixes the crash reported in b/379868495 synced to CL 697886232 - http://sponge2/4ea3023b-17f3-45b4-adb4-de5ce0d1e864 PiperOrigin-RevId: 698904429
- Loading branch information
1 parent
e64e1c7
commit 73dc7df
Showing
2 changed files
with
85 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters