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

Unified Diff: pkg/compiler/lib/src/js_emitter/class_stub_generator.dart

Issue 1181063005: Fix for issue 23432 - Get the correct receiver in noSuchMethod stubs. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: fix bad merge Created 5 years, 6 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
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_emitter/old_emitter/nsm_emitter.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js_emitter/class_stub_generator.dart
diff --git a/pkg/compiler/lib/src/js_emitter/class_stub_generator.dart b/pkg/compiler/lib/src/js_emitter/class_stub_generator.dart
index e21ba1daf0bd280ce3c6192fe7e634dee5d0c232..54b2a1bcdc5c61eabf8df93d5d52bdd7282e47aa 100644
--- a/pkg/compiler/lib/src/js_emitter/class_stub_generator.dart
+++ b/pkg/compiler/lib/src/js_emitter/class_stub_generator.dart
@@ -158,14 +158,16 @@ class ClassStubGenerator {
String internalName = namer.invocationMirrorInternalName(selector);
assert(backend.isInterceptedName(Compiler.NO_SUCH_METHOD));
+ bool isIntercepted = backend.isInterceptedName(selector.name);
jsAst.Expression expression =
- js('''this.#noSuchMethodName(this,
+ js('''this.#noSuchMethodName(#receiver,
#createInvocationMirror(#methodName,
#internalName,
#type,
#arguments,
#namedArguments))''',
- {'noSuchMethodName': namer.noSuchMethodName,
+ {'receiver': isIntercepted ? r'$receiver' : 'this',
+ 'noSuchMethodName': namer.noSuchMethodName,
'createInvocationMirror':
backend.emitter.staticFunctionAccess(
backend.getCreateInvocationMirror()),
@@ -179,7 +181,7 @@ class ClassStubGenerator {
'namedArguments': new jsAst.ArrayInitializer(argNames)});
jsAst.Expression function;
- if (backend.isInterceptedName(selector.name)) {
+ if (isIntercepted) {
function = js(r'function($receiver, #) { return # }',
[parameterNames, expression]);
} else {
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_emitter/old_emitter/nsm_emitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698