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

Unified Diff: pkg/compiler/lib/src/js_emitter/model.dart

Issue 887853004: dart2js: Move parameterStub generation to parameter_stub_generator and add parameter stubs to model. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased. 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/model.dart
diff --git a/pkg/compiler/lib/src/js_emitter/model.dart b/pkg/compiler/lib/src/js_emitter/model.dart
index ea1e4769ed5c17d114a6a289cb64e3d8958e6dd9..9b782382a38ea38088330060dfc74b8d43196487 100644
--- a/pkg/compiler/lib/src/js_emitter/model.dart
+++ b/pkg/compiler/lib/src/js_emitter/model.dart
@@ -333,21 +333,21 @@ abstract class Method {
class DartMethod extends Method {
final bool needsTearOff;
final String tearOffName;
- // TODO(herhut): Directly store stubs instead/
- final bool needsStubs;
+ final List<ParameterStubMethod> parameterStubs;
// TODO(herhut): Directly store aliases instead.
final bool canBeApplied;
final bool canBeReflected;
DartMethod(Element element, String name, js.Expression code,
- {this.needsTearOff, this.tearOffName, this.needsStubs, this.canBeApplied,
- this.canBeReflected})
+ this.parameterStubs,
+ {this.needsTearOff, this.tearOffName, this.canBeApplied,
+ this.canBeReflected})
: super(element, name, code) {
assert(needsTearOff != null);
assert(!needsTearOff || tearOffName != null);
assert(canBeApplied != null);
+ assert(parameterStubs != null);
assert(canBeReflected != null);
- assert(needsStubs != null);
}
}
@@ -356,20 +356,18 @@ class InstanceMethod extends DartMethod {
final bool hasSuperAlias;
final bool isClosure;
- InstanceMethod(element, name, code,
+ InstanceMethod(element, name, code, List<ParameterStubMethod> parameterStubs,
{bool needsTearOff,
String tearOffName,
this.hasSuperAlias,
bool canBeApplied,
bool canBeReflected,
- this.isClosure,
- bool needsStubs})
- : super(element, name, code,
+ this.isClosure})
+ : super(element, name, code, parameterStubs,
needsTearOff: needsTearOff,
tearOffName: tearOffName,
canBeApplied: canBeApplied,
- canBeReflected: canBeReflected,
- needsStubs: needsStubs) {
+ canBeReflected: canBeReflected) {
assert(hasSuperAlias != null);
assert(isClosure != null);
}
@@ -386,6 +384,19 @@ class StubMethod extends Method {
: super(element, name, code);
}
+ /// A method that is generated for the different versions of method calls of
+ /// methods with named parameters,
+ ///
+ /// For example, for a method foo(a, b, {c, d}) that is called as
+ /// foo(1, 2, c: 3), we have the stub
+ /// foo$3$c(a, b, c) => foo$4$c$d(a, b, c, null);
+class ParameterStubMethod extends StubMethod {
+ final Selector selector;
+ ParameterStubMethod(String name, js.Expression code, this.selector,
+ {Element element})
+ : super(name, code, element: element);
+}
+
abstract class StaticMethod implements Method {
Holder get holder;
}
@@ -394,15 +405,14 @@ class StaticDartMethod extends DartMethod implements StaticMethod {
final Holder holder;
StaticDartMethod(Element element, String name, this.holder,
- js.Expression code,
+ js.Expression code, parameterStubs,
{bool needsTearOff, String tearOffName, bool canBeApplied,
- bool canBeReflected, bool needsStubs})
- : super(element, name, code,
+ bool canBeReflected})
+ : super(element, name, code, parameterStubs,
needsTearOff: needsTearOff,
tearOffName : tearOffName,
canBeApplied : canBeApplied,
- canBeReflected : canBeReflected,
- needsStubs : needsStubs);
+ canBeReflected : canBeReflected);
}
class StaticStubMethod extends StubMethod implements StaticMethod {
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/js_emitter.dart ('k') | pkg/compiler/lib/src/js_emitter/old_emitter/container_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698