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 ..fileEndOffset = node.fileEndOffset; | 353 ..fileEndOffset = node.fileEndOffset; |
354 } | 354 } |
355 | 355 |
356 visitProcedure(Procedure node) { | 356 visitProcedure(Procedure node) { |
357 return new Procedure(node.name, node.kind, clone(node.function), | 357 return new Procedure(node.name, node.kind, clone(node.function), |
358 isAbstract: node.isAbstract, | 358 isAbstract: node.isAbstract, |
359 isStatic: node.isStatic, | 359 isStatic: node.isStatic, |
360 isExternal: node.isExternal, | 360 isExternal: node.isExternal, |
361 isConst: node.isConst, | 361 isConst: node.isConst, |
362 transformerFlags: node.transformerFlags, | 362 transformerFlags: node.transformerFlags, |
363 fileUri: node.fileUri)..fileEndOffset = node.fileEndOffset; | 363 fileUri: node.fileUri) |
| 364 ..fileEndOffset = node.fileEndOffset; |
364 } | 365 } |
365 | 366 |
366 visitField(Field node) { | 367 visitField(Field node) { |
367 return new Field(node.name, | 368 return new Field(node.name, |
368 type: visitType(node.type), | 369 type: visitType(node.type), |
369 initializer: cloneOptional(node.initializer), | 370 initializer: cloneOptional(node.initializer), |
370 isFinal: node.isFinal, | 371 isFinal: node.isFinal, |
371 isConst: node.isConst, | 372 isConst: node.isConst, |
372 isStatic: node.isStatic, | 373 isStatic: node.isStatic, |
373 hasImplicitGetter: node.hasImplicitGetter, | 374 hasImplicitGetter: node.hasImplicitGetter, |
374 hasImplicitSetter: node.hasImplicitSetter, | 375 hasImplicitSetter: node.hasImplicitSetter, |
375 transformerFlags: node.transformerFlags, | 376 transformerFlags: node.transformerFlags, |
376 fileUri: node.fileUri)..fileEndOffset = node.fileEndOffset; | 377 fileUri: node.fileUri) |
| 378 ..fileEndOffset = node.fileEndOffset; |
377 } | 379 } |
378 | 380 |
379 visitTypeParameter(TypeParameter node) { | 381 visitTypeParameter(TypeParameter node) { |
380 var newNode = new TypeParameter(node.name); | 382 var newNode = new TypeParameter(node.name); |
381 typeSubstitution[node] = new TypeParameterType(newNode); | 383 typeSubstitution[node] = new TypeParameterType(newNode); |
382 newNode.bound = visitType(node.bound); | 384 newNode.bound = visitType(node.bound); |
383 return newNode; | 385 return newNode; |
384 } | 386 } |
385 | 387 |
386 TreeNode cloneFunctionNodeBody(FunctionNode node) => cloneOptional(node.body); | 388 TreeNode cloneFunctionNodeBody(FunctionNode node) => cloneOptional(node.body); |
(...skipping 16 matching lines...) Expand all Loading... |
403 visitArguments(Arguments node) { | 405 visitArguments(Arguments node) { |
404 return new Arguments(node.positional.map(clone).toList(), | 406 return new Arguments(node.positional.map(clone).toList(), |
405 types: node.types.map(visitType).toList(), | 407 types: node.types.map(visitType).toList(), |
406 named: node.named.map(clone).toList()); | 408 named: node.named.map(clone).toList()); |
407 } | 409 } |
408 | 410 |
409 visitNamedExpression(NamedExpression node) { | 411 visitNamedExpression(NamedExpression node) { |
410 return new NamedExpression(node.name, clone(node.value)); | 412 return new NamedExpression(node.name, clone(node.value)); |
411 } | 413 } |
412 } | 414 } |
OLD | NEW |