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/codegen/js_metalet.dart

Issue 1160223006: Fix DDC errors on DDC (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: address 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
« no previous file with comments | « lib/src/codegen/js_codegen.dart ('k') | lib/src/codegen/reify_coercions.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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 library dev_compiler.src.codegen.js_metalet; 5 library dev_compiler.src.codegen.js_metalet;
6 6
7 // TODO(jmesserly): import from its own package 7 // TODO(jmesserly): import from its own package
8 import 'package:dev_compiler/src/js/js_ast.dart'; 8 import 'package:dev_compiler/src/js/js_ast.dart';
9 import 'package:dev_compiler/src/js/precedence.dart'; 9 import 'package:dev_compiler/src/js/precedence.dart';
10 10
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 var params = []; 125 var params = [];
126 var values = []; 126 var values = [];
127 var block = _build(params, values, new Block(statements)); 127 var block = _build(params, values, new Block(statements));
128 if (params.isEmpty) return block; 128 if (params.isEmpty) return block;
129 129
130 var vars = []; 130 var vars = [];
131 for (int i = 0; i < params.length; i++) { 131 for (int i = 0; i < params.length; i++) {
132 vars.add(new VariableInitialization(params[i], values[i])); 132 vars.add(new VariableInitialization(params[i], values[i]));
133 } 133 }
134 134
135 return new Block( 135 return new Block(<Statement>[
136 [new VariableDeclarationList('let', vars).toStatement(), block]); 136 new VariableDeclarationList('let', vars).toStatement(),
137 block
138 ]);
137 } 139 }
138 140
139 Node _build(List<TemporaryId> params, List<Expression> values, Node node) { 141 Node _build(List<TemporaryId> params, List<Expression> values, Node node) {
140 // Visit the tree and count how many times each temp was used. 142 // Visit the tree and count how many times each temp was used.
141 var counter = new _VariableUseCounter(); 143 var counter = new _VariableUseCounter();
142 node.accept(counter); 144 node.accept(counter);
143 // Also count the init expressions. 145 // Also count the init expressions.
144 for (var init in variables.values) init.accept(counter); 146 for (var init in variables.values) init.accept(counter);
145 147
146 var substitutions = {}; 148 var substitutions = {};
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 bool found = false; 233 bool found = false;
232 _IdentFinder(this.name); 234 _IdentFinder(this.name);
233 235
234 visitIdentifier(Identifier node) { 236 visitIdentifier(Identifier node) {
235 if (node.name == name) found = true; 237 if (node.name == name) found = true;
236 } 238 }
237 visitNode(Node node) { 239 visitNode(Node node) {
238 if (!found) super.visitNode(node); 240 if (!found) super.visitNode(node);
239 } 241 }
240 } 242 }
OLDNEW
« no previous file with comments | « lib/src/codegen/js_codegen.dart ('k') | lib/src/codegen/reify_coercions.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698