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
dart2js: minified does not work with noSuchMethod. #9283
Comments
Minimal repro: https://github.com/kevmoo/dart_sdk_9283 Last commit is with minify. This is a regression. Attachment: |
Added Triaged label. |
I will investigate. Set owner to @vsmenon. |
Changed the title to: "dart2js: minified breaks JS-interop [REGRESSION]". |
Dart SDK version 0.4.2.5_r20193 It's an NSM issue. If I run the code below (using the editor / wizard web app as a template), I should get: "Called HelloWorld" With dart2js --minify, I get: "Called Df". Kevin: are you saying it used to work with --minify? import 'dart:html'; class A { void main() { cc @kasperl. |
I've used minify for a while with no issues. This seems a regression from one of the last integration builds. |
Thanks, I also verified that my mini-test above works correctly on Dart SDK version 0.4.1.0_r19425. |
Does the code work with dart2dart minification? Did it ever? I think the answer to both questions is "no". The new and much more compact way we deal with NSM is according to the specification and as far as I know it's perfectly valid to construct the InvocationMirror object using the minified names. We have talked about a way of opt'ing in to carrying the mapping from minified to unminified names around. In a way, this issue is really a feature request for that. cc @ErikCorryGoogle. |
Yes, it did indeed stop working on this CL (r20005): dart2js: Create noSuchMethod handlers at runtime to reduce overhead. |
FWIW, the spec does say that calling memberName on the InvocationMirror gives a string that matches the true name of the method (with an = at the end if it is a setter). Minification breaks that. You can argue that the user asked for a source transformation that has this effect, but this is highly debatable. What if the user tests to see if the names match a certain pattern (like, starting with _ to see if it was a private method). At the very least, there needs to be an opt-out mechanism, or an API that lets you convert source names to minified names. |
Gilad, can you please clarify the correct behavior? I see no mention in the spec of minification. It does say: "The result of looking up a method m in object o with respect to library L is.... a new instance im of the predefined class InvocationMirror is created, such that ... im.memberName evaluates to ‘m’." which suggests to me that im.memberName should have the original method name. |
Gilad, sorry for the crossed streams, and thanks for answering my question before I asked it. :-) Kasper, how should we proceed on this? |
Kevin, If you get a chance, can you try replacing: js.context.pushAnalytics(...); with this: js.context'pushAnalytics'; in your code? The latter should not trigger NSM. |
No dice. See last few commits here for changes: https://github.com/dart-lang/pop-pop-win/commits/master Attachment: |
A workaround is illustrated in https://code.google.com/p/dart/codesearch#dart/trunk/dart/tests/language/no_such_method_test.dart If there are a few names you want to get the real name from you can use the getName technique from this test to get them. |
Adding link to js-interop bug: https://github.com/dart-lang/js-interop/issues/57 |
We haven't forgotten about this issue and we're trying to come up with a design that works well for both dart2dart and dart2js minified code. |
Added this to the Later milestone. |
Added TriageForM5 label. |
I'll try to get a minimal repro, but for now, see the attached image.
This is running the latest commit to Pop-Pop-Win via Chrome (not Dartium)
dart-lang/sample-pop_pop_win@4589259
I'm pretty sure this relates to the call to Google Analytics.
Everything works great in Dartium and non-minimized dart2js.
Dart VM version: 0.4.2.5 r20193 (Tue Mar 19 04:23:27 2013)
Attachment:
[Screen Shot 2013-03-19 at 1.38.03 PM.png](https://storage.googleapis.com/google-code-attachments/dart/issue-9283/comment-0/Screen Shot 2013-03-19 at 1.38.03 PM.png) (99.98 KB)
The text was updated successfully, but these errors were encountered: