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

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

Issue 2665723002: Implement canonical name scheme in kernel. (Closed)
Patch Set: Address Kevin's 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
« no previous file with comments | « pkg/kernel/lib/canonical_name.dart ('k') | pkg/kernel/lib/frontend/accessors.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.byReference(
72 clone(node.receiver), node.name, node.interfaceTarget); 72 clone(node.receiver), node.name, node.interfaceTargetReference);
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.byReference(clone(node.receiver), node.name,
77 node.interfaceTarget); 77 clone(node.value), node.interfaceTargetReference);
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.byReference(
82 clone(node.receiver), node.targetReference);
82 } 83 }
83 84
84 visitDirectPropertySet(DirectPropertySet node) { 85 visitDirectPropertySet(DirectPropertySet node) {
85 return new DirectPropertySet( 86 return new DirectPropertySet.byReference(
86 clone(node.receiver), node.target, clone(node.value)); 87 clone(node.receiver), node.targetReference, clone(node.value));
87 } 88 }
88 89
89 visitSuperPropertyGet(SuperPropertyGet node) { 90 visitSuperPropertyGet(SuperPropertyGet node) {
90 return new SuperPropertyGet(node.name, node.interfaceTarget); 91 return new SuperPropertyGet.byReference(
92 node.name, node.interfaceTargetReference);
91 } 93 }
92 94
93 visitSuperPropertySet(SuperPropertySet node) { 95 visitSuperPropertySet(SuperPropertySet node) {
94 return new SuperPropertySet( 96 return new SuperPropertySet.byReference(
95 node.name, clone(node.value), node.interfaceTarget); 97 node.name, clone(node.value), node.interfaceTargetReference);
96 } 98 }
97 99
98 visitStaticGet(StaticGet node) { 100 visitStaticGet(StaticGet node) {
99 return new StaticGet(node.target); 101 return new StaticGet.byReference(node.targetReference);
100 } 102 }
101 103
102 visitStaticSet(StaticSet node) { 104 visitStaticSet(StaticSet node) {
103 return new StaticSet(node.target, clone(node.value)); 105 return new StaticSet.byReference(node.targetReference, clone(node.value));
104 } 106 }
105 107
106 visitMethodInvocation(MethodInvocation node) { 108 visitMethodInvocation(MethodInvocation node) {
107 return new MethodInvocation(clone(node.receiver), node.name, 109 return new MethodInvocation.byReference(clone(node.receiver), node.name,
108 clone(node.arguments), node.interfaceTarget); 110 clone(node.arguments), node.interfaceTargetReference);
109 } 111 }
110 112
111 visitDirectMethodInvocation(DirectMethodInvocation node) { 113 visitDirectMethodInvocation(DirectMethodInvocation node) {
112 return new DirectMethodInvocation( 114 return new DirectMethodInvocation.byReference(
113 clone(node.receiver), node.target, clone(node.arguments)); 115 clone(node.receiver), node.targetReference, clone(node.arguments));
114 } 116 }
115 117
116 visitSuperMethodInvocation(SuperMethodInvocation node) { 118 visitSuperMethodInvocation(SuperMethodInvocation node) {
117 return new SuperMethodInvocation( 119 return new SuperMethodInvocation.byReference(
118 node.name, clone(node.arguments), node.interfaceTarget); 120 node.name, clone(node.arguments), node.interfaceTargetReference);
119 } 121 }
120 122
121 visitStaticInvocation(StaticInvocation node) { 123 visitStaticInvocation(StaticInvocation node) {
122 return new StaticInvocation(node.target, clone(node.arguments), 124 return new StaticInvocation.byReference(
125 node.targetReference, clone(node.arguments),
123 isConst: node.isConst); 126 isConst: node.isConst);
124 } 127 }
125 128
126 visitConstructorInvocation(ConstructorInvocation node) { 129 visitConstructorInvocation(ConstructorInvocation node) {
127 return new ConstructorInvocation(node.target, clone(node.arguments), 130 return new ConstructorInvocation.byReference(
131 node.targetReference, clone(node.arguments),
128 isConst: node.isConst); 132 isConst: node.isConst);
129 } 133 }
130 134
131 visitNot(Not node) { 135 visitNot(Not node) {
132 return new Not(clone(node.operand)); 136 return new Not(clone(node.operand));
133 } 137 }
134 138
135 visitLogicalExpression(LogicalExpression node) { 139 visitLogicalExpression(LogicalExpression node) {
136 return new LogicalExpression( 140 return new LogicalExpression(
137 clone(node.left), node.operator, clone(node.right)); 141 clone(node.left), node.operator, clone(node.right));
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 visitArguments(Arguments node) { 399 visitArguments(Arguments node) {
396 return new Arguments(node.positional.map(clone).toList(), 400 return new Arguments(node.positional.map(clone).toList(),
397 types: node.types.map(visitType).toList(), 401 types: node.types.map(visitType).toList(),
398 named: node.named.map(clone).toList()); 402 named: node.named.map(clone).toList());
399 } 403 }
400 404
401 visitNamedExpression(NamedExpression node) { 405 visitNamedExpression(NamedExpression node) {
402 return new NamedExpression(node.name, clone(node.value)); 406 return new NamedExpression(node.name, clone(node.value));
403 } 407 }
404 } 408 }
OLDNEW
« no previous file with comments | « pkg/kernel/lib/canonical_name.dart ('k') | pkg/kernel/lib/frontend/accessors.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698