OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 import 'dart:collection' show HashSet, HashMap, SplayTreeSet; | 5 import 'dart:collection' show HashSet, HashMap, SplayTreeSet; |
6 | 6 |
7 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; | 7 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; |
8 import 'package:analyzer/dart/ast/token.dart'; | 8 import 'package:analyzer/dart/ast/token.dart'; |
9 import 'package:analyzer/dart/element/element.dart'; | 9 import 'package:analyzer/dart/element/element.dart'; |
10 import 'package:analyzer/dart/element/visitor.dart'; | 10 import 'package:analyzer/dart/element/visitor.dart'; |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 _isDartRuntime = currentLibrary.source.uri.toString() == 'dart:_runtime'; | 135 _isDartRuntime = currentLibrary.source.uri.toString() == 'dart:_runtime'; |
136 } | 136 } |
137 | 137 |
138 TypeProvider get types => _types; | 138 TypeProvider get types => _types; |
139 | 139 |
140 JS.Program emitLibrary(List<CompilationUnit> units) { | 140 JS.Program emitLibrary(List<CompilationUnit> units) { |
141 // Copy the AST before modifying it. | 141 // Copy the AST before modifying it. |
142 units = units.map(_cloneCompilationUnit).toList(); | 142 units = units.map(_cloneCompilationUnit).toList(); |
143 | 143 |
144 // Modify the AST to make coercions explicit. | 144 // Modify the AST to make coercions explicit. |
145 new CoercionReifier(rules).reify(units); | 145 new CoercionReifier().reify(units); |
146 | 146 |
147 units.last.directives.forEach(_visit); | 147 units.last.directives.forEach(_visit); |
148 | 148 |
149 // Rather than directly visit declarations, we instead use [_loader] to | 149 // Rather than directly visit declarations, we instead use [_loader] to |
150 // visit them. It has the ability to sort elements on demand, so | 150 // visit them. It has the ability to sort elements on demand, so |
151 // dependencies between top level items are handled with a minimal | 151 // dependencies between top level items are handled with a minimal |
152 // reordering of the user's input code. The loader will call back into | 152 // reordering of the user's input code. The loader will call back into |
153 // this visitor via [_emitModuleItem] when it's ready to visit the item | 153 // this visitor via [_emitModuleItem] when it's ready to visit the item |
154 // for real. | 154 // for real. |
155 _loader.collectElements(currentLibrary, units); | 155 _loader.collectElements(currentLibrary, units); |
(...skipping 3730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3886 | 3886 |
3887 @override | 3887 @override |
3888 ExpressionFunctionBody visitExpressionFunctionBody( | 3888 ExpressionFunctionBody visitExpressionFunctionBody( |
3889 ExpressionFunctionBody node) { | 3889 ExpressionFunctionBody node) { |
3890 var clone = super.visitExpressionFunctionBody(node); | 3890 var clone = super.visitExpressionFunctionBody(node); |
3891 (clone as FunctionBodyImpl).localVariableInfo = | 3891 (clone as FunctionBodyImpl).localVariableInfo = |
3892 (node as FunctionBodyImpl).localVariableInfo; | 3892 (node as FunctionBodyImpl).localVariableInfo; |
3893 return clone; | 3893 return clone; |
3894 } | 3894 } |
3895 } | 3895 } |
OLD | NEW |