| 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 library dev_compiler.src.codegen.js_codegen; | 5 library dev_compiler.src.codegen.js_codegen; |
| 6 | 6 |
| 7 import 'dart:collection' show HashSet, HashMap; | 7 import 'dart:collection' show HashSet, HashMap; |
| 8 import 'dart:io' show Directory, File; | 8 import 'dart:io' show Directory, File; |
| 9 | 9 |
| 10 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; | 10 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; |
| (...skipping 1731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1742 if (node.parent is ExpressionStatement) { | 1742 if (node.parent is ExpressionStatement) { |
| 1743 return js.statement('throw #;', _visit(_catchParameter)); | 1743 return js.statement('throw #;', _visit(_catchParameter)); |
| 1744 } else { | 1744 } else { |
| 1745 return js.call('dart.throw_(#)', _visit(_catchParameter)); | 1745 return js.call('dart.throw_(#)', _visit(_catchParameter)); |
| 1746 } | 1746 } |
| 1747 } | 1747 } |
| 1748 | 1748 |
| 1749 @override | 1749 @override |
| 1750 JS.If visitIfStatement(IfStatement node) { | 1750 JS.If visitIfStatement(IfStatement node) { |
| 1751 return new JS.If(_visit(node.condition), _visit(node.thenStatement), | 1751 return new JS.If(_visit(node.condition), _visit(node.thenStatement), |
| 1752 _visitOrEmpty(node.elseStatement)); | 1752 _visit(node.elseStatement)); |
| 1753 } | 1753 } |
| 1754 | 1754 |
| 1755 @override | 1755 @override |
| 1756 JS.For visitForStatement(ForStatement node) { | 1756 JS.For visitForStatement(ForStatement node) { |
| 1757 var init = _visit(node.initialization); | 1757 var init = _visit(node.initialization); |
| 1758 if (init == null) init = _visit(node.variables); | 1758 if (init == null) init = _visit(node.variables); |
| 1759 return new JS.For(init, _visit(node.condition), | 1759 return new JS.For(init, _visit(node.condition), |
| 1760 _visitListToBinary(node.updaters, ','), _visit(node.body)); | 1760 _visitListToBinary(node.updaters, ','), _visit(node.body)); |
| 1761 } | 1761 } |
| 1762 | 1762 |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2329 | 2329 |
| 2330 // TODO(jmesserly): in many cases marking the end will be unncessary. | 2330 // TODO(jmesserly): in many cases marking the end will be unncessary. |
| 2331 printer.mark(_location(node.end)); | 2331 printer.mark(_location(node.end)); |
| 2332 } | 2332 } |
| 2333 | 2333 |
| 2334 String _getIdentifier(AstNode node) { | 2334 String _getIdentifier(AstNode node) { |
| 2335 if (node is SimpleIdentifier) return node.name; | 2335 if (node is SimpleIdentifier) return node.name; |
| 2336 return null; | 2336 return null; |
| 2337 } | 2337 } |
| 2338 } | 2338 } |
| OLD | NEW |