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 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 } | 850 } |
851 | 851 |
852 @override | 852 @override |
853 Instantiator visitObjectBindingPattern(ObjectBindingPattern node) { | 853 Instantiator visitObjectBindingPattern(ObjectBindingPattern node) { |
854 List<Instantiator> makeVars = node.variables.map(this.visit).toList(); | 854 List<Instantiator> makeVars = node.variables.map(this.visit).toList(); |
855 return (arguments) { | 855 return (arguments) { |
856 return new ObjectBindingPattern( | 856 return new ObjectBindingPattern( |
857 makeVars.map((m) => m(arguments)).toList()); | 857 makeVars.map((m) => m(arguments)).toList()); |
858 }; | 858 }; |
859 } | 859 } |
| 860 |
| 861 @override |
| 862 Instantiator visitSimpleBindingPattern(SimpleBindingPattern node) => |
| 863 (arguments) => new SimpleBindingPattern(new Identifier(node.name.name)); |
860 } | 864 } |
861 | 865 |
862 /** | 866 /** |
863 * InterpolatedNodeAnalysis determines which AST trees contain | 867 * InterpolatedNodeAnalysis determines which AST trees contain |
864 * [InterpolatedNode]s, and the names of the named interpolated nodes. | 868 * [InterpolatedNode]s, and the names of the named interpolated nodes. |
865 */ | 869 */ |
866 class InterpolatedNodeAnalysis extends BaseVisitor { | 870 class InterpolatedNodeAnalysis extends BaseVisitor { |
867 final Set<Node> containsInterpolatedNode = new Set<Node>(); | 871 final Set<Node> containsInterpolatedNode = new Set<Node>(); |
868 final Set<String> holeNames = new Set<String>(); | 872 final Set<String> holeNames = new Set<String>(); |
869 int count = 0; | 873 int count = 0; |
(...skipping 13 matching lines...) Expand all Loading... |
883 if (count != before) containsInterpolatedNode.add(node); | 887 if (count != before) containsInterpolatedNode.add(node); |
884 return null; | 888 return null; |
885 } | 889 } |
886 | 890 |
887 visitInterpolatedNode(InterpolatedNode node) { | 891 visitInterpolatedNode(InterpolatedNode node) { |
888 containsInterpolatedNode.add(node); | 892 containsInterpolatedNode.add(node); |
889 if (node.isNamed) holeNames.add(node.nameOrPosition); | 893 if (node.isNamed) holeNames.add(node.nameOrPosition); |
890 ++count; | 894 ++count; |
891 } | 895 } |
892 } | 896 } |
OLD | NEW |