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.transformations.mixin_full_resolution; | 4 library kernel.transformations.mixin_full_resolution; |
5 | 5 |
6 import '../ast.dart'; | 6 import '../ast.dart'; |
7 import '../class_hierarchy.dart'; | 7 import '../class_hierarchy.dart'; |
8 import '../clone.dart'; | 8 import '../clone.dart'; |
9 import '../core_types.dart'; | 9 import '../core_types.dart'; |
10 import '../type_algebra.dart'; | 10 import '../type_algebra.dart'; |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 Procedure _listFrom; // cached | 180 Procedure _listFrom; // cached |
181 | 181 |
182 SuperCallResolutionTransformer( | 182 SuperCallResolutionTransformer( |
183 this.hierarchy, this.coreTypes, this.lookupClass); | 183 this.hierarchy, this.coreTypes, this.lookupClass); |
184 | 184 |
185 TreeNode visit(TreeNode node) => node.accept(this); | 185 TreeNode visit(TreeNode node) => node.accept(this); |
186 | 186 |
187 visitSuperPropertyGet(SuperPropertyGet node) { | 187 visitSuperPropertyGet(SuperPropertyGet node) { |
188 Member target = hierarchy.getDispatchTarget(lookupClass, node.name); | 188 Member target = hierarchy.getDispatchTarget(lookupClass, node.name); |
189 if (target != null) { | 189 if (target != null) { |
190 return new DirectPropertyGet(new ThisExpression(), target) | 190 return new DirectPropertyGet(new ThisExpression(), target); |
191 ..fileOffset = node.fileOffset; | |
192 } else { | 191 } else { |
193 return _callNoSuchMethod(node.name.name, new Arguments.empty(), node, | 192 return _callNoSuchMethod(node.name.name, new Arguments.empty(), node, |
194 isGetter: true, isSuper: true); | 193 isGetter: true, isSuper: true); |
195 } | 194 } |
196 } | 195 } |
197 | 196 |
198 visitSuperPropertySet(SuperPropertySet node) { | 197 visitSuperPropertySet(SuperPropertySet node) { |
199 Member target = | 198 Member target = |
200 hierarchy.getDispatchTarget(lookupClass, node.name, setter: true); | 199 hierarchy.getDispatchTarget(lookupClass, node.name, setter: true); |
201 if (target != null) { | 200 if (target != null) { |
202 return new DirectPropertySet( | 201 return new DirectPropertySet( |
203 new ThisExpression(), target, visit(node.value)) | 202 new ThisExpression(), target, visit(node.value)); |
204 ..fileOffset = node.fileOffset; | |
205 } else { | 203 } else { |
206 // Call has to return right-hand-side. | 204 // Call has to return right-hand-side. |
207 VariableDeclaration rightHandSide = | 205 VariableDeclaration rightHandSide = |
208 new VariableDeclaration.forValue(visit(node.value)); | 206 new VariableDeclaration.forValue(visit(node.value)); |
209 Expression result = _callNoSuchMethod( | 207 Expression result = _callNoSuchMethod( |
210 node.name.name, new Arguments([new VariableGet(rightHandSide)]), node, | 208 node.name.name, new Arguments([new VariableGet(rightHandSide)]), node, |
211 isSetter: true, isSuper: true); | 209 isSetter: true, isSuper: true); |
212 VariableDeclaration call = new VariableDeclaration.forValue(result); | 210 VariableDeclaration call = new VariableDeclaration.forValue(result); |
213 return new Let( | 211 return new Let( |
214 rightHandSide, new Let(call, new VariableGet(rightHandSide))); | 212 rightHandSide, new Let(call, new VariableGet(rightHandSide))); |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 return null; | 368 return null; |
371 } | 369 } |
372 } | 370 } |
373 | 371 |
374 throw new Exception( | 372 throw new Exception( |
375 'Could not find a generative constructor named "${constructor.name}" ' | 373 'Could not find a generative constructor named "${constructor.name}" ' |
376 'in lookup class "${lookupClass.name}"!'); | 374 'in lookup class "${lookupClass.name}"!'); |
377 } | 375 } |
378 } | 376 } |
379 } | 377 } |
OLD | NEW |