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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 | 262 |
263 visitBlock(Block node) { | 263 visitBlock(Block node) { |
264 return new Block(node.statements.map(clone).toList()); | 264 return new Block(node.statements.map(clone).toList()); |
265 } | 265 } |
266 | 266 |
267 visitEmptyStatement(EmptyStatement node) { | 267 visitEmptyStatement(EmptyStatement node) { |
268 return new EmptyStatement(); | 268 return new EmptyStatement(); |
269 } | 269 } |
270 | 270 |
271 visitAssertStatement(AssertStatement node) { | 271 visitAssertStatement(AssertStatement node) { |
272 return new AssertStatement( | 272 return new AssertStatement(clone(node.condition), |
273 clone(node.condition), cloneOptional(node.message)); | 273 conditionStartOffset: node.conditionStartOffset, |
| 274 conditionEndOffset: node.conditionEndOffset, |
| 275 message: cloneOptional(node.message)); |
274 } | 276 } |
275 | 277 |
276 visitLabeledStatement(LabeledStatement node) { | 278 visitLabeledStatement(LabeledStatement node) { |
277 LabeledStatement newNode = new LabeledStatement(null); | 279 LabeledStatement newNode = new LabeledStatement(null); |
278 labels[node] = newNode; | 280 labels[node] = newNode; |
279 newNode.body = clone(node.body)..parent = newNode; | 281 newNode.body = clone(node.body)..parent = newNode; |
280 return newNode; | 282 return newNode; |
281 } | 283 } |
282 | 284 |
283 visitBreakStatement(BreakStatement node) { | 285 visitBreakStatement(BreakStatement node) { |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 visitArguments(Arguments node) { | 431 visitArguments(Arguments node) { |
430 return new Arguments(node.positional.map(clone).toList(), | 432 return new Arguments(node.positional.map(clone).toList(), |
431 types: node.types.map(visitType).toList(), | 433 types: node.types.map(visitType).toList(), |
432 named: node.named.map(clone).toList()); | 434 named: node.named.map(clone).toList()); |
433 } | 435 } |
434 | 436 |
435 visitNamedExpression(NamedExpression node) { | 437 visitNamedExpression(NamedExpression node) { |
436 return new NamedExpression(node.name, clone(node.value)); | 438 return new NamedExpression(node.name, clone(node.value)); |
437 } | 439 } |
438 } | 440 } |
OLD | NEW |