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

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

Issue 15026006: Support for extending native classes (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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/js_backend/backend.dart
diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart b/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
index 970af53587d96a11a2e9bec8ee20a0de1653bbc5..d5751bbb216cc8fe89de598700ec708790fbafce 100644
--- a/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
@@ -200,6 +200,7 @@ class JavaScriptBackend extends Backend {
Element getInterceptorMethod;
Element interceptedNames;
+ Element mapTypeToInterceptor;
ahe 2013/08/12 20:47:35 Please document this field.
sra1 2013/08/12 23:06:14 Done.
HType stringType;
HType indexablePrimitiveType;
@@ -356,7 +357,7 @@ class JavaScriptBackend extends Backend {
bool isInterceptorClass(ClassElement element) {
if (element == null) return false;
- if (element.isNative()) return true;
+ if (Elements.isNativeOrExtendsNative(element)) return true;
if (interceptedClasses.contains(element)) return true;
if (classesMixedIntoNativeClasses.contains(element)) return true;
return false;
@@ -412,7 +413,7 @@ class JavaScriptBackend extends Backend {
Set<ClassElement> result = new Set<ClassElement>();
for (Element element in intercepted) {
ClassElement classElement = element.getEnclosingClass();
- if (classElement.isNative()
+ if (Elements.isNativeOrExtendsNative(classElement)
|| interceptedClasses.contains(classElement)) {
result.add(classElement);
}
@@ -454,6 +455,8 @@ class JavaScriptBackend extends Backend {
compiler.findInterceptor(const SourceString('getInterceptor'));
interceptedNames =
compiler.findInterceptor(const SourceString('interceptedNames'));
+ mapTypeToInterceptor =
+ compiler.findInterceptor(const SourceString('mapTypeToInterceptor'));
dispatchPropertyName =
compiler.findInterceptor(const SourceString('dispatchPropertyName'));
getDispatchPropertyMethod =
@@ -594,7 +597,7 @@ class JavaScriptBackend extends Backend {
member.name, () => new Set<Element>());
set.add(member);
if (classElement == jsInterceptorClass) return;
- if (!classElement.isNative()) {
+ if (classElement.isMixinApplication) {
MixinApplicationElement mixinApplication = classElement;
assert(member.getEnclosingClass() == mixinApplication.mixin);
classesMixedIntoNativeClasses.add(mixinApplication.mixin);
@@ -703,7 +706,8 @@ class JavaScriptBackend extends Backend {
addInterceptors(jsPlainJavaScriptObjectClass, enqueuer, elements);
} else if (cls == jsUnknownJavaScriptObjectClass) {
addInterceptors(jsUnknownJavaScriptObjectClass, enqueuer, elements);
- } else if (cls.isNative()) {
+ //} else if (cls.isNative()) {
ahe 2013/08/12 20:47:35 Remove comment.
sra1 2013/08/12 23:06:14 Done.
+ } else if (Elements.isNativeOrExtendsNative(cls)) {
addInterceptorsForNativeClassMembers(cls, enqueuer);
}
}

Powered by Google App Engine
This is Rietveld 408576698