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

Unified Diff: pkg/compiler/lib/src/js_emitter/old_emitter/nsm_emitter.dart

Issue 1203523003: Revert "Fix for issue 23432." (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: 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
Index: pkg/compiler/lib/src/js_emitter/old_emitter/nsm_emitter.dart
diff --git a/pkg/compiler/lib/src/js_emitter/old_emitter/nsm_emitter.dart b/pkg/compiler/lib/src/js_emitter/old_emitter/nsm_emitter.dart
index 201a369d717df3cb931a2a8b1f67da996eb09f4c..94ac7ca8701fa8b1aaa84e1cfcc3f66ddb75452d 100644
--- a/pkg/compiler/lib/src/js_emitter/old_emitter/nsm_emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/old_emitter/nsm_emitter.dart
@@ -278,12 +278,14 @@ class NsmEmitter extends CodeEmitterHelper {
' objectClassObject = objectClassObject[1];'));
}
- dynamic isIntercepted = // jsAst.Expression or bool.
+ List<jsAst.Expression> sliceOffsetArguments =
firstNormalSelector == 0
- ? false
- : firstNormalSelector == shorts.length
- ? true
- : js('j < #', js.number(firstNormalSelector));
+ ? []
+ : (firstNormalSelector == shorts.length
+ ? [js.number(1)]
+ : [js('(j < #) ? 1 : 0', js.number(firstNormalSelector))]);
+
+ var sliceOffsetParams = sliceOffsetArguments.isEmpty ? [] : ['sliceOffset'];
statements.add(js.statement('''
// If we are loading a deferred library the object class will not be in
@@ -292,51 +294,31 @@ class NsmEmitter extends CodeEmitterHelper {
if (objectClassObject) {
for (var j = 0; j < shortNames.length; j++) {
var type = 0;
- var shortName = shortNames[j];
- if (shortName[0] == "${namer.getterPrefix[0]}") type = 1;
- if (shortName[0] == "${namer.setterPrefix[0]}") type = 2;
+ var short = shortNames[j];
+ if (short[0] == "${namer.getterPrefix[0]}") type = 1;
+ if (short[0] == "${namer.setterPrefix[0]}") type = 2;
// Generate call to:
//
// createInvocationMirror(String name, internalName, type,
// arguments, argumentNames)
//
-
- // This 'if' is either a static choice or dynamic choice depending on
- // [isIntercepted].
- if (#isIntercepted) {
- objectClassObject[shortName] =
- (function(name, shortName, type) {
- return function(receiver) {
- return this.#noSuchMethodName(
- receiver,
- #createInvocationMirror(name, shortName, type,
- // Create proper Array with all arguments except first
- // (receiver).
- Array.prototype.slice.call(arguments, 1),
- []));
- }
- })(#names[j], shortName, type);
- } else {
- objectClassObject[shortName] =
- (function(name, shortName, type) {
- return function() {
- return this.#noSuchMethodName(
- // Object.noSuchMethodName ignores the explicit receiver
- // argument. We could pass anything in place of [this].
- this,
- #createInvocationMirror(name, shortName, type,
- // Create proper Array with all arguments.
- Array.prototype.slice.call(arguments, 0),
- []));
- }
- })(#names[j], shortName, type);
- }
+ objectClassObject[short] = (function(name, short,
+ type, #sliceOffsetParams) {
+ return function() {
+ return this.#noSuchMethodName(this,
+ #createInvocationMirror(name, short, type,
+ Array.prototype.slice.call(arguments,
+ #sliceOffsetParams),
+ []));
+ }
+ })(#names[j], short, type, #sliceOffsetArguments);
}
}''', {
+ 'sliceOffsetParams': sliceOffsetParams,
'noSuchMethodName': namer.noSuchMethodName,
'createInvocationMirror': createInvocationMirror,
'names': minify ? 'shortNames' : 'longNames',
- 'isIntercepted': isIntercepted}));
+ 'sliceOffsetArguments': sliceOffsetArguments}));
return statements;
}
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/class_stub_generator.dart ('k') | sdk/lib/_internal/compiler/js_lib/interceptors.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698