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 part of js_ast; | 5 part of js_ast; |
6 | 6 |
7 class TemplateManager { | 7 class TemplateManager { |
8 Map<String, Template> expressionTemplates = new Map<String, Template>(); | 8 Map<String, Template> expressionTemplates = new Map<String, Template>(); |
9 Map<String, Template> statementTemplates = new Map<String, Template>(); | 9 Map<String, Template> statementTemplates = new Map<String, Template>(); |
10 | 10 |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 if (result is Iterable) { | 663 if (result is Iterable) { |
664 for (var r in result) params.add(r); | 664 for (var r in result) params.add(r); |
665 } else { | 665 } else { |
666 params.add(result); | 666 params.add(result); |
667 } | 667 } |
668 } | 668 } |
669 var body = makeBody(arguments); | 669 var body = makeBody(arguments); |
670 if (node is ArrowFun) { | 670 if (node is ArrowFun) { |
671 return new ArrowFun(params, body); | 671 return new ArrowFun(params, body); |
672 } else if (node is Fun) { | 672 } else if (node is Fun) { |
673 return new Fun(params, body); | 673 return new Fun(params, body, |
| 674 isGenerator: node.isGenerator, asyncModifier: node.asyncModifier); |
674 } else { | 675 } else { |
675 throw "Unknown FunctionExpression type ${node.runtimeType}: $node"; | 676 throw "Unknown FunctionExpression type ${node.runtimeType}: $node"; |
676 } | 677 } |
677 }; | 678 }; |
678 } | 679 } |
679 | 680 |
680 Instantiator visitFun(Fun node) => visitFunctionExpression(node); | 681 Instantiator visitFun(Fun node) => visitFunctionExpression(node); |
681 | 682 |
682 Instantiator visitArrowFun(ArrowFun node) => visitFunctionExpression(node); | 683 Instantiator visitArrowFun(ArrowFun node) => visitFunctionExpression(node); |
683 | 684 |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 if (count != before) containsInterpolatedNode.add(node); | 913 if (count != before) containsInterpolatedNode.add(node); |
913 return null; | 914 return null; |
914 } | 915 } |
915 | 916 |
916 visitInterpolatedNode(InterpolatedNode node) { | 917 visitInterpolatedNode(InterpolatedNode node) { |
917 containsInterpolatedNode.add(node); | 918 containsInterpolatedNode.add(node); |
918 if (node.isNamed) holeNames.add(node.nameOrPosition); | 919 if (node.isNamed) holeNames.add(node.nameOrPosition); |
919 ++count; | 920 ++count; |
920 } | 921 } |
921 } | 922 } |
OLD | NEW |