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

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

Issue 886903003: dart2js: emit adapters in new emitter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: reupload Created 5 years, 11 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 6314abdc79a39f0f77ae28e5ab46c4e0f04b0493..d13108a3a767d5860f8f4e4d3794776291687681 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
@@ -306,8 +306,7 @@ class ModelEmitter {
}
js.Expression emitLibrary(Library library) {
- Iterable staticDescriptors = library.statics.expand((StaticMethod e) =>
- [ js.string(e.name), js.number(e.holder.index), emitStaticMethod(e) ]);
+ Iterable staticDescriptors = library.statics.expand(emitStaticMethod);
Iterable classDescriptors = library.classes.expand((Class e) =>
[ js.string(e.name), js.number(e.holder.index), emitClass(e) ]);
@@ -396,7 +395,14 @@ class ModelEmitter {
} else {
elements.add(_generateConstructor(cls));
}
- Iterable<Method> methods = cls.methods;
+ Iterable<Method> methods = cls.methods.expand((Method method) {
+ // TODO(floitsch): can there be anything else than a DartMethod?
+ if (method is DartMethod) {
+ return [method]..addAll(method.parameterStubs);
+ } else {
+ return [method];
+ }
+ });
Iterable<Method> isChecks = cls.isChecks;
Iterable<Method> gettersSetters = _generateGettersSetters(cls);
Iterable<Method> allMethods =
@@ -410,8 +416,23 @@ class ModelEmitter {
return unparse(compiler, field.code);
}
- js.Expression emitStaticMethod(StaticMethod method) {
- return unparse(compiler, method.code);
+ Iterable<js.Expression> emitStaticMethod(StaticMethod method) {
+ js.Expression holderIndex = js.number(method.holder.index);
+ List<js.Expression> output = <js.Expression>[];
+
+ void _addMethod(Method method) {
+ js.Expression unparsed = unparse(compiler, method.code);
+ output.add(js.string(method.name));
+ output.add(holderIndex);
+ output.add(unparsed);
+ }
+
+ _addMethod(method);
+ // TODO(floitsch): can there be anything else than a StaticDartMethod?
+ if (method is StaticDartMethod) {
+ method.parameterStubs.forEach(_addMethod);
+ }
+ return output;
}
static final String boilerplate = """
« 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