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

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

Issue 1083383006: fix ClassTypeAlias extends (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 8 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 2f599e5573417fe8b45eed0669d0580299bb6f9c..f8724d4a0e69c1f0b6467f55e78b2726ba354b71 100644
--- a/lib/src/codegen/js_codegen.dart
+++ b/lib/src/codegen/js_codegen.dart
@@ -287,10 +287,8 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ConversionVisitor {
if (_pendingClasses.remove(node.element) == null) return null;
var name = node.name.name;
- var heritage =
- js.call('dart.mixin(#)', [_visitList(node.withClause.mixinTypes)]);
- var classDecl = new JS.ClassDeclaration(
- new JS.ClassExpression(new JS.Identifier(name), heritage, []));
+ var classDecl = new JS.ClassDeclaration(new JS.ClassExpression(
+ new JS.Identifier(name), _classHeritage(node), []));
return _finishClassDef(type, classDecl);
}
@@ -537,20 +535,25 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ConversionVisitor {
]);
}
- JS.Expression _classHeritage(ClassDeclaration node) {
+ JS.Expression _classHeritage(node) {
vsm 2015/04/24 22:31:55 node could still be typed as AstNode, right?
Jennifer Messerly 2015/04/24 23:06:13 it breaks the .element and .withClause.
if (node.element.type.isObject) return null;
- JS.Expression heritage = null;
- if (node.extendsClause != null) {
- heritage = _visit(node.extendsClause.superclass);
+ DartType supertype;
+ if (node is ClassDeclaration) {
+ var ext = node.extendsClause;
+ supertype = ext != null ? ext.superclass.type : types.objectType;
} else {
- heritage = _emitTypeName(types.objectType);
+ supertype = (node as ClassTypeAlias).superclass.type;
}
+
+ JS.Expression heritage = _emitTypeName(supertype);
+
if (node.withClause != null) {
var mixins = _visitList(node.withClause.mixinTypes);
mixins.insert(0, heritage);
heritage = js.call('dart.mixin(#)', [mixins]);
}
+
return heritage;
}
« 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