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

Side by Side Diff: pkg/kernel/lib/clone.dart

Issue 2874973004: [kernel] Add support for cloning Vector nodes and ClosureCreation (Closed)
Patch Set: Created 3 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 | « no previous file | 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 library kernel.clone; 4 library kernel.clone;
5 5
6 import 'ast.dart'; 6 import 'ast.dart';
7 import 'type_algebra.dart'; 7 import 'type_algebra.dart';
8 8
9 /// Visitor that return a clone of a tree, maintaining references to cloned 9 /// Visitor that return a clone of a tree, maintaining references to cloned
10 /// objects. 10 /// objects.
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 220
221 visitNullLiteral(NullLiteral node) { 221 visitNullLiteral(NullLiteral node) {
222 return new NullLiteral(); 222 return new NullLiteral();
223 } 223 }
224 224
225 visitLet(Let node) { 225 visitLet(Let node) {
226 var newVariable = clone(node.variable); 226 var newVariable = clone(node.variable);
227 return new Let(newVariable, clone(node.body)); 227 return new Let(newVariable, clone(node.body));
228 } 228 }
229 229
230 visitVectorCreation(VectorCreation node) {
231 return new VectorCreation(node.length);
232 }
233
234 visitClosureCreation(ClosureCreation node) {
235 return new ClosureCreation.byReference(
236 node.topLevelFunctionReference,
237 cloneOptional(node.contextVector),
238 visitOptionalType(node.functionType));
239 }
240
241 visitVectorSet(VectorSet node) {
242 return new VectorSet(
243 clone(node.vectorExpression), node.index, clone(node.value));
244 }
245
246 visitVectorGet(VectorGet node) {
247 return new VectorGet(clone(node.vectorExpression), node.index);
248 }
249
250 visitVectorCopy(VectorCopy node) {
251 return new VectorCopy(clone(node.vectorExpression));
252 }
253
230 // Statements 254 // Statements
231 visitInvalidStatement(InvalidStatement node) { 255 visitInvalidStatement(InvalidStatement node) {
232 return new InvalidStatement(); 256 return new InvalidStatement();
233 } 257 }
234 258
235 visitExpressionStatement(ExpressionStatement node) { 259 visitExpressionStatement(ExpressionStatement node) {
236 return new ExpressionStatement(clone(node.expression)); 260 return new ExpressionStatement(clone(node.expression));
237 } 261 }
238 262
239 visitBlock(Block node) { 263 visitBlock(Block node) {
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 visitArguments(Arguments node) { 429 visitArguments(Arguments node) {
406 return new Arguments(node.positional.map(clone).toList(), 430 return new Arguments(node.positional.map(clone).toList(),
407 types: node.types.map(visitType).toList(), 431 types: node.types.map(visitType).toList(),
408 named: node.named.map(clone).toList()); 432 named: node.named.map(clone).toList());
409 } 433 }
410 434
411 visitNamedExpression(NamedExpression node) { 435 visitNamedExpression(NamedExpression node) {
412 return new NamedExpression(node.name, clone(node.value)); 436 return new NamedExpression(node.name, clone(node.value));
413 } 437 }
414 } 438 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698