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

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

Issue 1152583002: Add constructors to signatures (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 7 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
Index: lib/src/codegen/js_codegen.dart
diff --git a/lib/src/codegen/js_codegen.dart b/lib/src/codegen/js_codegen.dart
index bf9fe50236b0deb9c07b51682fb83c7af62c383d..5e6df418f75c8463a730ee9826930511f8cda962 100644
--- a/lib/src/codegen/js_codegen.dart
+++ b/lib/src/codegen/js_codegen.dart
@@ -603,12 +603,22 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ConversionVisitor {
_emitFunctionTypeParts(element.type, dynamicIsBottom: false);
var property =
new JS.Property(memberName, new JS.ArrayInitializer(parts));
- if (node.isStatic) {
+ if (node.isStatic) {
tStatics.add(property);
sNames.add(memberName);
} else tMethods.add(property);
}
}
+ var tCtors = [];
+ for (ConstructorDeclaration node in ctors) {
+ var memberName = _constructorName(classElem.name, node.name);
+ var element = node.element;
+ var parts =
+ _emitFunctionTypeParts(element.type, dynamicIsBottom: false);
+ var property =
+ new JS.Property(memberName, new JS.ArrayInitializer(parts));
+ tCtors.add(property);
+ }
build(name, elements) {
var o =
new JS.ObjectInitializer(elements, vertical: elements.length > 1);
@@ -617,6 +627,7 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ConversionVisitor {
return p;
}
var sigFields = [];
+ if (!tCtors.isEmpty) sigFields.add(build('constructors', tCtors));
if (!tMethods.isEmpty) sigFields.add(build('methods', tMethods));
if (!tStatics.isEmpty) {
assert(!sNames.isEmpty);
@@ -625,7 +636,6 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ConversionVisitor {
sigFields.add(build('statics', tStatics));
sigFields.add(aNames);
}
-
if (!sigFields.isEmpty) {
var sig = new JS.ObjectInitializer(sigFields);
var classExpr = new JS.Identifier(name);

Powered by Google App Engine
This is Rietveld 408576698