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

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

Issue 12330135: Make instance methods whose names collide with intercepted methods have the interceptor calling con… (Closed) Base URL: http://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
===================================================================
--- sdk/lib/_internal/compiler/implementation/lib/js_helper.dart (revision 19306)
+++ sdk/lib/_internal/compiler/implementation/lib/js_helper.dart (working copy)
@@ -15,7 +15,8 @@
JS_HAS_EQUALS,
RAW_DART_FUNCTION_REF,
UNINTERCEPTED;
-import 'dart:_interceptors' show getInterceptor;
+import 'dart:_interceptors' show getInterceptor,
+ interceptedNames;
part 'constant_map.dart';
part 'native_helper.dart';
@@ -98,13 +99,16 @@
return map;
}
- static final _objectInterceptor = getInterceptor(new Object());
invokeOn(Object object) {
var interceptor = getInterceptor(object);
var receiver = object;
var name = _internalName;
var arguments = _arguments;
- if (identical(interceptor, _objectInterceptor)) {
+ // TODO(ngeoffray): If this functionality ever become performance
+ // critical, we might want to dynamically change [interceptedNames]
+ // to be a JavaScript object with intercepted names as property
+ // instead of a JavaScript array.
+ if (JS('int', '#.indexOf(#)', interceptedNames, name) == -1) {
if (!isJsArray(arguments)) arguments = new List.from(arguments);
} else {
arguments = [object]..addAll(arguments);
@@ -1552,11 +1556,7 @@
// overwrite o with the interceptor below.
var rti = getRuntimeTypeInfo(o);
// Check for native objects and use the interceptor instead of the object.
- var interceptor = getInterceptor(o);
- // TODO(karlklose): remove the following reuse of _objectInterceptor.
- if (!identical(interceptor, JSInvocationMirror._objectInterceptor)) {
- o = interceptor;
- }
+ o = getInterceptor(o);
// We can use the object as its own type representation because we install
// the subtype flags and the substitution on the prototype, so they are
// properties of the object in JS.

Powered by Google App Engine
This is Rietveld 408576698