return new SegmentCode(code.getTypedKlass(), source, ctx);
}
@Override
public Code visitExpr_math_unary_prefix(Expr_math_unary_prefixContext ctx) {
ExpressionContext expression = ctx.expression();
SegmentCode code = (SegmentCode) expression.accept(this);
String op = ctx.getChild(0).getText();
assert_not_null_constantContext(expression);
// 类型检查
Class<?> resultKlass;
if (op.length() == 1) {
// +, -, ~
resultKlass = PromotionUtils.get_unary_basic(code.getKlass(), op);
} else {
// ++, --
if (expression.getChildCount() == 1 && expression.getChild(0) instanceof ConstantContext) {
throw reportError("Invalid argument to operation " + op + ", required: variable, found Value", expression);
}
resultKlass = PromotionUtils.get_unary_inc_dec(code.getKlass(), op);
}
if (resultKlass == null) {