-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
switch == invocation #450
Comments
I'll let Gilad be the final judge on this, but our intention was e == v (i.e. the VM behavior). This gives more predictable behavior and can be optimized more easily. Added Area-Language, Triaged labels. |
This comment was originally written by kresten...@gmail.com For what it is worth, It seems that v==e would have (potentially) better performance, because the virtual method '==' can be extracted once, and then applied repeatedly without the vtable indirection. |
But the type of e is almost always known at compilation time (in most cases it's a literal). This could be efficiently compiled to a jump-table or a tree after first checking that the input is a number. (In the case of a double a little bit more trickery is necessary). |
Changes: ``` > git log --format="%C(auto) %h %s" 32a9450..87e4c68 https://dart.googlesource.com/markdown.git/+/87e4c68 Bump to 6.0.1 (#462) https://dart.googlesource.com/markdown.git/+/37305cf Add deprecated accessors for indicatorForUncheckedCheckBox and indicatorForCheckedCheckBox (#459) https://dart.googlesource.com/markdown.git/+/2e5e347 lint cleanup (#456) https://dart.googlesource.com/markdown.git/+/a0b5a05 example: small tweak to example – add Dart code (#455) https://dart.googlesource.com/markdown.git/+/de32a69 visitText to use textContent getter so subclassing Text class works correctly. (#431) https://dart.googlesource.com/markdown.git/+/8247955 Rewrite checkbox(task list) extension (#450) https://dart.googlesource.com/markdown.git/+/a602760 Fix crash with mixed checkbox lists (#449) ``` Diff: https://dart.googlesource.com/markdown.git/+/32a94505ded3863b82310b86344a003a19c00341~..87e4c689342d5bbaa84ba2999abf0bff503979be/ Change-Id: I92cf05fe6057e1b3eda8da09fc4eac4f67dd47ab Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260441 Reviewed-by: Samuel Rawlins <srawlins@google.com> Auto-Submit: Devon Carew <devoncarew@google.com> Commit-Queue: Samuel Rawlins <srawlins@google.com>
This issue was originally filed by kresten.kra...@gmail.com
When doing
switch(v) { case e: ... }
The spec says that it tests v==e,
the vm does e.operator ==(v)
the frog compiles it to JS: "switch(v) { case e: ... }"
Neither of which correspond to the spec. Which is right?
Attached test case tests the spec semantics.
Attachment:
SwitchEqualsTest.dart (826 Bytes)
The text was updated successfully, but these errors were encountered: