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

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

Issue 1160153002: Support implicit super constructor invocation in SemanticDeclarationVisitor. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: 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
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 a706f1c9a391a86261c3f942f8a11bf9cff3ebc4..cbee33c05956d56abb23a35a3c577aaebc3c0942 100644
--- a/pkg/compiler/lib/src/resolution/send_resolver.dart
+++ b/pkg/compiler/lib/src/resolution/send_resolver.dart
@@ -854,18 +854,48 @@ abstract class DeclarationResolverMixin {
}
}
+ InitializersStructure computeInitializersStructure(FunctionExpression node) {
+ List<InitializerStructure> initializers = <InitializerStructure>[];
+ NodeList list = node.initializers;
+ bool constructorInvocationSeen = false;
+ if (list != null) {
+ for (Node initializer in list) {
+ InitializerStructure structure =
+ computeInitializerStructure(initializer);
+ if (structure.isConstructorInvoke) {
+ constructorInvocationSeen = true;
+ }
+ initializers.add(structure);
+ }
+ }
+ if (!constructorInvocationSeen) {
+ ConstructorElement currentConstructor = elements[node];
+ ClassElement currentClass = currentConstructor.enclosingClass;
+ InterfaceType supertype = currentClass.supertype;
+ if (supertype != null) {
+ ClassElement superclass = supertype.element;
+ ConstructorElement superConstructor =
+ superclass.lookupDefaultConstructor();
+ initializers.add(new ImplicitSuperConstructorInvokeStructure(
+ node, superConstructor, supertype));
+ }
+ }
+ return new InitializersStructure(initializers);
+ }
+
InitializerStructure computeInitializerStructure(Send node) {
Element element = elements[node];
if (node.asSendSet() != null) {
- return new FieldInitializerStructure(element);
+ return new FieldInitializerStructure(node, element);
} else if (Initializers.isConstructorRedirect(node)) {
return new ThisConstructorInvokeStructure(
- element, elements.getSelector(node));
+ node, element, elements.getSelector(node).callStructure);
} else if (Initializers.isSuperConstructorCall(node)) {
return new SuperConstructorInvokeStructure(
+ node,
element,
elements.analyzedElement.enclosingClass.supertype,
- elements.getSelector(node));
+ elements.getSelector(node).callStructure);
}
return internalError(node, "Unhandled initializer.");
}
« 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