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

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: 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 visitTokenExpression(TokenExpression node) =>
sra1 2015/05/27 19:38:51 => same;
herhut 2015/06/01 12:09:43 Neat!
658 (arguments) => node;
659
660 Instantiator visitTokenNumber(TokenNumber node) =>
sra1 2015/05/27 19:38:51 ditto
herhut 2015/06/01 12:09:43 Done.
661 (arguments) => node;
662
663 Instantiator visitTokenString(TokenString node) =>
664 (arguments) => node;
665
657 Instantiator visitLiteralBool(LiteralBool node) => 666 Instantiator visitLiteralBool(LiteralBool node) =>
658 (arguments) => new LiteralBool(node.value); 667 (arguments) => new LiteralBool(node.value);
659 668
660 Instantiator visitLiteralString(LiteralString node) => 669 Instantiator visitLiteralString(LiteralString node) =>
661 (arguments) => new LiteralString(node.value); 670 (arguments) => new LiteralString(node.value);
662 671
663 Instantiator visitLiteralNumber(LiteralNumber node) => 672 Instantiator visitLiteralNumber(LiteralNumber node) =>
664 (arguments) => new LiteralNumber(node.value); 673 (arguments) => new LiteralNumber(node.value);
665 674
666 Instantiator visitLiteralNull(LiteralNull node) => 675 Instantiator visitLiteralNull(LiteralNull node) =>
667 (arguments) => new LiteralNull(); 676 (arguments) => new LiteralNull();
668 677
678 Instantiator visitStringConcatenation(StringConcatenation node) {
679 List<Instantiator> partMakers = node.parts
680 .map(visit)
681 .toList(growable: false);
682 return (arguments) {
683 List<Literal> parts = partMakers
684 .map((Instantiator instantiator) => instantiator(arguments))
685 .toList(growable: false);
686 return new StringConcatenation(parts);
687 };
688 }
689
669 Instantiator visitArrayInitializer(ArrayInitializer node) { 690 Instantiator visitArrayInitializer(ArrayInitializer node) {
670 // TODO(sra): Implement splicing? 691 // TODO(sra): Implement splicing?
671 List<Instantiator> elementMakers = node.elements 692 List<Instantiator> elementMakers = node.elements
672 .map(visit) 693 .map(visit)
673 .toList(growable: false); 694 .toList(growable: false);
674 return (arguments) { 695 return (arguments) {
675 List<Expression> elements = elementMakers 696 List<Expression> elements = elementMakers
676 .map((Instantiator instantiator) => instantiator(arguments)) 697 .map((Instantiator instantiator) => instantiator(arguments))
677 .toList(growable: false); 698 .toList(growable: false);
678 return new ArrayInitializer(elements); 699 return new ArrayInitializer(elements);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 if (count != before) containsInterpolatedNode.add(node); 767 if (count != before) containsInterpolatedNode.add(node);
747 return null; 768 return null;
748 } 769 }
749 770
750 visitInterpolatedNode(InterpolatedNode node) { 771 visitInterpolatedNode(InterpolatedNode node) {
751 containsInterpolatedNode.add(node); 772 containsInterpolatedNode.add(node);
752 if (node.isNamed) holeNames.add(node.nameOrPosition); 773 if (node.isNamed) holeNames.add(node.nameOrPosition);
753 ++count; 774 ++count;
754 } 775 }
755 } 776 }
OLDNEW
« pkg/js_ast/lib/src/printer.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