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

Unified Diff: lib/src/codegen/js_codegen.dart

Issue 1200243002: fixes #232, handling of arguments (Closed) Base URL: git@github.com:dart-lang/dev_compiler.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
« no previous file with comments | « lib/runtime/dart/js.js ('k') | lib/src/codegen/js_names.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/codegen/js_codegen.dart
diff --git a/lib/src/codegen/js_codegen.dart b/lib/src/codegen/js_codegen.dart
index b3421f5e96af27cb25572df60a51cdd3a7c9a255..34f9534b4839ceab94b0dd3e63ae7defa0d634a6 100644
--- a/lib/src/codegen/js_codegen.dart
+++ b/lib/src/codegen/js_codegen.dart
@@ -337,10 +337,8 @@ class JSCodegenVisitor extends GeneralizingAstVisitor {
if (!supertype.isObject) {
for (var ctor in element.constructors) {
var parentCtor = supertype.lookUpConstructor(ctor.name, ctor.library);
- var fun = js.call('function() { super.#(...#); }', [
- _constructorName(parentCtor),
- new JS.Identifier('arguments', allowRename: false)
- ]);
+ var fun = js.call('function() { super.#(...arguments); }',
+ [_constructorName(parentCtor)]);
body.add(new JS.Method(_constructorName(ctor), fun));
}
}
@@ -845,16 +843,14 @@ class JSCodegenVisitor extends GeneralizingAstVisitor {
// Performance of this pattern is likely to be bad.
name = _propertyName('constructor');
// Mark the parameter as no-rename.
- var args = new JS.Identifier('arguments', allowRename: false);
body = js.statement('''{
// Get the class name for this instance.
let name = this.constructor.name;
// Call the default constructor.
- let init = this[name];
let result = void 0;
- if (init) result = init.apply(this, #);
+ if (name in this) result = this[name](...arguments);
vsm 2015/06/23 19:58:27 Shouldn't this be something like: if (this.__prot
Jennifer Messerly 2015/06/23 20:08:35 the problem, if it repros, already exists in old c
return result === void 0 ? this : result;
- }''', args);
+ }''');
} else {
body = _emitConstructorBody(node, fields);
}
« no previous file with comments | « lib/runtime/dart/js.js ('k') | lib/src/codegen/js_names.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698