Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Side by Side Diff: lib/src/js/template.dart

Issue 1677863002: Use default params when --destructure-named-params + fix renaming of reserved destructured params (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/src/js/printer.dart ('k') | test/codegen/destructuring.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « lib/src/js/printer.dart ('k') | test/codegen/destructuring.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698