| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 | 4 |
| 5 class CloningVisitor implements Visitor<Node> { | 5 class CloningVisitor implements Visitor<Node> { |
| 6 final TreeElements originalTreeElements; | 6 final TreeElements originalTreeElements; |
| 7 final TreeElements cloneTreeElements; | 7 final TreeElementMapping cloneTreeElements; |
| 8 | 8 |
| 9 CloningVisitor(this.originalTreeElements) | 9 CloningVisitor(this.originalTreeElements) |
| 10 : cloneTreeElements = new TreeElementMapping(); | 10 : cloneTreeElements = new TreeElementMapping(); |
| 11 | 11 |
| 12 visit(Node node) { | 12 visit(Node node) { |
| 13 if (node === null) return null; | 13 if (node === null) return null; |
| 14 final clone = node.accept(this); | 14 final clone = node.accept(this); |
| 15 final originalElement = originalTreeElements[node]; | 15 final originalElement = originalTreeElements[node]; |
| 16 if (originalElement !== null) { | 16 if (originalElement !== null) { |
| 17 cloneTreeElements[clone] = originalElement; | 17 cloneTreeElements[clone] = originalElement; |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 visitTypeVariable(TypeVariable node) => new TypeVariable( | 201 visitTypeVariable(TypeVariable node) => new TypeVariable( |
| 202 visit(node.name), visit(node.bound)); | 202 visit(node.name), visit(node.bound)); |
| 203 | 203 |
| 204 visitVariableDefinitions(VariableDefinitions node) => new VariableDefinitions( | 204 visitVariableDefinitions(VariableDefinitions node) => new VariableDefinitions( |
| 205 visit(node.type), visit(node.modifiers), visit(node.definitions), | 205 visit(node.type), visit(node.modifiers), visit(node.definitions), |
| 206 node.endToken); | 206 node.endToken); |
| 207 | 207 |
| 208 visitWhile(While node) => new While( | 208 visitWhile(While node) => new While( |
| 209 visit(node.condition), visit(node.body), node.whileKeyword); | 209 visit(node.condition), visit(node.body), node.whileKeyword); |
| 210 } | 210 } |
| OLD | NEW |