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

Unified Diff: pkg/compiler/lib/src/resolution/semantic_visitor.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/semantic_visitor.dart
diff --git a/pkg/compiler/lib/src/resolution/semantic_visitor.dart b/pkg/compiler/lib/src/resolution/semantic_visitor.dart
index f90db1c38db279a6aca732b830e754979c51c4cb..3cc1c22ba338bc49caaac886b1a351d6c3284a93 100644
--- a/pkg/compiler/lib/src/resolution/semantic_visitor.dart
+++ b/pkg/compiler/lib/src/resolution/semantic_visitor.dart
@@ -91,16 +91,10 @@ abstract class SemanticDeclarationResolvedMixin<R, A>
}
}
- visitInitializers(NodeList initializers, A arg) {
- if (initializers != null) {
- for (Node node in initializers) {
- InitializerStructure structure = computeInitializerStructure(node);
- if (structure == null) {
- internalError(node, 'No structure for $node');
- } else {
- structure.dispatch(declVisitor, node, arg);
- }
- }
+ visitInitializers(FunctionExpression function, A arg) {
+ InitializersStructure initializers = computeInitializersStructure(function);
+ for (InitializerStructure structure in initializers.initializers) {
+ structure.dispatch(declVisitor, arg);
}
}
@@ -4009,8 +4003,8 @@ abstract class SemanticDeclarationVisitor<R, A> {
/// Apply this visitor to the [parameters].
applyParameters(NodeList parameters, A arg);
- /// Apply this visitor to the constructor [initializers].
- applyInitializers(NodeList initializers, A arg);
+ /// Apply this visitor to the initializers of [constructor].
+ applyInitializers(FunctionExpression constructor, A arg);
/// A declaration of a top level [getter].
///
@@ -4395,6 +4389,8 @@ abstract class SemanticDeclarationVisitor<R, A> {
/// C(a) : this.a = a, super();
/// }
///
+ // TODO(johnniwinther): Replace [initializers] with a structure like
+ // [InitializersStructure] when computed in resolution.
R visitGenerativeConstructorDeclaration(
FunctionExpression node,
ConstructorElement constructor,
@@ -4412,6 +4408,8 @@ abstract class SemanticDeclarationVisitor<R, A> {
/// C._();
/// }
///
+ // TODO(johnniwinther): Replace [initializers] with a single
+ // [ThisConstructorInvokeStructure] when computed in resolution.
R visitRedirectingGenerativeConstructorDeclaration(
FunctionExpression node,
ConstructorElement constructor,
@@ -4499,7 +4497,24 @@ abstract class SemanticDeclarationVisitor<R, A> {
ConstructorElement superConstructor,
InterfaceType type,
NodeList arguments,
- Selector selector,
+ CallStructure callStructure,
+ A arg);
+
+ /// An implicit super constructor invocation of [superConstructor] from
+ /// generative constructor initializers.
+ ///
+ /// For instance `super(42)` in
+ /// class B {
+ /// B();
+ /// }
+ /// class C extends B {
+ /// C(); // Implicit super call of B().
+ /// }
+ ///
+ R visitImplicitSuperConstructorInvoke(
+ FunctionExpression node,
+ ConstructorElement superConstructor,
+ InterfaceType type,
A arg);
/// An super constructor invocation of an unresolved with [arguments] as
@@ -4533,7 +4548,7 @@ abstract class SemanticDeclarationVisitor<R, A> {
Send node,
ConstructorElement thisConstructor,
NodeList arguments,
- Selector selector,
+ CallStructure callStructure,
A arg);
/// An this constructor invocation of an unresolved constructor with
« no previous file with comments | « pkg/compiler/lib/src/constants/constructors.dart ('k') | pkg/compiler/lib/src/resolution/semantic_visitor_mixins.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698