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

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

Issue 889693003: dart2js: Use stub instances when generating ParameterStubs (adapterStubMethods). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove unused field. 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..d84f8ec77c3896c237569d9384597297e1289998 100644
--- a/pkg/compiler/lib/src/js_emitter/model.dart
+++ b/pkg/compiler/lib/src/js_emitter/model.dart
@@ -327,9 +327,7 @@ abstract class Method {
Method(this.element, this.name, this.code);
}
-/**
- * A method that corresponds to a method in the original Dart program.
- */
+/// A method that corresponds to a method in the original Dart program.
class DartMethod extends Method {
final bool needsTearOff;
final String tearOffName;
@@ -375,17 +373,36 @@ class InstanceMethod extends DartMethod {
}
}
-/**
- * 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.
- */
+/// 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,
{Element element})
: super(element, name, code);
}
+
+/// A method that adapts a call to the methods calling convention.
+///
+/// For example, given a method `foo$2(x, [y: 499])` a possible adapter
+/// stub-method could be `foo$1(x) => foo$2(x, 499)`.
+///
+/// AdapterStubMethods are always attached to (static or instance) methods.
+class AdapterStubMethod extends StubMethod {
+ /// The `call` name of this adapter.
+ ///
+ /// When an instance method is torn off, it is invoked as a `call` member and
+ /// not it's original name anymore. The [callName] provides the adapter's
+ /// name when it is used this way.
+ ///
+ /// If an adapter's member can not be torn off, the [callName] is `null`.
+ String callName;
+
+ AdapterStubMethod(String name, this.callName, js.Expression code)
+ : super(name, code);
+}
+
abstract class StaticMethod implements Method {
Holder get holder;
}

Powered by Google App Engine
This is Rietveld 408576698