Skip to content

Commit 99b3dff

Browse files
nshahanCommit Queue
authored andcommitted
[ddc] Avoid crash when compiling super initializer
We can't find a reproduction but for now it seems better to avoid crashing and just keep compiling without adding any source information. Issue: dart-lang/sdk#50465 Fixes: dart-lang/sdk#50394 Change-Id: I9bba60c35647ec1cb5894d0be20a97228098880a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269741 Commit-Queue: Nicholas Shahan <nshahan@google.com> Reviewed-by: Mark Zhou <markzipan@google.com>
1 parent bf48667 commit 99b3dff

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pkg/dev_compiler/lib/src/kernel/compiler.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1731,7 +1731,10 @@ class ProgramCompiler extends ComputeOnceConstantVisitor<js_ast.Expression>
17311731
var superCall = node.initializers.whereType<SuperInitializer>().firstOrNull;
17321732
var jsSuper = _emitSuperConstructorCallIfNeeded(cls, className, superCall);
17331733
if (jsSuper != null) {
1734-
body.add(jsSuper..sourceInformation = _nodeStart(superCall!));
1734+
// TODO(50465) Fix incorrect assumption there should always be a super
1735+
// initializer here.
1736+
if (superCall != null) jsSuper.sourceInformation = _nodeStart(superCall);
1737+
body.add(jsSuper);
17351738
}
17361739

17371740
body.add(_emitFunctionScopedBody(fn));

0 commit comments

Comments
 (0)