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

Unified Diff: sdk/lib/_internal/compiler/implementation/lib/js_helper.dart

Issue 12207038: Fix issue http://dartbug.com/8350 by dealing with interceptors in invokeOn. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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/lib/js_helper.dart
diff --git a/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart b/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart
index 2c80eaa53140bf0741af00a07796497205109974..0fbff9c6ac7296a29e8f6a9642bb77b865f2baef 100644
--- a/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart
+++ b/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart
@@ -13,6 +13,7 @@ import 'dart:_foreign_helper' show DART_CLOSURE_TO_JS,
JS_HAS_EQUALS,
RAW_DART_FUNCTION_REF,
UNINTERCEPTED;
+import 'dart:_interceptors' show getInterceptor;
part 'constant_map.dart';
part 'native_helper.dart';
@@ -95,11 +96,19 @@ class JSInvocationMirror implements InvocationMirror {
return map;
}
+ static final _objectInterceptor = getInterceptor(new Object());
invokeOn(Object object) {
- List arguments = _arguments;
- if (!isJsArray(arguments)) arguments = new List.from(arguments);
- return JS("var", "#[#].apply(#, #)",
- object, _internalName, object, arguments);
+ var interceptor = getInterceptor(object);
+ var receiver = object;
+ var name = _internalName;
+ var arguments = _arguments;
+ if (identical(interceptor, _objectInterceptor)) {
+ if (!isJsArray(arguments)) arguments = new List.from(arguments);
+ } else {
+ arguments = [object]..addAll(arguments);
+ receiver = interceptor;
+ }
+ return JS("var", "#[#].apply(#, #)", receiver, name, receiver, arguments);
}
}

Powered by Google App Engine
This is Rietveld 408576698