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 part of dart2js.js_emitter; | 5 part of dart2js.js_emitter; |
6 | 6 |
7 class NativeEmitter { | 7 class NativeEmitter { |
8 | 8 |
9 final Map<Element, ClassBuilder> cachedBuilders; | 9 final Map<Element, ClassBuilder> cachedBuilders; |
10 | 10 |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 receiver = js('this'); | 336 receiver = js('this'); |
337 arguments = argumentsBuffer.sublist(0, | 337 arguments = argumentsBuffer.sublist(0, |
338 indexOfLastOptionalArgumentInParameters + 1); | 338 indexOfLastOptionalArgumentInParameters + 1); |
339 } | 339 } |
340 statements.add( | 340 statements.add( |
341 js.statement('return #.#(#)', [receiver, target, arguments])); | 341 js.statement('return #.#(#)', [receiver, target, arguments])); |
342 | 342 |
343 return statements; | 343 return statements; |
344 } | 344 } |
345 | 345 |
346 bool isSupertypeOfNativeClass(Element element) { | 346 bool isSupertypeOfNativeClass(ClassElement element) { |
347 if (element.isTypeVariable) { | |
348 compiler.internalError(element, "Is check for type variable."); | |
349 return false; | |
350 } | |
351 if (element.computeType(compiler).unalias(compiler) is FunctionType) { | |
352 // The element type is a function type either directly or through | |
353 // typedef(s). | |
354 return false; | |
355 } | |
356 | |
357 if (!element.isClass) { | |
358 compiler.internalError(element, "Is check does not handle element."); | |
359 return false; | |
360 } | |
361 | |
362 if (backend.classesMixedIntoInterceptedClasses.contains(element)) { | 347 if (backend.classesMixedIntoInterceptedClasses.contains(element)) { |
363 return true; | 348 return true; |
364 } | 349 } |
365 | 350 |
366 return subtypes[element] != null; | 351 return subtypes[element] != null; |
367 } | 352 } |
368 | 353 |
369 bool requiresNativeIsCheck(Element element) { | 354 bool requiresNativeIsCheck(Element element) { |
370 // TODO(sra): Remove this function. It determines if a native type may | 355 // TODO(sra): Remove this function. It determines if a native type may |
371 // satisfy a check against [element], in which case an interceptor must be | 356 // satisfy a check against [element], in which case an interceptor must be |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 } | 449 } |
465 ''', {'info': infoAccess, | 450 ''', {'info': infoAccess, |
466 'constructor': constructorAccess, | 451 'constructor': constructorAccess, |
467 'subclassRead': subclassRead, | 452 'subclassRead': subclassRead, |
468 'interceptorsByTagAccess': interceptorsByTagAccess, | 453 'interceptorsByTagAccess': interceptorsByTagAccess, |
469 'leafTagsAccess': leafTagsAccess, | 454 'leafTagsAccess': leafTagsAccess, |
470 'nativeSuperclassTagName': embeddedNames.NATIVE_SUPERCLASS_TAG_NAME, | 455 'nativeSuperclassTagName': embeddedNames.NATIVE_SUPERCLASS_TAG_NAME, |
471 'allowNativesSubclassing': true}); | 456 'allowNativesSubclassing': true}); |
472 } | 457 } |
473 } | 458 } |
OLD | NEW |