| 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 library dart2js.world; | 5 library dart2js.world; |
| 6 | 6 |
| 7 import 'closure.dart' show ClosureClassElement, SynthesizedCallMethodElementX; | 7 import 'closure.dart' show ClosureClassElement, SynthesizedCallMethodElementX; |
| 8 import 'common.dart'; | 8 import 'common.dart'; |
| 9 import 'constants/constant_system.dart'; | 9 import 'constants/constant_system.dart'; |
| 10 import 'common_elements.dart' show CommonElements; | 10 import 'common_elements.dart' show CommonElements; |
| (...skipping 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1222 // Use the [:implementation] of [cls] in case the found [element] | 1222 // Use the [:implementation] of [cls] in case the found [element] |
| 1223 // is in the patch class. | 1223 // is in the patch class. |
| 1224 return cls.implementation | 1224 return cls.implementation |
| 1225 .lookupByName(selector.memberName, stopAt: stopAtSuperclass); | 1225 .lookupByName(selector.memberName, stopAt: stopAtSuperclass); |
| 1226 } | 1226 } |
| 1227 | 1227 |
| 1228 /// Returns whether a [selector] call on an instance of [cls] | 1228 /// Returns whether a [selector] call on an instance of [cls] |
| 1229 /// will hit a method at runtime, and not go through [noSuchMethod]. | 1229 /// will hit a method at runtime, and not go through [noSuchMethod]. |
| 1230 bool hasConcreteMatch(ClassElement cls, Selector selector, | 1230 bool hasConcreteMatch(ClassElement cls, Selector selector, |
| 1231 {ClassElement stopAtSuperclass}) { | 1231 {ClassElement stopAtSuperclass}) { |
| 1232 assert(invariant(cls, isInstantiated(cls), | 1232 assert( |
| 1233 message: '$cls has not been instantiated.')); | 1233 isInstantiated(cls), failedAt(cls, '$cls has not been instantiated.')); |
| 1234 MemberElement element = findMatchIn(cls, selector); | 1234 MemberElement element = findMatchIn(cls, selector); |
| 1235 if (element == null) return false; | 1235 if (element == null) return false; |
| 1236 | 1236 |
| 1237 if (element.isAbstract) { | 1237 if (element.isAbstract) { |
| 1238 ClassElement enclosingClass = element.enclosingClass; | 1238 ClassElement enclosingClass = element.enclosingClass; |
| 1239 return hasConcreteMatch(enclosingClass.superclass, selector); | 1239 return hasConcreteMatch(enclosingClass.superclass, selector); |
| 1240 } | 1240 } |
| 1241 return selector.appliesUntyped(element); | 1241 return selector.appliesUntyped(element); |
| 1242 } | 1242 } |
| 1243 | 1243 |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1358 @override | 1358 @override |
| 1359 void registerClosureClass(ClassElement cls) { | 1359 void registerClosureClass(ClassElement cls) { |
| 1360 throw new UnimplementedError('KernelClosedWorld.registerClosureClass'); | 1360 throw new UnimplementedError('KernelClosedWorld.registerClosureClass'); |
| 1361 } | 1361 } |
| 1362 | 1362 |
| 1363 @override | 1363 @override |
| 1364 bool hasElementIn(ClassEntity cls, Selector selector, Entity element) { | 1364 bool hasElementIn(ClassEntity cls, Selector selector, Entity element) { |
| 1365 throw new UnimplementedError('KernelClosedWorld.hasElementIn'); | 1365 throw new UnimplementedError('KernelClosedWorld.hasElementIn'); |
| 1366 } | 1366 } |
| 1367 } | 1367 } |
| OLD | NEW |