Index: dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart |
diff --git a/dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart b/dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart |
index 3118874217d4d8cebfdf1478105c9cb3c626cab5..a951b0a565a515463eb1352b4f0fd29017ca8f89 100644 |
--- a/dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart |
+++ b/dart/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart |
@@ -3159,11 +3159,23 @@ class CodeEmitterTask extends CompilerTask { |
block.statements.add(buildInterceptorCheck(backend.jsArrayClass)); |
} |
+ // TODO(ahe): Work with sra@ to integrate this with native interceptors, |
+ // and potentially initialize the dispatch object during finishClasses. |
ngeoffray
2013/09/06 06:54:06
Please add a comment on what this is for, and what
ahe
2013/09/09 11:26:29
Done.
|
+ block.statements.add( |
+ js.if_(r'typeof receiver == "function" && "builtin$cls" in receiver', |
+ buildReturnInterceptor(backend.jsRuntimeType))); |
+ |
+ // TODO(ahe): This should be a constant and we should be able to remove |
+ // this test (so I'm keeping the redundant "object" test). |
ngeoffray
2013/09/06 06:54:06
Ditto for having "func"
ahe
2013/09/09 11:26:29
Done.
|
+ block.statements.add( |
+ js.if_(r'typeof receiver == "object"' |
+ ' && receiver.constructor === Object' |
ngeoffray
2013/09/06 06:54:06
Add a comment on why this constructor check?
ahe
2013/09/09 11:26:29
Done.
|
+ ' && "func" in receiver', |
+ buildReturnInterceptor(backend.jsFunctionType))); |
+ |
if (hasNative) { |
block.statements.add( |
- js.if_( |
- js('(typeof receiver) != "object"'), |
- js.return_(js('receiver')))); |
+ js.if_('typeof receiver != "object"', js.return_('receiver'))); |
// if (receiver instanceof $.Object) return receiver; |
// return $.getNativeInterceptor(receiver); |