Copilot commented on code in PR #2591:
URL: https://github.com/apache/groovy/pull/2591#discussion_r3367384202
##########
src/main/java/org/codehaus/groovy/classgen/AsmClassGenerator.java:
##########
@@ -669,13 +671,13 @@ protected void visitConstructorOrMethod(final MethodNode
node, final boolean isC
Statement code = node.getCode();
BytecodeInstruction instruction; // fast path for getters,
setters, etc.
if (code instanceof BytecodeSequence && (instruction =
((BytecodeSequence) code).getBytecodeInstruction()) != null) {
- instruction.visit(mv);
+ instruction.visit(codeVisitor);
} else {
visitStdMethod(node, isConstructor, parameters, code);
}
try {
- mv.visitMaxs(0, 0);
+ codeVisitor.visitMaxs(0, 0);
Review Comment:
Since the controller’s active MethodVisitor is now the `codeVisitor`
wrapper, `visitCode()` should be invoked on `codeVisitor` as well (not directly
on `mv`). Calling `visitCode()` on a different visitor than the one receiving
instructions can break wrapper invariants if `PeepholeOptimizingMethodVisitor`
(or future wrappers) ever need to observe `visitCode()`/`visitEnd()` pairing.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]