feat: support more types in switch statements#2926
feat: support more types in switch statements#2926CountBleck merged 5 commits intoAssemblyScript:mainfrom
Conversation
HerrCai0907
left a comment
There was a problem hiding this comment.
as does not use string pool..so it is impossible to compare two string directly with ptr. string.eq must be used for each check.
... oh. I see. I was thrown off because the naive test passed, but this one fails: assert(doSwitchString("o" + "n" + "e") == 1);because the concatenated resulting string is in a different variable and thus a different pointer than the I'll add a special case for strings. I think it should be good for the rest though. |
|
I wonder if this should just be using the |
|
Working on a revision. I think I can reuse some existing code. I found that string equality isn't handled by the Much of the logic to determine whether to call |
|
This is now updated with the revisions. I've split the existing |
|
@HerrCai0907 any other adjustments you would like? |
CountBleck
left a comment
There was a problem hiding this comment.
LGTM. And wow, these method names (compileCommutativeCompareBinaryExpressionFromParts) are starting to get longer and longer 😛
153ca02 to
9029772
Compare
Fixes #2919
Fixes #648
Changes proposed in this pull request:
switchstatement with certain types.I've reused the existing equality comparison logic, so any behavior for
==is retained for switch cases, including overloads, etc.