-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add filter for Kotlin when-expressions with String #737
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
Conversation
d1fe9d2 to
e26c7e4
Compare
842bcd2 to
cf5760d
Compare
cf5760d to
3edd605
Compare
|
@marchof rebased Currently diff between 26,27c26,27
< * Filters code that is generated by ECJ for a <code>switch</code> statement
< * with a <code>String</code>.
---
> * Filters bytecode that Kotlin compiler generates for <code>when</code>
> * expressions with a <code>String</code>.
29c29
< public final class StringSwitchEcjFilter implements IFilter {
---
> public final class KotlinWhenStringFilter implements IFilter {
46a47
> nextIsVar(Opcodes.ALOAD, "s");
73a75,77
> // jump to next comparison or default case
> nextIs(Opcodes.IFEQ);
> final JumpInsnNode jump = (JumpInsnNode) cursor;
75c79
< nextIs(Opcodes.IFNE);
---
> nextIs(Opcodes.GOTO);
83c87
< if (cursor.getNext().getOpcode() == Opcodes.GOTO) {
---
> if (jump.label == defaultLabel) {
85,86d88
< // jump to default
< nextIs(Opcodes.GOTO);😆 but I'd like to propose and would really prefer to work on refactoring separately. |
| } | ||
| } | ||
|
|
||
| private static AbstractInsnNode instructionAfterLabel( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Idea: Make a variant of skipNonOpcodes in base class public:
private static AbstractInsnNode skipNonOpcodes(AbstractInsnNode start)
|
@Godin Do you want me to merge it as is or do you like to pick-up the |
|
@marchof A quick random thought: |
|
👍 Let's wait for Travis. |
No description provided.