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

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

Issue 882713008: Move computation of method flags into model. (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/model.dart
diff --git a/pkg/compiler/lib/src/js_emitter/model.dart b/pkg/compiler/lib/src/js_emitter/model.dart
index 7d011ada585a4a6be4e714aceded5d92d40b2034..38c85c624bf2ba7c218325ff11be602354a13e5a 100644
--- a/pkg/compiler/lib/src/js_emitter/model.dart
+++ b/pkg/compiler/lib/src/js_emitter/model.dart
@@ -287,35 +287,85 @@ class Field {
bool get needsInterceptedSetter => setterFlags > 1;
}
-class Method {
+abstract class Method {
/// The element should only be used during the transition to the new model.
/// Uses indicate missing information in the model.
final Element element;
-
final String name;
final js.Expression code;
- final bool needsTearOff;
- Method(this.element, this.name, this.code, {this.needsTearOff}) {
+ Method(this.element, this.name, this.code);
+}
+
+class DartMethod extends Method {
floitsch 2015/01/28 16:10:39 Add comment what a "DartMethod" is.
herhut 2015/01/29 10:24:21 Done.
+ final bool needsTearOff;
+ final String tearOffName;
+ // TODO(herhut): Directly store stubs instead/
+ final bool needsStubs;
+ // TODO(herhut): Directly store aliases instead.
+ final bool canBeApplied;
+ final bool canBeReflected;
floitsch 2015/01/28 16:10:39 It would be an option to keep the "canBeReflected"
herhut 2015/01/29 10:24:20 I will remove it again later if it can be pushed i
+
+ DartMethod(Element element, String name, js.Expression code,
+ {this.needsTearOff, this.tearOffName, this.needsStubs, this.canBeApplied,
+ this.canBeReflected})
floitsch 2015/01/28 16:10:39 nit: indent one less.
herhut 2015/01/29 10:24:20 Done.
+ : super(element, name, code) {
assert(needsTearOff != null);
+ assert(!needsTearOff || tearOffName != null);
+ assert(canBeApplied != null);
+ assert(canBeReflected != null);
+ assert(needsStubs != null);
+ }
+}
+
+class InstanceMethod extends DartMethod {
+ // TODO(herhut): Directly store aliases instead.
+ final bool hasSuperAlias;
+ final bool isClosure;
+
+ InstanceMethod(element, name, code,
+ {bool needsTearOff,
+ String tearOffName,
+ this.hasSuperAlias,
+ bool canBeApplied,
+ bool canBeReflected,
+ this.isClosure,
+ bool needsStubs})
+ : super(element, name, code,
+ needsTearOff: needsTearOff,
floitsch 2015/01/28 16:10:39 I would align with "(".
herhut 2015/01/29 10:24:20 Done.
+ tearOffName: tearOffName,
+ canBeApplied: canBeApplied,
+ canBeReflected: canBeReflected,
+ needsStubs: needsStubs) {
+ assert(hasSuperAlias != null);
+ assert(isClosure != null);
}
}
class StubMethod extends Method {
StubMethod(String name, js.Expression code,
- {bool needsTearOff, Element element })
- : super(element, name, code, needsTearOff: needsTearOff);
+ {Element element})
+ : super(element, name, code);
}
-class StaticMethod extends Method {
+class StaticMethod extends DartMethod {
final Holder holder;
StaticMethod(Element element, String name, this.holder, js.Expression code,
- {bool needsTearOff})
- : super(element, name, code, needsTearOff: needsTearOff);
+ {bool needsTearOff, String tearOffName, bool canBeApplied,
+ bool canBeReflected, bool needsStubs})
+ : super(element, name, code,
+ needsTearOff: needsTearOff,
floitsch 2015/01/28 16:10:39 I would align with the "(".
herhut 2015/01/29 10:24:21 Done.
+ tearOffName : tearOffName,
+ canBeApplied : canBeApplied,
+ canBeReflected : canBeReflected,
+ needsStubs : needsStubs);
}
-class StaticStubMethod extends StaticMethod {
- StaticStubMethod(String name, Holder holder, js.Expression code,
- {bool needsTearOff})
- : super(null, name, holder, code, needsTearOff: needsTearOff);
+class StaticStubMethod extends StubMethod {
+ Holder holder;
+ StaticStubMethod(String name, this.holder, js.Expression code,
+ {bool needsTearOff, String tearOffName})
+ : super(name, code) {
+ assert(needsTearOff == false);
floitsch 2015/01/28 16:10:39 Will this change? If not, why get it as an argumen
herhut 2015/01/29 10:24:21 The original callsites to this had the tearoff par
+ }
}

Powered by Google App Engine
This is Rietveld 408576698