| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 analyzer2dart.cps_generator; | 5 library analyzer2dart.cps_generator; |
| 6 | 6 |
| 7 import 'package:analyzer/analyzer.dart'; | 7 import 'package:analyzer/analyzer.dart'; |
| 8 | 8 |
| 9 import 'package:compiler/implementation/dart_types.dart' as dart2js; | 9 import 'package:compiler/implementation/dart_types.dart' as dart2js; |
| 10 import 'package:compiler/implementation/elements/elements.dart' as dart2js; | 10 import 'package:compiler/implementation/elements/elements.dart' as dart2js; |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 subbuild(node.thenStatement), | 297 subbuild(node.thenStatement), |
| 298 subbuild(node.elseStatement)); | 298 subbuild(node.elseStatement)); |
| 299 } | 299 } |
| 300 | 300 |
| 301 @override | 301 @override |
| 302 visitBlock(Block node) { | 302 visitBlock(Block node) { |
| 303 irBuilder.buildBlock(node.statements, build); | 303 irBuilder.buildBlock(node.statements, build); |
| 304 } | 304 } |
| 305 | 305 |
| 306 @override | 306 @override |
| 307 ir.Node visitListLiteral(ListLiteral node) { |
| 308 dart2js.InterfaceType type = converter.convertType(node.staticType); |
| 309 // TODO(johnniwinther): Use `build` instead of `(e) => build(e)` when issue |
| 310 // 18630 has been resolved. |
| 311 Iterable<ir.Primitive> values = node.elements.map((e) => build(e)); |
| 312 return irBuilder.buildListLiteral(type, values); |
| 313 } |
| 314 |
| 315 @override |
| 316 ir.Node visitMapLiteral(MapLiteral node) { |
| 317 dart2js.InterfaceType type = converter.convertType(node.staticType); |
| 318 return irBuilder.buildMapLiteral( |
| 319 type, |
| 320 node.entries.map((e) => e.key), |
| 321 node.entries.map((e) => e.value), |
| 322 build); |
| 323 } |
| 324 |
| 325 @override |
| 307 visitForStatement(ForStatement node) { | 326 visitForStatement(ForStatement node) { |
| 308 // TODO(johnniwinther): Support `for` as a jump target. | 327 // TODO(johnniwinther): Support `for` as a jump target. |
| 309 SubbuildFunction buildInitializer; | 328 SubbuildFunction buildInitializer; |
| 310 if (node.variables != null) { | 329 if (node.variables != null) { |
| 311 buildInitializer = subbuild(node.variables); | 330 buildInitializer = subbuild(node.variables); |
| 312 } else { | 331 } else { |
| 313 buildInitializer = subbuild(node.initialization); | 332 buildInitializer = subbuild(node.initialization); |
| 314 } | 333 } |
| 315 irBuilder.buildFor(buildInitializer: buildInitializer, | 334 irBuilder.buildFor(buildInitializer: buildInitializer, |
| 316 buildCondition: subbuild(node.condition), | 335 buildCondition: subbuild(node.condition), |
| 317 buildBody: subbuild(node.body), | 336 buildBody: subbuild(node.body), |
| 318 buildUpdate: subbuildSequence(node.updaters)); | 337 buildUpdate: subbuildSequence(node.updaters)); |
| 319 } | 338 } |
| 320 } | 339 } |
| OLD | NEW |