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

Unified Diff: pkg/compiler/lib/src/resolution/send_structure.dart

Issue 1161823004: Handle .fromEnvironment and incompatible constructor invocations (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Change handling of incompatible redirecting factories. Created 5 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/send_resolver.dart ('k') | tests/co19/co19-dart2js.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/resolution/send_structure.dart
diff --git a/pkg/compiler/lib/src/resolution/send_structure.dart b/pkg/compiler/lib/src/resolution/send_structure.dart
index b5d0f718c8c5a82a24e34740b08f8578f1156632..60d61896acd875bd4bc5876c74a864877237080b 100644
--- a/pkg/compiler/lib/src/resolution/send_structure.dart
+++ b/pkg/compiler/lib/src/resolution/send_structure.dart
@@ -2359,21 +2359,47 @@ class NewInvokeStructure<R, A> extends NewStructure<R, A> {
return visitor.visitUnresolvedRedirectingFactoryConstructorInvoke(
node, semantics.element, semantics.type,
node.send.argumentsNode, callStructure, arg);
+ case ConstructorAccessKind.INCOMPATIBLE:
+ return visitor.visitConstructorIncompatibleInvoke(
+ node, semantics.element, semantics.type,
+ node.send.argumentsNode, callStructure, arg);
}
throw new SpannableAssertionFailure(node,
"Unhandled constructor invocation kind: ${semantics.kind}");
}
+
+ String toString() => 'new($semantics,$selector)';
+}
+
+enum ConstantInvokeKind {
+ CONSTRUCTED,
+ BOOL_FROM_ENVIRONMENT,
+ INT_FROM_ENVIRONMENT,
+ STRING_FROM_ENVIRONMENT,
}
/// The structure for a [NewExpression] of a constant invocation. For instance
/// `const C()`.
class ConstInvokeStructure<R, A> extends NewStructure<R, A> {
- final ConstructedConstantExpression constant;
+ final ConstantInvokeKind kind;
+ final ConstantExpression constant;
- ConstInvokeStructure(this.constant);
+ ConstInvokeStructure(this.kind, this.constant);
R dispatch(SemanticSendVisitor<R, A> visitor, NewExpression node, A arg) {
- return visitor.visitConstConstructorInvoke(node, constant, arg);
+ switch (kind) {
+ case ConstantInvokeKind.CONSTRUCTED:
+ return visitor.visitConstConstructorInvoke(node, constant, arg);
+ case ConstantInvokeKind.BOOL_FROM_ENVIRONMENT:
+ return visitor.visitBoolFromEnvironmentConstructorInvoke(
+ node, constant, arg);
+ case ConstantInvokeKind.INT_FROM_ENVIRONMENT:
+ return visitor.visitIntFromEnvironmentConstructorInvoke(
+ node, constant, arg);
+ case ConstantInvokeKind.STRING_FROM_ENVIRONMENT:
+ return visitor.visitStringFromEnvironmentConstructorInvoke(
+ node, constant, arg);
+ }
}
}
« no previous file with comments | « pkg/compiler/lib/src/resolution/send_resolver.dart ('k') | tests/co19/co19-dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698