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

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

Issue 1140703006: dart2js: Construct the entire output as a single AST before printing. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Comments Created 5 years, 7 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 | « pkg/js_ast/lib/src/printer.dart ('k') | no next file » | 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 Instantiator instantiator; 49 Instantiator instantiator;
50 50
51 int positionalArgumentCount = -1; 51 int positionalArgumentCount = -1;
52 52
53 // Null, unless there are named holes. 53 // Null, unless there are named holes.
54 List<String> holeNames; 54 List<String> holeNames;
55 bool get isPositional => holeNames == null; 55 bool get isPositional => holeNames == null;
56 56
57 Template(this.source, this.ast, 57 Template(this.source, this.ast,
58 {this.isExpression: true, this.forceCopy: false}) { 58 {this.isExpression: true, this.forceCopy: false}) {
59 assert(this.isExpression ? ast is Expression : ast is Statement);
59 _compile(); 60 _compile();
60 } 61 }
61 62
62 Template.withExpressionResult(this.ast) 63 Template.withExpressionResult(this.ast)
63 : source = null, isExpression = true, forceCopy = false { 64 : source = null, isExpression = true, forceCopy = false {
64 assert(ast is Expression); 65 assert(ast is Expression);
65 assert(_checkNoPlaceholders()); 66 assert(_checkNoPlaceholders());
66 positionalArgumentCount = 0; 67 positionalArgumentCount = 0;
67 instantiator = (arguments) => ast; 68 instantiator = (arguments) => ast;
68 } 69 }
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 if (count != before) containsInterpolatedNode.add(node); 746 if (count != before) containsInterpolatedNode.add(node);
746 return null; 747 return null;
747 } 748 }
748 749
749 visitInterpolatedNode(InterpolatedNode node) { 750 visitInterpolatedNode(InterpolatedNode node) {
750 containsInterpolatedNode.add(node); 751 containsInterpolatedNode.add(node);
751 if (node.isNamed) holeNames.add(node.nameOrPosition); 752 if (node.isNamed) holeNames.add(node.nameOrPosition);
752 ++count; 753 ++count;
753 } 754 }
754 } 755 }
OLDNEW
« no previous file with comments | « 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