OLD | NEW |
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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 | 353 |
354 visitYieldStatement(YieldStatement node) { | 354 visitYieldStatement(YieldStatement node) { |
355 return new YieldStatement(clone(node.expression)); | 355 return new YieldStatement(clone(node.expression)); |
356 } | 356 } |
357 | 357 |
358 visitVariableDeclaration(VariableDeclaration node) { | 358 visitVariableDeclaration(VariableDeclaration node) { |
359 return variables[node] = new VariableDeclaration(node.name, | 359 return variables[node] = new VariableDeclaration(node.name, |
360 initializer: cloneOptional(node.initializer), | 360 initializer: cloneOptional(node.initializer), |
361 type: visitType(node.type), | 361 type: visitType(node.type), |
362 isFinal: node.isFinal, | 362 isFinal: node.isFinal, |
363 isConst: node.isConst); | 363 isConst: node.isConst, |
| 364 isFieldFormal: node.isFieldFormal); |
364 } | 365 } |
365 | 366 |
366 visitFunctionDeclaration(FunctionDeclaration node) { | 367 visitFunctionDeclaration(FunctionDeclaration node) { |
367 var newVariable = clone(node.variable); | 368 var newVariable = clone(node.variable); |
368 return new FunctionDeclaration(newVariable, clone(node.function)); | 369 return new FunctionDeclaration(newVariable, clone(node.function)); |
369 } | 370 } |
370 | 371 |
371 // Members | 372 // Members |
372 visitConstructor(Constructor node) { | 373 visitConstructor(Constructor node) { |
373 return new Constructor(clone(node.function), | 374 return new Constructor(clone(node.function), |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 visitArguments(Arguments node) { | 432 visitArguments(Arguments node) { |
432 return new Arguments(node.positional.map(clone).toList(), | 433 return new Arguments(node.positional.map(clone).toList(), |
433 types: node.types.map(visitType).toList(), | 434 types: node.types.map(visitType).toList(), |
434 named: node.named.map(clone).toList()); | 435 named: node.named.map(clone).toList()); |
435 } | 436 } |
436 | 437 |
437 visitNamedExpression(NamedExpression node) { | 438 visitNamedExpression(NamedExpression node) { |
438 return new NamedExpression(node.name, clone(node.value)); | 439 return new NamedExpression(node.name, clone(node.value)); |
439 } | 440 } |
440 } | 441 } |
OLD | NEW |