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

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

Issue 1079533002: Handle SendSet and NewExpression through NewResolvedVisitor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix problems with prefix/postfix and erroneous const invocations. Created 5 years, 8 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
Index: pkg/compiler/lib/src/resolution/send_resolver.dart
diff --git a/pkg/compiler/lib/src/resolution/send_resolver.dart b/pkg/compiler/lib/src/resolution/send_resolver.dart
index f72f548c330e41be55ca5c269ef96a98c1615a09..c63b20d963bf1be4e0522031fd341bd766f6c829 100644
--- a/pkg/compiler/lib/src/resolution/send_resolver.dart
+++ b/pkg/compiler/lib/src/resolution/send_resolver.dart
@@ -455,14 +455,26 @@ abstract class SendResolverMixin {
NewStructure computeNewStructure(NewExpression node) {
if (node.isConst) {
- return new ConstInvokeStructure(elements.getConstant(node));
+ ConstantExpression constant = elements.getConstant(node);
+ if (constant is ConstructedConstantExpression) {
+ return new ConstInvokeStructure(constant);
+ }
}
+
Element element = elements[node.send];
Selector selector = elements.getSelector(node.send);
DartType type = elements.getType(node);
- ConstructorAccessSemantics constructorAccessSemantics =
- computeConstructorAccessSemantics(element, type);
+ ConstructorAccessSemantics constructorAccessSemantics;
+ if (node.isConst) {
+ // This is a non-constant constant constructor invocation, like
+ // `const Const(method())`.
+ constructorAccessSemantics = new ConstructorAccessSemantics(
+ ConstructorAccessKind.ERRONEOUS, element, type);
+ } else {
+ constructorAccessSemantics =
+ computeConstructorAccessSemantics(element, type);
+ }
return new NewInvokeStructure(constructorAccessSemantics, selector);
}
}
« no previous file with comments | « pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart ('k') | pkg/compiler/lib/src/resolution/send_structure.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698