Skip to content

Commit ab03a9c

Browse files
scheglovcommit-bot@chromium.org
authored andcommitted
Issue 43090. Catch parser exceptions in available declarations.
Bug: #43090 Change-Id: Ia4cd891842bfdc7ac0b6a7755a916032bccfa202 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181340 Reviewed-by: Samuel Rawlins <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
1 parent 934980b commit ab03a9c

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

pkg/analyzer/lib/src/services/available_declarations.dart

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1920,11 +1920,19 @@ class _File {
19201920
}
19211921

19221922
static CompilationUnit _parse(FeatureSet featureSet, String content) {
1923-
return parseString(
1924-
content: content,
1925-
featureSet: featureSet,
1926-
throwIfDiagnostics: false,
1927-
).unit;
1923+
try {
1924+
return parseString(
1925+
content: content,
1926+
featureSet: featureSet,
1927+
throwIfDiagnostics: false,
1928+
).unit;
1929+
} catch (e) {
1930+
return parseString(
1931+
content: '',
1932+
featureSet: featureSet,
1933+
throwIfDiagnostics: false,
1934+
).unit;
1935+
}
19281936
}
19291937

19301938
static String _readContent(File resource) {

0 commit comments

Comments
 (0)