| 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..4ccde7575c1c87d148c0d5fadefa493e7e6333b4 100644
|
| --- a/pkg/compiler/lib/src/js_emitter/model.dart
|
| +++ b/pkg/compiler/lib/src/js_emitter/model.dart
|
| @@ -287,35 +287,90 @@ 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);
|
| +}
|
| +
|
| +/**
|
| + * A method that corresponds to a method in the original Dart program.
|
| + */
|
| +class DartMethod extends Method {
|
| + 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;
|
| +
|
| + DartMethod(Element element, String name, js.Expression code,
|
| + {this.needsTearOff, this.tearOffName, this.needsStubs, this.canBeApplied,
|
| + this.canBeReflected})
|
| + : 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,
|
| + tearOffName: tearOffName,
|
| + canBeApplied: canBeApplied,
|
| + canBeReflected: canBeReflected,
|
| + needsStubs: needsStubs) {
|
| + assert(hasSuperAlias != null);
|
| + assert(isClosure != null);
|
| }
|
| }
|
|
|
| +/**
|
| + * A method that is generated by the backend and has not direct correspondence
|
| + * to a method in the original Dart program. Examples are getter and setter
|
| + * stubs and stubs to dispatch calls to methods with optional parameters.
|
| + */
|
| 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,
|
| + 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)
|
| + : super(name, code);
|
| }
|
|
|