| OLD | NEW |
| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 return result; | 122 return result; |
| 123 } | 123 } |
| 124 | 124 |
| 125 } | 125 } |
| 126 | 126 |
| 127 /** | 127 /** |
| 128 * A tree visitor that builds [IrNodes]. The visit methods add statements using | 128 * A tree visitor that builds [IrNodes]. The visit methods add statements using |
| 129 * to the [builder] and return the last added statement for trees that represent | 129 * to the [builder] and return the last added statement for trees that represent |
| 130 * an expression. | 130 * an expression. |
| 131 */ | 131 */ |
| 132 abstract class IrBuilderVisitor extends SemanticVisitor<ir.Primitive, dynamic> | 132 // TODO(johnniwinther): Implement [SemanticDeclVisitor]. |
| 133 abstract class IrBuilderVisitor extends ast.Visitor<ir.Primitive> |
| 133 with IrBuilderMixin<ast.Node>, | 134 with IrBuilderMixin<ast.Node>, |
| 135 SemanticSendResolvedMixin<ir.Primitive, dynamic>, |
| 136 SendResolverMixin, |
| 134 BaseImplementationOfStaticsMixin<ir.Primitive, dynamic>, | 137 BaseImplementationOfStaticsMixin<ir.Primitive, dynamic>, |
| 135 BaseImplementationOfLocalsMixin<ir.Primitive, dynamic>, | 138 BaseImplementationOfLocalsMixin<ir.Primitive, dynamic>, |
| 136 BaseImplementationOfDynamicsMixin<ir.Primitive, dynamic>, | 139 BaseImplementationOfDynamicsMixin<ir.Primitive, dynamic>, |
| 137 BaseImplementationOfConstantsMixin<ir.Primitive, dynamic>, | 140 BaseImplementationOfConstantsMixin<ir.Primitive, dynamic>, |
| 138 BaseImplementationOfSuperIncDecsMixin<ir.Primitive, dynamic>, | 141 BaseImplementationOfSuperIncDecsMixin<ir.Primitive, dynamic>, |
| 139 BaseImplementationOfNewMixin<ir.Primitive, dynamic>, | 142 BaseImplementationOfNewMixin<ir.Primitive, dynamic>, |
| 140 ErrorBulkMixin<ir.Primitive, dynamic> | 143 ErrorBulkMixin<ir.Primitive, dynamic> |
| 141 implements SemanticSendVisitor<ir.Primitive, dynamic> { | 144 implements SemanticSendVisitor<ir.Primitive, dynamic> { |
| 145 final TreeElements elements; |
| 142 final Compiler compiler; | 146 final Compiler compiler; |
| 143 final SourceInformationBuilder sourceInformationBuilder; | 147 final SourceInformationBuilder sourceInformationBuilder; |
| 144 | 148 |
| 145 /// A map from try statements in the source to analysis information about | 149 /// A map from try statements in the source to analysis information about |
| 146 /// them. | 150 /// them. |
| 147 /// | 151 /// |
| 148 /// The analysis information includes the set of variables that must be | 152 /// The analysis information includes the set of variables that must be |
| 149 /// copied into [ir.MutableVariable]s on entry to the try and copied out on | 153 /// copied into [ir.MutableVariable]s on entry to the try and copied out on |
| 150 /// exit. | 154 /// exit. |
| 151 Map<ast.TryStatement, TryStatementInfo> tryStatements = null; | 155 Map<ast.TryStatement, TryStatementInfo> tryStatements = null; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 162 // surrounding context, the free occurrences can be captured or become free | 166 // surrounding context, the free occurrences can be captured or become free |
| 163 // occurrences in the next outer delimited subexpression. | 167 // occurrences in the next outer delimited subexpression. |
| 164 // | 168 // |
| 165 // Each nested visitor maintains a list that maps indexes of variables | 169 // Each nested visitor maintains a list that maps indexes of variables |
| 166 // assigned in the delimited subexpression to their reaching definition --- | 170 // assigned in the delimited subexpression to their reaching definition --- |
| 167 // that is, the definition in effect at the hole in 'current'. These are | 171 // that is, the definition in effect at the hole in 'current'. These are |
| 168 // used to determine if a join-point continuation needs to be passed | 172 // used to determine if a join-point continuation needs to be passed |
| 169 // arguments, and what the arguments are. | 173 // arguments, and what the arguments are. |
| 170 | 174 |
| 171 /// Construct a top-level visitor. | 175 /// Construct a top-level visitor. |
| 172 IrBuilderVisitor(TreeElements elements, | 176 IrBuilderVisitor(this.elements, |
| 173 this.compiler, | 177 this.compiler, |
| 174 this.sourceInformationBuilder) | 178 this.sourceInformationBuilder); |
| 175 : super(elements); | |
| 176 | 179 |
| 177 @override | 180 @override |
| 178 bulkHandleNode(ast.Node node, String message, _) => giveup(node, message); | 181 bulkHandleNode(ast.Node node, String message, _) => giveup(node, message); |
| 179 | 182 |
| 180 String bailoutMessage = null; | 183 String bailoutMessage = null; |
| 181 | 184 |
| 182 @override | 185 @override |
| 183 ir.Primitive apply(ast.Node node, _) => node.accept(this); | 186 ir.Primitive apply(ast.Node node, _) => node.accept(this); |
| 184 | 187 |
| 185 @override | 188 @override |
| (...skipping 2548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2734 SourceInformation buildCall(ast.Node node) { | 2737 SourceInformation buildCall(ast.Node node) { |
| 2735 return new PositionSourceInformation( | 2738 return new PositionSourceInformation( |
| 2736 new TokenSourceLocation(sourceFile, node.getBeginToken(), name)); | 2739 new TokenSourceLocation(sourceFile, node.getBeginToken(), name)); |
| 2737 } | 2740 } |
| 2738 | 2741 |
| 2739 @override | 2742 @override |
| 2740 SourceInformationBuilder forContext(AstElement element) { | 2743 SourceInformationBuilder forContext(AstElement element) { |
| 2741 return new PositionSourceInformationBuilder(element); | 2744 return new PositionSourceInformationBuilder(element); |
| 2742 } | 2745 } |
| 2743 } | 2746 } |
| OLD | NEW |