use of org.develnext.jphp.core.compiler.jvm.misc.JumpItem in project jphp by jphp-compiler.
the class MethodStmtCompiler method getJumpStackSize.
public int getJumpStackSize(int level) {
int size = 0;
for (int i = jumpStack.size(); i >= 0 && jumpStack.size() - i < level; i--) {
JumpItem item = getJump(i);
size += item.stackSize;
}
return size;
}
use of org.develnext.jphp.core.compiler.jvm.misc.JumpItem in project jphp by jphp-compiler.
the class JumpCompiler method write.
@Override
public void write(JumpStmtToken token) {
int level = token.getLevel();
JumpItem jump = method.getJump(level);
if (jump == null) {
env.error(token.toTraceInfo(compiler.getContext()), ErrorType.E_COMPILE_ERROR, level == 1 ? Messages.ERR_CANNOT_JUMP.fetch() : Messages.ERR_CANNOT_JUMP_TO_LEVEL.fetch(level));
return;
}
if (token instanceof ContinueStmtToken) {
add(new JumpInsnNode(GOTO, jump.continueLabel));
} else if (token instanceof BreakStmtToken) {
add(new JumpInsnNode(GOTO, jump.breakLabel));
}
}
Aggregations