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

Unified Diff: sdk/lib/_internal/compiler/implementation/resolution/members.dart

Issue 14049034: Revert "Revert "Fix x.runtimeType for native classes"" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/compiler/implementation/resolution/members.dart
diff --git a/sdk/lib/_internal/compiler/implementation/resolution/members.dart b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
index 46d678dca016129d6212158b20fba1f2a1ca20f8..8043517e444cc077f232165c333282291f8fe848 100644
--- a/sdk/lib/_internal/compiler/implementation/resolution/members.dart
+++ b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
@@ -3207,17 +3207,23 @@ class ClassResolverVisitor extends TypeDefinitionVisitor {
element.supertype = resolveSupertype(element, node.superclass);
}
}
-
- // If the super type isn't specified, we make it Object.
- final objectElement = compiler.objectClass;
- if (!identical(element, objectElement) && element.supertype == null) {
- if (objectElement == null) {
- compiler.internalError("Internal error: cannot resolve Object",
- node: node);
- } else {
- objectElement.ensureResolved(compiler);
+ // If the super type isn't specified, we provide a default. The language
+ // specifies [Object] but the backend can pick a specific 'implementation'
+ // of Object - the JavaScript backend chooses between Object and
+ // Interceptor.
+ if (element.supertype == null) {
+ ClassElement superElement = compiler.backend.defaultSuperclass(element);
+ // Avoid making the superclass (usually Object) extend itself.
+ if (element != superElement) {
+ if (superElement == null) {
+ compiler.internalError(
+ "Cannot resolve default superclass for $element",
+ node: node);
+ } else {
+ superElement.ensureResolved(compiler);
+ }
+ element.supertype = superElement.computeType(compiler);
}
- element.supertype = objectElement.computeType(compiler);
}
assert(element.interfaces == null);
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/lib/js_rti.dart ('k') | tests/compiler/dart2js_native/runtimetype_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698