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

Unified Diff: pkg/compiler/lib/src/js_emitter/new_emitter/model_emitter.dart

Issue 932523004: Fix Function.apply for static functions in new emitter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Comments. Created 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js_emitter/new_emitter/model_emitter.dart
diff --git a/pkg/compiler/lib/src/js_emitter/new_emitter/model_emitter.dart b/pkg/compiler/lib/src/js_emitter/new_emitter/model_emitter.dart
index 6c9bc3436ab17525eb64b4614aa7fc84ea7d3677..65065d838afad9cc3c04b8b01a9abe3b49eb3985 100644
--- a/pkg/compiler/lib/src/js_emitter/new_emitter/model_emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/new_emitter/model_emitter.dart
@@ -115,8 +115,8 @@ class ModelEmitter {
'tearOff': buildTearOffCode(backend),
'parseFunctionDescriptor':
js.js.statement(parseFunctionDescriptorBoilerplate,
- {'argCnt': js.string(namer.requiredParameterField),
- 'defArgValues': js.string(namer.defaultValuesField),
+ {'argumentCount': js.string(namer.requiredParameterField),
+ 'defaultArgumentValues': js.string(namer.defaultValuesField),
'callName': js.string(namer.callNameField)}),
'cyclicThrow':
@@ -128,6 +128,8 @@ class ModelEmitter {
emitStaticNonFinalFields(fragment.staticNonFinalFields),
'operatorIsPrefix': js.string(namer.operatorIsPrefix),
'callName': js.string(namer.callNameField),
+ 'argumentCount': js.string(namer.requiredParameterField),
+ 'defaultArgumentValues': js.string(namer.defaultValuesField),
'eagerClasses': emitEagerClassInitializations(fragment.libraries),
'invokeMain': fragment.invokeMain,
'code': code};
@@ -619,9 +621,9 @@ function parseFunctionDescriptor(proto, name, descriptor) {
proto[tearOffName] =
tearOff(funs, reflectionInfo, false, name, isIntercepted);
}
- if (descriptor[pos] != null) {
- f[#argCnt] = descriptor[pos];
- f[#defArgValues] = descriptor[pos + 1];
+ if (pos < descriptor.length) {
+ f[#argumentCount] = descriptor[pos];
+ f[#defaultArgumentValues] = descriptor[pos + 1];
}
} else {
proto[name] = descriptor;
@@ -831,7 +833,10 @@ function parseFunctionDescriptor(proto, name, descriptor) {
fun[#callName] = descriptor[1];
holder[name] = fun;
funs = [fun];
- for (var pos = 4; pos < descriptor.length; pos += 3) {
+ // We iterate in blocks of 3 but have to stop before we reach the
+ // (optional) two trailing items. To accomplish this, we only iterate
+ // until we reach length - 2.
+ for (var pos = 4; pos < descriptor.length - 2; pos += 3) {
var stubName = descriptor[pos];
fun = compile(stubName, descriptor[pos + 2]);
fun[#callName] = descriptor[pos + 1];
@@ -843,6 +848,10 @@ function parseFunctionDescriptor(proto, name, descriptor) {
holder[descriptor[2]] =
tearOff(funs, descriptor[3], true, name, false);
}
+ if (pos < descriptor.length) {
+ fun[#argumentCount] = descriptor[pos];
+ fun[#defaultArgumentValues] = descriptor[pos + 1];
+ }
}
function setupCompileAllAndDelegateStub(name) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698