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

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

Issue 1043723002: Handle NewExpression in SemanticSendVisitor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased+fix modely.dart Created 5 years, 9 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 fc02a31b7fa24944e4e7c595afba73776a5c3087..0ddce75d817a96285e0a1ef6669f34e12234c57b 100644
--- a/pkg/compiler/lib/src/resolution/send_resolver.dart
+++ b/pkg/compiler/lib/src/resolution/send_resolver.dart
@@ -400,5 +400,68 @@ abstract class SendResolverMixin {
}
}
}
+
+ ConstructorAccessSemantics computeConstructorAccessSemantics(
+ ConstructorElement constructor,
+ DartType type) {
+ if (constructor.isErroneous) {
+ return new ConstructorAccessSemantics(
+ ConstructorAccessKind.ERRONEOUS, constructor, type);
+ } else if (constructor.isRedirectingFactory) {
+ ConstructorElement effectiveTarget = constructor.effectiveTarget;
+ if (effectiveTarget == constructor ||
+ effectiveTarget.isErroneous) {
+ return new ConstructorAccessSemantics(
+ ConstructorAccessKind.ERRONEOUS_REDIRECTING_FACTORY,
+ constructor,
+ type);
+ }
+ ConstructorAccessSemantics effectiveTargetSemantics =
+ computeConstructorAccessSemantics(
+ effectiveTarget,
+ constructor.computeEffectiveTargetType(type));
+ if (effectiveTargetSemantics.isErroneous) {
+ return new RedirectingFactoryConstructorAccessSemantics(
+ ConstructorAccessKind.ERRONEOUS_REDIRECTING_FACTORY,
+ constructor,
+ type,
+ effectiveTargetSemantics);
+ }
+ return new RedirectingFactoryConstructorAccessSemantics(
+ ConstructorAccessKind.REDIRECTING_FACTORY,
+ constructor,
+ type,
+ effectiveTargetSemantics);
+ } else if (constructor.isFactoryConstructor) {
+ return new ConstructorAccessSemantics(
+ ConstructorAccessKind.FACTORY, constructor, type);
+ } else if (constructor.isRedirectingGenerative) {
+ if (constructor.enclosingClass.isAbstract) {
+ return new ConstructorAccessSemantics(
+ ConstructorAccessKind.ABSTRACT, constructor, type);
+ }
+ return new ConstructorAccessSemantics(
+ ConstructorAccessKind.REDIRECTING_GENERATIVE, constructor, type);
+ } else if (constructor.enclosingClass.isAbstract) {
+ return new ConstructorAccessSemantics(
+ ConstructorAccessKind.ABSTRACT, constructor, type);
+ } else {
+ return new ConstructorAccessSemantics(
+ ConstructorAccessKind.GENERATIVE, constructor, type);
+ }
+ }
+
+ NewStructure computeNewStructure(NewExpression node) {
+ if (node.isConst) {
+ return new ConstInvokeStructure(elements.getConstant(node));
+ }
+ Element element = elements[node.send];
+ Selector selector = elements.getSelector(node.send);
+ DartType type = elements.getType(node);
+
+ ConstructorAccessSemantics constructorAccessSemantics =
+ computeConstructorAccessSemantics(element, type);
+ return new NewInvokeStructure(constructorAccessSemantics, selector);
+ }
}
« no previous file with comments | « pkg/compiler/lib/src/resolution/semantic_visitor_mixins.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