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

Side by Side Diff: pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart

Issue 1047673002: Add SemanticDeclVisitor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Correct long lines 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library dart2js.ir_builder_task; 5 library dart2js.ir_builder_task;
6 6
7 import '../closure.dart' as closurelib; 7 import '../closure.dart' as closurelib;
8 import '../closure.dart' hide ClosureScope; 8 import '../closure.dart' hide ClosureScope;
9 import '../constants/expressions.dart'; 9 import '../constants/expressions.dart';
10 import '../dart_types.dart'; 10 import '../dart_types.dart';
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 return result; 116 return result;
117 } 117 }
118 118
119 } 119 }
120 120
121 /** 121 /**
122 * A tree visitor that builds [IrNodes]. The visit methods add statements using 122 * A tree visitor that builds [IrNodes]. The visit methods add statements using
123 * to the [builder] and return the last added statement for trees that represent 123 * to the [builder] and return the last added statement for trees that represent
124 * an expression. 124 * an expression.
125 */ 125 */
126 abstract class IrBuilderVisitor extends SemanticVisitor<ir.Primitive, dynamic> 126 // TODO(johnniwinther): Implement [SemanticDeclVisitor].
127 abstract class IrBuilderVisitor extends ast.Visitor<ir.Primitive>
127 with IrBuilderMixin<ast.Node>, 128 with IrBuilderMixin<ast.Node>,
129 SemanticSendResolvedMixin<ir.Primitive, dynamic>,
130 SendResolverMixin,
128 BaseImplementationOfStaticsMixin<ir.Primitive, dynamic>, 131 BaseImplementationOfStaticsMixin<ir.Primitive, dynamic>,
129 BaseImplementationOfLocalsMixin<ir.Primitive, dynamic>, 132 BaseImplementationOfLocalsMixin<ir.Primitive, dynamic>,
130 BaseImplementationOfDynamicsMixin<ir.Primitive, dynamic>, 133 BaseImplementationOfDynamicsMixin<ir.Primitive, dynamic>,
131 BaseImplementationOfConstantsMixin<ir.Primitive, dynamic>, 134 BaseImplementationOfConstantsMixin<ir.Primitive, dynamic>,
132 BaseImplementationOfSuperIncDecsMixin<ir.Primitive, dynamic>, 135 BaseImplementationOfSuperIncDecsMixin<ir.Primitive, dynamic>,
133 BaseImplementationOfNewMixin<ir.Primitive, dynamic>, 136 BaseImplementationOfNewMixin<ir.Primitive, dynamic>,
134 ErrorBulkMixin<ir.Primitive, dynamic> 137 ErrorBulkMixin<ir.Primitive, dynamic>
135 implements SemanticSendVisitor<ir.Primitive, dynamic> { 138 implements SemanticSendVisitor<ir.Primitive, dynamic> {
139 final TreeElements elements;
136 final Compiler compiler; 140 final Compiler compiler;
137 final SourceInformationBuilder sourceInformationBuilder; 141 final SourceInformationBuilder sourceInformationBuilder;
138 142
139 // In SSA terms, join-point continuation parameters are the phis and the 143 // In SSA terms, join-point continuation parameters are the phis and the
140 // continuation invocation arguments are the corresponding phi inputs. To 144 // continuation invocation arguments are the corresponding phi inputs. To
141 // support name introduction and renaming for source level variables, we use 145 // support name introduction and renaming for source level variables, we use
142 // nested (delimited) visitors for constructing subparts of the IR that will 146 // nested (delimited) visitors for constructing subparts of the IR that will
143 // need renaming. Each source variable is assigned an index. 147 // need renaming. Each source variable is assigned an index.
144 // 148 //
145 // Each nested visitor maintains a list of free variable uses in the body. 149 // Each nested visitor maintains a list of free variable uses in the body.
146 // These are implemented as a list of parameters, each with their own use 150 // These are implemented as a list of parameters, each with their own use
147 // list of references. When the delimited subexpression is plugged into the 151 // list of references. When the delimited subexpression is plugged into the
148 // surrounding context, the free occurrences can be captured or become free 152 // surrounding context, the free occurrences can be captured or become free
149 // occurrences in the next outer delimited subexpression. 153 // occurrences in the next outer delimited subexpression.
150 // 154 //
151 // Each nested visitor maintains a list that maps indexes of variables 155 // Each nested visitor maintains a list that maps indexes of variables
152 // assigned in the delimited subexpression to their reaching definition --- 156 // assigned in the delimited subexpression to their reaching definition ---
153 // that is, the definition in effect at the hole in 'current'. These are 157 // that is, the definition in effect at the hole in 'current'. These are
154 // used to determine if a join-point continuation needs to be passed 158 // used to determine if a join-point continuation needs to be passed
155 // arguments, and what the arguments are. 159 // arguments, and what the arguments are.
156 160
157 /// Construct a top-level visitor. 161 /// Construct a top-level visitor.
158 IrBuilderVisitor(TreeElements elements, 162 IrBuilderVisitor(this.elements,
159 this.compiler, 163 this.compiler,
160 this.sourceInformationBuilder) 164 this.sourceInformationBuilder);
161 : super(elements);
162 165
163 @override 166 @override
164 bulkHandleNode(ast.Node node, String message, _) => giveup(node, message); 167 bulkHandleNode(ast.Node node, String message, _) => giveup(node, message);
165 168
166 @override 169 @override
167 ir.Primitive apply(ast.Node node, _) => node.accept(this); 170 ir.Primitive apply(ast.Node node, _) => node.accept(this);
168 171
169 @override 172 @override
170 SemanticSendVisitor get sendVisitor => this; 173 SemanticSendVisitor get sendVisitor => this;
171 174
(...skipping 2482 matching lines...) Expand 10 before | Expand all | Expand 10 after
2654 SourceInformation buildCall(ast.Node node) { 2657 SourceInformation buildCall(ast.Node node) {
2655 return new PositionSourceInformation( 2658 return new PositionSourceInformation(
2656 new TokenSourceLocation(sourceFile, node.getBeginToken(), name)); 2659 new TokenSourceLocation(sourceFile, node.getBeginToken(), name));
2657 } 2660 }
2658 2661
2659 @override 2662 @override
2660 SourceInformationBuilder forContext(AstElement element) { 2663 SourceInformationBuilder forContext(AstElement element) {
2661 return new PositionSourceInformationBuilder(element); 2664 return new PositionSourceInformationBuilder(element);
2662 } 2665 }
2663 } 2666 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698