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

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

Issue 891743002: Add support for super aliases to new emitter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
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 9f4538222f9b6e80497279692cf87b06f8bb5495..b8faa26265c7ffd09dd999e4dab06245614ac387 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
@@ -418,7 +418,7 @@ function parseFunctionDescriptor(proto, name, desc) {
proto[name] = desc[0];
var funs = [desc[0]];
funs[0].$callName = desc[1];
- for (var pos = 4; pos < desc.length; pos += 3) {
+ for (var pos = 5; pos < desc.length; pos += 3) {
var stub = desc[pos+2];
stub.$callName = desc[pos+1];
proto[desc[pos]] = stub;
@@ -427,13 +427,17 @@ function parseFunctionDescriptor(proto, name, desc) {
if (desc[2] != null) {
proto[desc[2]] = tearOff(funs, desc[3], false, name, false);
}
+ // Install the alias for super calls on the prototype chain.
+ if (desc[4] != null) {
+ proto[desc[4]] = desc[0];
+ }
} else {
proto[name] = desc;
}
}
""";
- Iterable<js.Expression> emitInstanceMethod(Method method) {
+ Iterable<js.Expression> emitInstanceMethod(InstanceMethod method) {
List<js.Expression> makeNameCodePair(Method method) {
return [js.string(method.name), method.code];
@@ -447,13 +451,18 @@ function parseFunctionDescriptor(proto, name, desc) {
}
if (method is DartMethod) {
- if (method.needsTearOff) {
- // [name, [function, callName, tearOffName, functionType,
+ if (method.needsTearOff || method.superAlias != null) {
+ // [name, [function, callName, tearOffName, functionType, aliasName,
// stub1_name, stub1_callName, stub1_code, ...]
var data = [method.code];
data.add(js.string(method.callName));
data.add(js.string(method.tearOffName));
data.add(new js.LiteralNull());
+ if (method.superAlias != null) {
+ data.add(js.string(method.superAlias));
+ } else {
+ data.add(new js.LiteralNull());
+ }
data.addAll(method.adapterStubs.expand(makeNameCallNameCodeTriplet));
return [js.string(method.name), new js.ArrayInitializer(data)];
} else {

Powered by Google App Engine
This is Rietveld 408576698