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

Side by Side Diff: pkg/js_ast/lib/src/template.dart

Issue 1198293002: dart2js: Use an abstract Name class for names in the generated JavaScript ast. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Comments Created 5 years, 6 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
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 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 .map(visit) 678 .map(visit)
679 .toList(growable: false); 679 .toList(growable: false);
680 return (arguments) { 680 return (arguments) {
681 List<Literal> parts = partMakers 681 List<Literal> parts = partMakers
682 .map((Instantiator instantiator) => instantiator(arguments)) 682 .map((Instantiator instantiator) => instantiator(arguments))
683 .toList(growable: false); 683 .toList(growable: false);
684 return new StringConcatenation(parts); 684 return new StringConcatenation(parts);
685 }; 685 };
686 } 686 }
687 687
688 Instantiator visitName(Name node) => same(node);
689
688 Instantiator visitArrayInitializer(ArrayInitializer node) { 690 Instantiator visitArrayInitializer(ArrayInitializer node) {
689 // TODO(sra): Implement splicing? 691 // TODO(sra): Implement splicing?
690 List<Instantiator> elementMakers = node.elements 692 List<Instantiator> elementMakers = node.elements
691 .map(visit) 693 .map(visit)
692 .toList(growable: false); 694 .toList(growable: false);
693 return (arguments) { 695 return (arguments) {
694 List<Expression> elements = elementMakers 696 List<Expression> elements = elementMakers
695 .map((Instantiator instantiator) => instantiator(arguments)) 697 .map((Instantiator instantiator) => instantiator(arguments))
696 .toList(growable: false); 698 .toList(growable: false);
697 return new ArrayInitializer(elements); 699 return new ArrayInitializer(elements);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 if (count != before) containsInterpolatedNode.add(node); 767 if (count != before) containsInterpolatedNode.add(node);
766 return null; 768 return null;
767 } 769 }
768 770
769 visitInterpolatedNode(InterpolatedNode node) { 771 visitInterpolatedNode(InterpolatedNode node) {
770 containsInterpolatedNode.add(node); 772 containsInterpolatedNode.add(node);
771 if (node.isNamed) holeNames.add(node.nameOrPosition); 773 if (node.isNamed) holeNames.add(node.nameOrPosition);
772 ++count; 774 ++count;
773 } 775 }
774 } 776 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698