| 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; |
| 191 } else { | 192 } else { |
| 192 return _callNoSuchMethod(node.name.name, new Arguments.empty(), node, | 193 return _callNoSuchMethod(node.name.name, new Arguments.empty(), node, |
| 193 isGetter: true, isSuper: true); | 194 isGetter: true, isSuper: true); |
| 194 } | 195 } |
| 195 } | 196 } |
| 196 | 197 |
| 197 visitSuperPropertySet(SuperPropertySet node) { | 198 visitSuperPropertySet(SuperPropertySet node) { |
| 198 Member target = | 199 Member target = |
| 199 hierarchy.getDispatchTarget(lookupClass, node.name, setter: true); | 200 hierarchy.getDispatchTarget(lookupClass, node.name, setter: true); |
| 200 if (target != null) { | 201 if (target != null) { |
| 201 return new DirectPropertySet( | 202 return new DirectPropertySet( |
| 202 new ThisExpression(), target, visit(node.value)); | 203 new ThisExpression(), target, visit(node.value)) |
| 204 ..fileOffset = node.fileOffset; |
| 203 } else { | 205 } else { |
| 204 // Call has to return right-hand-side. | 206 // Call has to return right-hand-side. |
| 205 VariableDeclaration rightHandSide = | 207 VariableDeclaration rightHandSide = |
| 206 new VariableDeclaration.forValue(visit(node.value)); | 208 new VariableDeclaration.forValue(visit(node.value)); |
| 207 Expression result = _callNoSuchMethod( | 209 Expression result = _callNoSuchMethod( |
| 208 node.name.name, new Arguments([new VariableGet(rightHandSide)]), node, | 210 node.name.name, new Arguments([new VariableGet(rightHandSide)]), node, |
| 209 isSetter: true, isSuper: true); | 211 isSetter: true, isSuper: true); |
| 210 VariableDeclaration call = new VariableDeclaration.forValue(result); | 212 VariableDeclaration call = new VariableDeclaration.forValue(result); |
| 211 return new Let( | 213 return new Let( |
| 212 rightHandSide, new Let(call, new VariableGet(rightHandSide))); | 214 rightHandSide, new Let(call, new VariableGet(rightHandSide))); |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 return null; | 370 return null; |
| 369 } | 371 } |
| 370 } | 372 } |
| 371 | 373 |
| 372 throw new Exception( | 374 throw new Exception( |
| 373 'Could not find a generative constructor named "${constructor.name}" ' | 375 'Could not find a generative constructor named "${constructor.name}" ' |
| 374 'in lookup class "${lookupClass.name}"!'); | 376 'in lookup class "${lookupClass.name}"!'); |
| 375 } | 377 } |
| 376 } | 378 } |
| 377 } | 379 } |
| OLD | NEW |