Use local var context with static position methods#14
Merged
Conversation
Member
Author
|
Ok, the issue where it matched the wrong local var has been fixed by just walking back on the instruction chain until you find a label node that matches the start label of one of the matching local vars. |
Member
Author
|
Ok, this should be good to go now. Handles methods on SectionPos, QuartPos, and BlockPos and names stuff accordingly. One future optimization could be to detect simple math surrounding the parameter to a method in order to persist the var, method, field name through that logic. |
565337f to
c7f5c72
Compare
42706b9 to
7976d1d
Compare
MiniDigger
approved these changes
Jul 29, 2023
c7f5c72 to
e841285
Compare
Member
Author
|
Rebased and re-tested. It's not simple to add tests for the QuartPos, SectionPos stuff, because it uses the ContainerContext to see if it can find already named lvt (like from parameters) |
56593f4 to
7ee3b4b
Compare
7ee3b4b to
2503908
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ok, so this isn't working 100%, but I don't think I know enough to figure out to accurately get the LocalVariableNode referenced by a VarInsnNode. I thought it was enough to just get the
MethodNode.localVariablesfield, iterate through and find one with the matching index, but there seem to be duplicates. I noticed this while looking atCrashReportCategory#formatLocationL47. ThesectionPosXshould have an index pointing to that local var node, but there is a second one in the list that points towards theThrowablein the catch block above.