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

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

Issue 1153243003: dart2js: Use frequency of occurence to sort metadata indices. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Minor cleanups 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 636 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 params.addAll(result); 647 params.addAll(result);
648 } else { 648 } else {
649 params.add(result); 649 params.add(result);
650 } 650 }
651 } 651 }
652 Statement body = makeBody(arguments); 652 Statement body = makeBody(arguments);
653 return new Fun(params, body); 653 return new Fun(params, body);
654 }; 654 };
655 } 655 }
656 656
657 Instantiator visitDeferredExpression(DeferredExpression node) => same(node);
658
659 Instantiator visitDeferredNumber(DeferredNumber node) => same(node);
660
661 Instantiator visitDeferredString(DeferredString node) =>
662 (arguments) => node;
663
657 Instantiator visitLiteralBool(LiteralBool node) => 664 Instantiator visitLiteralBool(LiteralBool node) =>
658 (arguments) => new LiteralBool(node.value); 665 (arguments) => new LiteralBool(node.value);
659 666
660 Instantiator visitLiteralString(LiteralString node) => 667 Instantiator visitLiteralString(LiteralString node) =>
661 (arguments) => new LiteralString(node.value); 668 (arguments) => new LiteralString(node.value);
662 669
663 Instantiator visitLiteralNumber(LiteralNumber node) => 670 Instantiator visitLiteralNumber(LiteralNumber node) =>
664 (arguments) => new LiteralNumber(node.value); 671 (arguments) => new LiteralNumber(node.value);
665 672
666 Instantiator visitLiteralNull(LiteralNull node) => 673 Instantiator visitLiteralNull(LiteralNull node) =>
667 (arguments) => new LiteralNull(); 674 (arguments) => new LiteralNull();
668 675
676 Instantiator visitStringConcatenation(StringConcatenation node) {
677 List<Instantiator> partMakers = node.parts
678 .map(visit)
679 .toList(growable: false);
680 return (arguments) {
681 List<Literal> parts = partMakers
682 .map((Instantiator instantiator) => instantiator(arguments))
sra1 2015/06/10 19:30:00 This is fine. I was wondering if you saw a use fo
herhut 2015/06/11 08:03:55 I only use them in a very limited form but wanted
683 .toList(growable: false);
684 return new StringConcatenation(parts);
685 };
686 }
687
669 Instantiator visitArrayInitializer(ArrayInitializer node) { 688 Instantiator visitArrayInitializer(ArrayInitializer node) {
670 // TODO(sra): Implement splicing? 689 // TODO(sra): Implement splicing?
671 List<Instantiator> elementMakers = node.elements 690 List<Instantiator> elementMakers = node.elements
672 .map(visit) 691 .map(visit)
673 .toList(growable: false); 692 .toList(growable: false);
674 return (arguments) { 693 return (arguments) {
675 List<Expression> elements = elementMakers 694 List<Expression> elements = elementMakers
676 .map((Instantiator instantiator) => instantiator(arguments)) 695 .map((Instantiator instantiator) => instantiator(arguments))
677 .toList(growable: false); 696 .toList(growable: false);
678 return new ArrayInitializer(elements); 697 return new ArrayInitializer(elements);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 if (count != before) containsInterpolatedNode.add(node); 765 if (count != before) containsInterpolatedNode.add(node);
747 return null; 766 return null;
748 } 767 }
749 768
750 visitInterpolatedNode(InterpolatedNode node) { 769 visitInterpolatedNode(InterpolatedNode node) {
751 containsInterpolatedNode.add(node); 770 containsInterpolatedNode.add(node);
752 if (node.isNamed) holeNames.add(node.nameOrPosition); 771 if (node.isNamed) holeNames.add(node.nameOrPosition);
753 ++count; 772 ++count;
754 } 773 }
755 } 774 }
OLDNEW
« pkg/js_ast/lib/src/nodes.dart ('K') | « pkg/js_ast/lib/src/printer.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698