-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Handle fluent getters for primitive return types #9
Conversation
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.
Sorry for the nitpick.
src/main/java/io/papermc/codebook/lvt/LvtAssignmentSuggester.java
Outdated
Show resolved
Hide resolved
b079b1f
to
e65b7bc
Compare
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.
Not sure what all you have targeted for this, so if there are static use-cases then let me know.
|
||
// 3 instructions, load "this" local var, getfield, return - TODO maybe if there is a CAST, | ||
private static final IntPredicate[] OPCODES_IN_ORDER = new IntPredicate[] { | ||
i -> i == Opcodes.ALOAD, i -> i == Opcodes.GETFIELD, i -> i >= Opcodes.IRETURN && i <= Opcodes.RETURN |
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.
ALOAD
should always be of slot 0
for this
.
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.
Do you mean that I should be checking more than just the opcode in these predicates? that I should also check the slot of the var insn here?
src/main/java/io/papermc/codebook/lvt/LvtAssignmentSuggester.java
Outdated
Show resolved
Hide resolved
33a63bb
to
d3b62c0
Compare
990ed71
to
7b5923e
Compare
53e9d67
to
8408ccb
Compare
Updated for modular suggester system |
8408ccb
to
2bbee6c
Compare
2bbee6c
to
a37a170
Compare
Checks if the method has a primitive return type, and if the instructions with opcodes in the method follow a specific order and type so as to indicate it is a simple getter.