Skip to content

Commit 2a5c122

Browse files
stereotype441commit-bot@chromium.org
authored andcommitted
Migration: Fix EdgeBuilder._unimplemented if node==null
Change-Id: Id1a297f1ee5eaf4d7111ad081a0a8c49cb334303 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150801 Reviewed-by: Samuel Rawlins <[email protected]> Commit-Queue: Paul Berry <[email protected]>
1 parent 9f904ff commit 2a5c122

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

pkg/nnbd_migration/lib/src/edge_builder.dart

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2925,16 +2925,18 @@ class EdgeBuilder extends GeneralizingAstVisitor<DecoratedType>
29252925

29262926
@alwaysThrows
29272927
void _unimplemented(AstNode node, String message) {
2928-
CompilationUnit unit = node.root as CompilationUnit;
29292928
StringBuffer buffer = StringBuffer();
29302929
buffer.write(message);
2931-
buffer.write(' in "');
2932-
buffer.write(node.toSource());
2933-
buffer.write('" on line ');
2934-
buffer.write(unit.lineInfo.getLocation(node.offset).lineNumber);
2935-
buffer.write(' of "');
2936-
buffer.write(unit.declaredElement.source.fullName);
2937-
buffer.write('"');
2930+
if (node != null) {
2931+
CompilationUnit unit = node.root as CompilationUnit;
2932+
buffer.write(' in "');
2933+
buffer.write(node.toSource());
2934+
buffer.write('" on line ');
2935+
buffer.write(unit.lineInfo.getLocation(node.offset).lineNumber);
2936+
buffer.write(' of "');
2937+
buffer.write(unit.declaredElement.source.fullName);
2938+
buffer.write('"');
2939+
}
29382940
throw UnimplementedError(buffer.toString());
29392941
}
29402942

0 commit comments

Comments
 (0)