| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 return new DirectMethodInvocation( | 112 return new DirectMethodInvocation( |
| 113 clone(node.receiver), node.target, clone(node.arguments)); | 113 clone(node.receiver), node.target, clone(node.arguments)); |
| 114 } | 114 } |
| 115 | 115 |
| 116 visitSuperMethodInvocation(SuperMethodInvocation node) { | 116 visitSuperMethodInvocation(SuperMethodInvocation node) { |
| 117 return new SuperMethodInvocation( | 117 return new SuperMethodInvocation( |
| 118 node.name, clone(node.arguments), node.interfaceTarget); | 118 node.name, clone(node.arguments), node.interfaceTarget); |
| 119 } | 119 } |
| 120 | 120 |
| 121 visitStaticInvocation(StaticInvocation node) { | 121 visitStaticInvocation(StaticInvocation node) { |
| 122 return new StaticInvocation(node.target, clone(node.arguments)); | 122 return new StaticInvocation(node.target, clone(node.arguments), |
| 123 isConst: node.isConst); |
| 123 } | 124 } |
| 124 | 125 |
| 125 visitConstructorInvocation(ConstructorInvocation node) { | 126 visitConstructorInvocation(ConstructorInvocation node) { |
| 126 return new ConstructorInvocation(node.target, clone(node.arguments)); | 127 return new ConstructorInvocation(node.target, clone(node.arguments), |
| 128 isConst: node.isConst); |
| 127 } | 129 } |
| 128 | 130 |
| 129 visitNot(Not node) { | 131 visitNot(Not node) { |
| 130 return new Not(clone(node.operand)); | 132 return new Not(clone(node.operand)); |
| 131 } | 133 } |
| 132 | 134 |
| 133 visitLogicalExpression(LogicalExpression node) { | 135 visitLogicalExpression(LogicalExpression node) { |
| 134 return new LogicalExpression( | 136 return new LogicalExpression( |
| 135 clone(node.left), node.operator, clone(node.right)); | 137 clone(node.left), node.operator, clone(node.right)); |
| 136 } | 138 } |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 visitArguments(Arguments node) { | 394 visitArguments(Arguments node) { |
| 393 return new Arguments(node.positional.map(clone).toList(), | 395 return new Arguments(node.positional.map(clone).toList(), |
| 394 types: node.types.map(visitType).toList(), | 396 types: node.types.map(visitType).toList(), |
| 395 named: node.named.map(clone).toList()); | 397 named: node.named.map(clone).toList()); |
| 396 } | 398 } |
| 397 | 399 |
| 398 visitNamedExpression(NamedExpression node) { | 400 visitNamedExpression(NamedExpression node) { |
| 399 return new NamedExpression(node.name, clone(node.value)); | 401 return new NamedExpression(node.name, clone(node.value)); |
| 400 } | 402 } |
| 401 } | 403 } |
| OLD | NEW |