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 754e5aa0bad1b1481b6868da298300901da924c3..a60feeacebc9edaa77f50cd60e881d3098250da0 100644 |
--- a/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart |
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart |
@@ -477,9 +477,11 @@ class JavaScriptBackend extends Backend { |
} |
bool isInterceptedMethod(Element element) { |
- return element.isInstanceMember() |
- && !element.isGenerativeConstructorBody() |
- && interceptedElements[element.name] != null; |
+ if (!element.isInstanceMember()) return false; |
+ if (element.isGenerativeConstructorBody()) { |
+ return Elements.isNativeOrExtendsNative(element.getEnclosingClass()); |
+ } |
+ return interceptedElements[element.name] != null; |
} |
bool fieldHasInterceptedGetter(Element element) { |
@@ -952,6 +954,30 @@ class JavaScriptBackend extends Backend { |
if (element.isTypedef()) { |
typedefTypeLiterals.add(element); |
} |
+ if (element.isClass()) { |
+ // TODO(sra): Can we register via a type parameter? |
+ registerEscapingConstructorsOfClass(element, enqueuer); |
+ } |
+ } |
+ |
+ void registerEscapingConstructorsOfClass(ClassElement classElement, |
+ Enqueuer enqueuer) { |
+ // Web component classes have constructors that are escaped to the host |
ngeoffray
2013/10/17 09:08:59
Please define 'escape' here.
sra1
2013/10/18 04:09:32
This code has been replaced.
|
+ // environment. |
+ // TODO(13835): Defer registering generative constructors until the helper |
+ // functions that fetch the constructors is seen. These functions are |
+ // called by document.register. |
+ classElement.ensureResolved(compiler); |
+ if (Elements.isNativeOrExtendsNative(classElement)) { |
+ registerGenerativeConstructors(ClassElement enclosing, Element member) { |
+ if (member.isGenerativeConstructor()) { |
+ enqueuer.registerStaticUse(member); |
+ } |
+ } |
+ classElement.forEachMember(registerGenerativeConstructors, |
+ includeBackendMembers: false, |
+ includeSuperAndInjectedMembers: false); |
+ } |
} |
void registerStackTraceInCatch(TreeElements elements) { |