Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(457)

Unified Diff: pkg/compiler/lib/src/ssa/builder.dart

Issue 2896393003: Remove factory body in *.fromEnvironment, and implement this same behavior (Closed)
Patch Set: turn warning into a hint Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/resolution/members.dart ('k') | pkg/compiler/lib/src/ssa/builder_kernel.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « pkg/compiler/lib/src/resolution/members.dart ('k') | pkg/compiler/lib/src/ssa/builder_kernel.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698