OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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.js_emitter.runtime_type_generator; | 5 library dart2js.js_emitter.runtime_type_generator; |
6 | 6 |
7 import '../closure.dart' | 7 import '../closure.dart' |
8 show ClosureRepresentationInfo, ClosureFieldElement, ClosureConversionTask; | 8 show ClosureRepresentationInfo, ClosureFieldElement, ClosureConversionTask; |
9 import '../common.dart'; | 9 import '../common.dart'; |
10 import '../common/names.dart' show Identifiers; | 10 import '../common/names.dart' show Identifiers; |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 if (checkedClasses.contains(_commonElements.functionClass) || | 291 if (checkedClasses.contains(_commonElements.functionClass) || |
292 checkedFunctionTypes.isNotEmpty) { | 292 checkedFunctionTypes.isNotEmpty) { |
293 Element call = cls.lookupLocalMember(Identifiers.call); | 293 Element call = cls.lookupLocalMember(Identifiers.call); |
294 if (call == null) { | 294 if (call == null) { |
295 // If [cls] is a closure, it has a synthetic call operator method. | 295 // If [cls] is a closure, it has a synthetic call operator method. |
296 call = cls.lookupConstructorBody(Identifiers.call); | 296 call = cls.lookupConstructorBody(Identifiers.call); |
297 } | 297 } |
298 if (call != null && call.isFunction) { | 298 if (call != null && call.isFunction) { |
299 FunctionElement callFunction = call; | 299 FunctionElement callFunction = call; |
300 // A superclass might already implement the Function interface. In such | 300 // A superclass might already implement the Function interface. In such |
301 // a case, we can avoid emiting the is test here. | 301 // a case, we can avoid emitting the is test here. |
302 if (!cls.superclass.implementsFunction(_commonElements)) { | 302 if (!cls.superclass.implementsFunction(_commonElements)) { |
303 _generateInterfacesIsTests(_commonElements.functionClass, | 303 _generateInterfacesIsTests(_commonElements.functionClass, |
304 generateIsTest, generateSubstitution, generated); | 304 generateIsTest, generateSubstitution, generated); |
305 } | 305 } |
306 ResolutionFunctionType callType = callFunction.type; | 306 ResolutionFunctionType callType = callFunction.type; |
307 generateFunctionTypeSignature(callFunction, callType); | 307 generateFunctionTypeSignature(callFunction, callType); |
308 } | 308 } |
309 } | 309 } |
310 | 310 |
311 for (ResolutionDartType interfaceType in cls.interfaces) { | 311 for (ResolutionDartType interfaceType in cls.interfaces) { |
(...skipping 29 matching lines...) Expand all Loading... |
341 | 341 |
342 // We need to also emit "is checks" for the superclass and its supertypes. | 342 // We need to also emit "is checks" for the superclass and its supertypes. |
343 ClassElement superclass = cls.superclass; | 343 ClassElement superclass = cls.superclass; |
344 if (superclass != null) { | 344 if (superclass != null) { |
345 tryEmitTest(superclass); | 345 tryEmitTest(superclass); |
346 _generateInterfacesIsTests( | 346 _generateInterfacesIsTests( |
347 superclass, generateIsTest, generateSubstitution, alreadyGenerated); | 347 superclass, generateIsTest, generateSubstitution, alreadyGenerated); |
348 } | 348 } |
349 } | 349 } |
350 } | 350 } |
OLD | NEW |