Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Side by Side Diff: sdk/lib/_internal/compiler/implementation/js_backend/backend.dart

Issue 14098009: Fix x.runtimeType for native classes (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 js_backend; 5 part of js_backend;
6 6
7 typedef void Recompile(Element element); 7 typedef void Recompile(Element element);
8 8
9 class ReturnInfo { 9 class ReturnInfo {
10 HType returnType; 10 HType returnType;
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 void addInterceptorsForNativeClassMembers( 972 void addInterceptorsForNativeClassMembers(
973 ClassElement cls, Enqueuer enqueuer) { 973 ClassElement cls, Enqueuer enqueuer) {
974 if (enqueuer.isResolutionQueue) { 974 if (enqueuer.isResolutionQueue) {
975 cls.ensureResolved(compiler); 975 cls.ensureResolved(compiler);
976 cls.forEachMember((ClassElement classElement, Element member) { 976 cls.forEachMember((ClassElement classElement, Element member) {
977 // All methods on [Object] are shadowed by [Interceptor]. 977 // All methods on [Object] are shadowed by [Interceptor].
978 if (classElement == compiler.objectClass) return; 978 if (classElement == compiler.objectClass) return;
979 Set<Element> set = interceptedElements.putIfAbsent( 979 Set<Element> set = interceptedElements.putIfAbsent(
980 member.name, () => new Set<Element>()); 980 member.name, () => new Set<Element>());
981 set.add(member); 981 set.add(member);
982 if (classElement == jsInterceptorClass) return;
982 if (!classElement.isNative()) { 983 if (!classElement.isNative()) {
983 MixinApplicationElement mixinApplication = classElement; 984 MixinApplicationElement mixinApplication = classElement;
984 assert(member.getEnclosingClass() == mixinApplication.mixin); 985 assert(member.getEnclosingClass() == mixinApplication.mixin);
985 classesMixedIntoNativeClasses.add(mixinApplication.mixin); 986 classesMixedIntoNativeClasses.add(mixinApplication.mixin);
986 } 987 }
987 }, 988 },
988 includeSuperMembers: true); 989 includeSuperMembers: true);
989 } 990 }
990 } 991 }
991 992
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
1361 } 1362 }
1362 1363
1363 native.NativeEnqueuer nativeResolutionEnqueuer(Enqueuer world) { 1364 native.NativeEnqueuer nativeResolutionEnqueuer(Enqueuer world) {
1364 return new native.NativeResolutionEnqueuer(world, compiler); 1365 return new native.NativeResolutionEnqueuer(world, compiler);
1365 } 1366 }
1366 1367
1367 native.NativeEnqueuer nativeCodegenEnqueuer(Enqueuer world) { 1368 native.NativeEnqueuer nativeCodegenEnqueuer(Enqueuer world) {
1368 return new native.NativeCodegenEnqueuer(world, compiler, emitter); 1369 return new native.NativeCodegenEnqueuer(world, compiler, emitter);
1369 } 1370 }
1370 1371
1372 ClassElement defaultSuperclass(ClassElement element) {
1373 // Native classes inherit from Interceptor.
1374 return element.isNative() ? jsInterceptorClass : compiler.objectClass;
1375 }
1376
1371 /** 1377 /**
1372 * Unit test hook that returns code of an element as a String. 1378 * Unit test hook that returns code of an element as a String.
1373 * 1379 *
1374 * Invariant: [element] must be a declaration element. 1380 * Invariant: [element] must be a declaration element.
1375 */ 1381 */
1376 String assembleCode(Element element) { 1382 String assembleCode(Element element) {
1377 assert(invariant(element, element.isDeclaration)); 1383 assert(invariant(element, element.isDeclaration));
1378 return jsAst.prettyPrint(generatedCode[element], compiler).getText(); 1384 return jsAst.prettyPrint(generatedCode[element], compiler).getText();
1379 } 1385 }
1380 1386
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
1780 ClassElement get constListImplementation => jsArrayClass; 1786 ClassElement get constListImplementation => jsArrayClass;
1781 ClassElement get fixedListImplementation => jsFixedArrayClass; 1787 ClassElement get fixedListImplementation => jsFixedArrayClass;
1782 ClassElement get growableListImplementation => jsExtendableArrayClass; 1788 ClassElement get growableListImplementation => jsExtendableArrayClass;
1783 ClassElement get mapImplementation => mapLiteralClass; 1789 ClassElement get mapImplementation => mapLiteralClass;
1784 ClassElement get constMapImplementation => constMapLiteralClass; 1790 ClassElement get constMapImplementation => constMapLiteralClass;
1785 ClassElement get functionImplementation => jsFunctionClass; 1791 ClassElement get functionImplementation => jsFunctionClass;
1786 ClassElement get typeImplementation => typeLiteralClass; 1792 ClassElement get typeImplementation => typeLiteralClass;
1787 ClassElement get boolImplementation => jsBoolClass; 1793 ClassElement get boolImplementation => jsBoolClass;
1788 ClassElement get nullImplementation => jsNullClass; 1794 ClassElement get nullImplementation => jsNullClass;
1789 } 1795 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/compiler.dart ('k') | sdk/lib/_internal/compiler/implementation/lib/core_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698