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

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

Issue 1193083002: fixes #231, mixin application (aka ClassTypeAlias) implicit ctors (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/collection.js ('k') | no next file » | 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 55731d2e74ff4fb5290e6dd956894c5a4d9ceea8..3b6d287ba550f7d6f27d18797d46e32dfa46cd2b 100644
--- a/lib/src/codegen/js_codegen.dart
+++ b/lib/src/codegen/js_codegen.dart
@@ -332,8 +332,23 @@ class JSCodegenVisitor extends GeneralizingAstVisitor {
// If we've already emitted this class, skip it.
vsm 2015/06/19 23:20:40 Is this comment still valid?
Jennifer Messerly 2015/06/22 15:55:44 Good catch, removed (from 3 places!)
var element = node.element;
+ // Forward all generative constructors from the base class.
+ var body = [];
+
+ var supertype = element.supertype;
+ if (!supertype.isObject) {
+ for (var ctor in element.constructors) {
+ var parentCtor = supertype.lookUpConstructor(ctor.name, ctor.library);
+ var fun = js.call('function() { super.#(...#); }', [
vsm 2015/06/19 23:20:40 It'd be nice to have the args here to show the act
Jennifer Messerly 2015/06/22 15:55:44 Agreed. However, there are a few reasons for not d
+ _constructorName(parentCtor),
+ new JS.Identifier('arguments', allowRename: false)
+ ]);
+ body.add(new JS.Method(_constructorName(ctor), fun));
+ }
+ }
+
var classDecl = new JS.ClassDeclaration(new JS.ClassExpression(
- new JS.Identifier(element.name), _classHeritage(element), []));
+ new JS.Identifier(element.name), _classHeritage(element), body));
return _finishClassDef(element.type, classDecl);
}
« no previous file with comments | « lib/runtime/dart/collection.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698