Index: pkg/compiler/lib/src/ssa/builder.dart |
diff --git a/pkg/compiler/lib/src/ssa/builder.dart b/pkg/compiler/lib/src/ssa/builder.dart |
index b038a0dd6a8e9478e84a6734a1c2016120ce82e4..fa63b186d09a16112248a4e0930a8c949e6ff93a 100644 |
--- a/pkg/compiler/lib/src/ssa/builder.dart |
+++ b/pkg/compiler/lib/src/ssa/builder.dart |
@@ -3497,6 +3497,12 @@ class SsaBuilder extends ast.Visitor |
} else if (isGrowableListConstructorCall) { |
push(buildLiteralList(<HInstruction>[])); |
stack.last.instructionType = elementType; |
+ } else if (constructor.isExternal && |
+ constructor.isFromEnvironmentConstructor) { |
+ generateUnsupportedError( |
+ node, |
+ '${cls.name}.${constructor.name} ' |
+ 'can only be used as a const constructor'); |
} else { |
SourceInformation sourceInformation = |
sourceInformationBuilder.buildNew(send); |
@@ -3862,6 +3868,11 @@ class SsaBuilder extends ast.Visitor |
generateError(node, message, helper); |
} |
+ void generateUnsupportedError(ast.Node node, String message) { |
+ MethodElement helper = commonElements.throwUnsupportedError; |
+ generateError(node, message, helper); |
+ } |
+ |
void generateTypeError(ast.Node node, String message) { |
MethodElement helper = commonElements.throwTypeError; |
generateError(node, message, helper); |