| 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);
|
| }
|
| }
|
|
|
|
|