| 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 | 354 |
| 355 visitYieldStatement(YieldStatement node) { | 355 visitYieldStatement(YieldStatement node) { |
| 356 return new YieldStatement(clone(node.expression)); | 356 return new YieldStatement(clone(node.expression)); |
| 357 } | 357 } |
| 358 | 358 |
| 359 visitVariableDeclaration(VariableDeclaration node) { | 359 visitVariableDeclaration(VariableDeclaration node) { |
| 360 return variables[node] = new VariableDeclaration(node.name, | 360 return variables[node] = new VariableDeclaration(node.name, |
| 361 initializer: cloneOptional(node.initializer), | 361 initializer: cloneOptional(node.initializer), |
| 362 type: visitType(node.type), | 362 type: visitType(node.type), |
| 363 isCovariant: node.isCovariant, |
| 363 isFinal: node.isFinal, | 364 isFinal: node.isFinal, |
| 364 isConst: node.isConst, | 365 isConst: node.isConst, |
| 365 isFieldFormal: node.isFieldFormal); | 366 isFieldFormal: node.isFieldFormal); |
| 366 } | 367 } |
| 367 | 368 |
| 368 visitFunctionDeclaration(FunctionDeclaration node) { | 369 visitFunctionDeclaration(FunctionDeclaration node) { |
| 369 var newVariable = clone(node.variable); | 370 var newVariable = clone(node.variable); |
| 370 return new FunctionDeclaration(newVariable, clone(node.function)); | 371 return new FunctionDeclaration(newVariable, clone(node.function)); |
| 371 } | 372 } |
| 372 | 373 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 389 isConst: node.isConst, | 390 isConst: node.isConst, |
| 390 transformerFlags: node.transformerFlags, | 391 transformerFlags: node.transformerFlags, |
| 391 fileUri: node.fileUri) | 392 fileUri: node.fileUri) |
| 392 ..fileEndOffset = node.fileEndOffset; | 393 ..fileEndOffset = node.fileEndOffset; |
| 393 } | 394 } |
| 394 | 395 |
| 395 visitField(Field node) { | 396 visitField(Field node) { |
| 396 return new Field(node.name, | 397 return new Field(node.name, |
| 397 type: visitType(node.type), | 398 type: visitType(node.type), |
| 398 initializer: cloneOptional(node.initializer), | 399 initializer: cloneOptional(node.initializer), |
| 400 isCovariant: node.isCovariant, |
| 399 isFinal: node.isFinal, | 401 isFinal: node.isFinal, |
| 400 isConst: node.isConst, | 402 isConst: node.isConst, |
| 401 isStatic: node.isStatic, | 403 isStatic: node.isStatic, |
| 402 hasImplicitGetter: node.hasImplicitGetter, | 404 hasImplicitGetter: node.hasImplicitGetter, |
| 403 hasImplicitSetter: node.hasImplicitSetter, | 405 hasImplicitSetter: node.hasImplicitSetter, |
| 404 transformerFlags: node.transformerFlags, | 406 transformerFlags: node.transformerFlags, |
| 405 fileUri: node.fileUri) | 407 fileUri: node.fileUri) |
| 406 ..fileEndOffset = node.fileEndOffset; | 408 ..fileEndOffset = node.fileEndOffset; |
| 407 } | 409 } |
| 408 | 410 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 433 visitArguments(Arguments node) { | 435 visitArguments(Arguments node) { |
| 434 return new Arguments(node.positional.map(clone).toList(), | 436 return new Arguments(node.positional.map(clone).toList(), |
| 435 types: node.types.map(visitType).toList(), | 437 types: node.types.map(visitType).toList(), |
| 436 named: node.named.map(clone).toList()); | 438 named: node.named.map(clone).toList()); |
| 437 } | 439 } |
| 438 | 440 |
| 439 visitNamedExpression(NamedExpression node) { | 441 visitNamedExpression(NamedExpression node) { |
| 440 return new NamedExpression(node.name, clone(node.value)); | 442 return new NamedExpression(node.name, clone(node.value)); |
| 441 } | 443 } |
| 442 } | 444 } |
| OLD | NEW |