-
Notifications
You must be signed in to change notification settings - Fork 1.7k
dart2js: create interceptors for static subclasses of Function #9586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Note that with this change, the generated code in getInterceptor will be modified from if (typeof receiver == "function") to if (typeof receiver == "function") cc @karlklose. |
Marked this as blocking #9726. |
cc @johnniwinther. |
This comment was originally written by [email protected] Static functions are starting to get more and more complicated. Please also consider using our general closure mechanism (i.e. creating a Dart class). |
Regarding #4, I don't think it is any more complicated than what we need to do to reduce the size of closures. $$.WebBackButton_afterRender_anon = {"": "Closure;", This could be modeled by an in-line mixin application that copies type information: $$._FunctionType123 = {"": ";", $$.WebBackButton_afterRender_anon = {"": "Closure+FunctionType123;", If we make FunctionType123 derive from the JSFunction interceptor, we can also use it on static functions: $.myStaticFn.$interceptor = $.FunctionType123.prototype; |
Added this to the Later milestone. |
Added TriageForM5 label. |
This comment was originally written by [email protected] This has been fixed in https://codereview.chromium.org/14986002/. Added Fixed label. |
Removed TriageForM5 label. |
Static functions get methods from the JSFunction interceptor.
Some methods ($asFoo) are different depending on the type of the static function.
For each subtype of Function implemented by a static function, introduce a new interceptor subclass of JSFunction.
Instead of decorating each static function with type information, decorate it with the created interceptor for the subtype it implements.
getInterceptor should be changed to use the decorating interceptor if present, otherwise use the JSFunction interceptor.
$.typeNameInFirefox.call$1 = $.typeNameInFirefox;
$.typeNameInFirefox.$name = "typeNameInFirefox";
$.typeNameInFirefox.$isAnimationCallback = true;
$.typeNameInFirefox.$isChangeListener = true;
$.typeNameInFirefox.$isSelectHandler = true;
$.typeNameInFirefox.$is_FutureOnError = true;
$.typeNameInFirefox.$is_ErrorHandler = true;
$.typeNameInFirefox.$isEventListener = true;
$.typeNameInIE.call$1 = $.typeNameInIE;
$.typeNameInIE.$name = "typeNameInIE";
$.typeNameInIE.$isAnimationCallback = true;
$.typeNameInIE.$isChangeListener = true;
$.typeNameInIE.$isSelectHandler = true;
$.typeNameInIE.$is_FutureOnError = true;
$.typeNameInIE.$is_ErrorHandler = true;
$.typeNameInIE.$isEventListener = true;
-->
$$.JSFunction123 = {"": "JSfunction",
$isAnimationCallback: true,
$isChangeListener: true,
$isSelectHandler: true,
$is_FutureOnError: true,
$is_ErrorHandler: true,
$isEventListener: true
};
$.typeNameInFirefox.call$1 = $.typeNameInFirefox;
$.typeNameInFirefox.$name = "typeNameInFirefox";
$.typeNameInFirefox.$interceptor = $.JSFunction123.prototype;
$.typeNameInIE.call$1 = $.typeNameInIE;
$.typeNameInIE.$name = "typeNameInIE";
$.typeNameInIE.$interceptor = $.JSFunction123.prototype;
The text was updated successfully, but these errors were encountered: