@Override public void visit(UnaryExpr expr) { pushLocation(expr.getLocation()); try { expr.getOperand().acceptVisitor(this); Expr operand = resultExpr; if (expr.getOperation() == UnaryOperation.NEGATE && operand instanceof ConstantExpr) { ConstantExpr constantExpr = (ConstantExpr) operand; if (tryMakePositive(constantExpr)) { resultExpr = expr; return; } } expr.setOperand(operand); resultExpr = expr; } finally { popLocation(); } }
result = new WasmIntBinary(WasmIntType.INT32, WasmIntBinaryOperation.SHL, result, new WasmInt32Constant(24)); result.setLocation(expr.getLocation()); result = new WasmIntBinary(WasmIntType.INT32, WasmIntBinaryOperation.SHR_SIGNED, result, new WasmInt32Constant(24)); result.setLocation(expr.getLocation()); break; case INT_TO_SHORT: result = new WasmIntBinary(WasmIntType.INT32, WasmIntBinaryOperation.SHL, result, new WasmInt32Constant(16)); result.setLocation(expr.getLocation()); result = new WasmIntBinary(WasmIntType.INT32, WasmIntBinaryOperation.SHR_SIGNED, result, new WasmInt32Constant(16)); result.setLocation(expr.getLocation()); break; case INT_TO_CHAR: result = new WasmIntBinary(WasmIntType.INT32, WasmIntBinaryOperation.SHL, result, new WasmInt32Constant(16)); result.setLocation(expr.getLocation()); result = new WasmIntBinary(WasmIntType.INT32, WasmIntBinaryOperation.SHR_UNSIGNED, result, new WasmInt32Constant(16)); result.setLocation(expr.getLocation()); break; case LENGTH: result = new WasmIntBinary(WasmIntType.INT32, WasmIntBinaryOperation.SUB, new WasmInt32Constant(0), result);
@Override public void visit(UnaryExpr expr) { try { if (expr.getLocation() != null) { pushLocation(expr.getLocation()); break; if (expr.getLocation() != null) { popLocation();
@Override public void visit(UnaryExpr expr) { pushLocation(expr.getLocation()); try { expr.getOperand().acceptVisitor(this); Expr operand = resultExpr; if (expr.getOperation() == UnaryOperation.NEGATE && operand instanceof ConstantExpr) { ConstantExpr constantExpr = (ConstantExpr) operand; if (tryMakePositive(constantExpr)) { resultExpr = expr; return; } } expr.setOperand(operand); resultExpr = expr; } finally { popLocation(); } }
result = new WasmIntBinary(WasmIntType.INT32, WasmIntBinaryOperation.SHL, result, new WasmInt32Constant(24)); result.setLocation(expr.getLocation()); result = new WasmIntBinary(WasmIntType.INT32, WasmIntBinaryOperation.SHR_SIGNED, result, new WasmInt32Constant(24)); result.setLocation(expr.getLocation()); break; case INT_TO_SHORT: result = new WasmIntBinary(WasmIntType.INT32, WasmIntBinaryOperation.SHL, result, new WasmInt32Constant(16)); result.setLocation(expr.getLocation()); result = new WasmIntBinary(WasmIntType.INT32, WasmIntBinaryOperation.SHR_SIGNED, result, new WasmInt32Constant(16)); result.setLocation(expr.getLocation()); break; case INT_TO_CHAR: result = new WasmIntBinary(WasmIntType.INT32, WasmIntBinaryOperation.SHL, result, new WasmInt32Constant(16)); result.setLocation(expr.getLocation()); result = new WasmIntBinary(WasmIntType.INT32, WasmIntBinaryOperation.SHR_UNSIGNED, result, new WasmInt32Constant(16)); result.setLocation(expr.getLocation()); break; case LENGTH: result = new WasmIntBinary(WasmIntType.INT32, WasmIntBinaryOperation.SUB, new WasmInt32Constant(0), result);
@Override public void visit(UnaryExpr expr) { try { if (expr.getLocation() != null) { pushLocation(expr.getLocation()); break; if (expr.getLocation() != null) { popLocation();