Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(486)

Side by Side Diff: pkg/kernel/lib/clone.dart

Issue 2665723002: Implement canonical name scheme in kernel. (Closed)
Patch Set: Address comments Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 visitVariableGet(VariableGet node) { 61 visitVariableGet(VariableGet node) {
62 return new VariableGet( 62 return new VariableGet(
63 variables[node.variable], visitOptionalType(node.promotedType)); 63 variables[node.variable], visitOptionalType(node.promotedType));
64 } 64 }
65 65
66 visitVariableSet(VariableSet node) { 66 visitVariableSet(VariableSet node) {
67 return new VariableSet(variables[node.variable], clone(node.value)); 67 return new VariableSet(variables[node.variable], clone(node.value));
68 } 68 }
69 69
70 visitPropertyGet(PropertyGet node) { 70 visitPropertyGet(PropertyGet node) {
71 return new PropertyGet( 71 return new PropertyGet.byName(
72 clone(node.receiver), node.name, node.interfaceTarget); 72 clone(node.receiver), node.name, node.interfaceTargetName);
73 } 73 }
74 74
75 visitPropertySet(PropertySet node) { 75 visitPropertySet(PropertySet node) {
76 return new PropertySet(clone(node.receiver), node.name, clone(node.value), 76 return new PropertySet.byName(clone(node.receiver), node.name,
77 node.interfaceTarget); 77 clone(node.value), node.interfaceTargetName);
78 } 78 }
79 79
80 visitDirectPropertyGet(DirectPropertyGet node) { 80 visitDirectPropertyGet(DirectPropertyGet node) {
81 return new DirectPropertyGet(clone(node.receiver), node.target); 81 return new DirectPropertyGet.byName(clone(node.receiver), node.targetName);
82 } 82 }
83 83
84 visitDirectPropertySet(DirectPropertySet node) { 84 visitDirectPropertySet(DirectPropertySet node) {
85 return new DirectPropertySet( 85 return new DirectPropertySet.byName(
86 clone(node.receiver), node.target, clone(node.value)); 86 clone(node.receiver), node.targetName, clone(node.value));
87 } 87 }
88 88
89 visitSuperPropertyGet(SuperPropertyGet node) { 89 visitSuperPropertyGet(SuperPropertyGet node) {
90 return new SuperPropertyGet(node.name, node.interfaceTarget); 90 return new SuperPropertyGet.byName(node.name, node.interfaceTargetName);
91 } 91 }
92 92
93 visitSuperPropertySet(SuperPropertySet node) { 93 visitSuperPropertySet(SuperPropertySet node) {
94 return new SuperPropertySet( 94 return new SuperPropertySet.byName(
95 node.name, clone(node.value), node.interfaceTarget); 95 node.name, clone(node.value), node.interfaceTargetName);
96 } 96 }
97 97
98 visitStaticGet(StaticGet node) { 98 visitStaticGet(StaticGet node) {
99 return new StaticGet(node.target); 99 return new StaticGet.byName(node.targetName);
100 } 100 }
101 101
102 visitStaticSet(StaticSet node) { 102 visitStaticSet(StaticSet node) {
103 return new StaticSet(node.target, clone(node.value)); 103 return new StaticSet.byName(node.targetName, clone(node.value));
104 } 104 }
105 105
106 visitMethodInvocation(MethodInvocation node) { 106 visitMethodInvocation(MethodInvocation node) {
107 return new MethodInvocation(clone(node.receiver), node.name, 107 return new MethodInvocation.byName(clone(node.receiver), node.name,
108 clone(node.arguments), node.interfaceTarget); 108 clone(node.arguments), node.interfaceTargetName);
109 } 109 }
110 110
111 visitDirectMethodInvocation(DirectMethodInvocation node) { 111 visitDirectMethodInvocation(DirectMethodInvocation node) {
112 return new DirectMethodInvocation( 112 return new DirectMethodInvocation.byName(
113 clone(node.receiver), node.target, clone(node.arguments)); 113 clone(node.receiver), node.targetName, clone(node.arguments));
114 } 114 }
115 115
116 visitSuperMethodInvocation(SuperMethodInvocation node) { 116 visitSuperMethodInvocation(SuperMethodInvocation node) {
117 return new SuperMethodInvocation( 117 return new SuperMethodInvocation.byName(
118 node.name, clone(node.arguments), node.interfaceTarget); 118 node.name, clone(node.arguments), node.interfaceTargetName);
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.byName(node.targetName, clone(node.arguments));
123 } 123 }
124 124
125 visitConstructorInvocation(ConstructorInvocation node) { 125 visitConstructorInvocation(ConstructorInvocation node) {
126 return new ConstructorInvocation(node.target, clone(node.arguments)); 126 return new ConstructorInvocation.byName(
127 node.targetName, clone(node.arguments));
127 } 128 }
128 129
129 visitNot(Not node) { 130 visitNot(Not node) {
130 return new Not(clone(node.operand)); 131 return new Not(clone(node.operand));
131 } 132 }
132 133
133 visitLogicalExpression(LogicalExpression node) { 134 visitLogicalExpression(LogicalExpression node) {
134 return new LogicalExpression( 135 return new LogicalExpression(
135 clone(node.left), node.operator, clone(node.right)); 136 clone(node.left), node.operator, clone(node.right));
136 } 137 }
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 visitArguments(Arguments node) { 394 visitArguments(Arguments node) {
394 return new Arguments(node.positional.map(clone).toList(), 395 return new Arguments(node.positional.map(clone).toList(),
395 types: node.types.map(visitType).toList(), 396 types: node.types.map(visitType).toList(),
396 named: node.named.map(clone).toList()); 397 named: node.named.map(clone).toList());
397 } 398 }
398 399
399 visitNamedExpression(NamedExpression node) { 400 visitNamedExpression(NamedExpression node) {
400 return new NamedExpression(node.name, clone(node.value)); 401 return new NamedExpression(node.name, clone(node.value));
401 } 402 }
402 } 403 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698