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

Unified Diff: sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart

Issue 11348133: Add JSNull, JSBool and JSFunction, and move toString into the new interceptor scheme. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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/js_backend/emitter.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart (revision 15139)
+++ sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart (working copy)
@@ -1182,21 +1182,20 @@
Map<int, String> cache;
String extraArg;
- String extraArgWithThis;
String extraArgWithoutComma;
+ bool hasExtraArgument = false;
// Methods on foreign classes take an extra parameter, which is
// the actual receiver of the call.
JavaScriptBackend backend = compiler.backend;
if (backend.isInterceptorClass(member.getEnclosingClass())) {
+ hasExtraArgument = true;
cache = interceptorClosureCache;
extraArg = 'receiver, ';
- extraArgWithThis = 'this.receiver, ';
extraArgWithoutComma = 'receiver';
} else {
cache = boundClosureCache;
extraArg = '';
extraArgWithoutComma = '';
- extraArgWithThis = '';
}
String closureClass =
@@ -1230,8 +1229,12 @@
String joinedArgs = Strings.join(arguments, ", ");
boundClosureBuffer.add(
"$invocationName: function($joinedArgs) {");
- boundClosureBuffer.add(
- " return this.self[this.target]($extraArgWithThis$joinedArgs);");
+ String callArgs = hasExtraArgument
+ ? joinedArgs.isEmpty
+ ? 'this.$extraArgWithoutComma'
+ : 'this.$extraArg$joinedArgs'
+ : joinedArgs;
+ boundClosureBuffer.add(" return this.self[this.target]($callArgs);");
boundClosureBuffer.add(" }");
addParameterStubs(callElement, (String stubName, CodeBuffer memberValue) {
boundClosureBuffer.add(',\n $stubName: $memberValue');

Powered by Google App Engine
This is Rietveld 408576698