static Expr makeWrappedIfCondition(Expr expr, boolean truth) { return new FunctionCallExpr(truth ? Constants.GLF_WRAPPED_IF_TRUE : Constants.GLF_WRAPPED_IF_FALSE, expr); }
private Expr makeWrappedLoopCondition(Expr expr) { return new FunctionCallExpr(Constants.GLF_WRAPPED_LOOP, expr); }
@Override public Expr generateExpr(IRandom generator, Expr... args) { return new FunctionCallExpr(name, Arrays.asList(args)); }
private Expr macroConstructor(String name, Expr... args) { return new FunctionCallExpr(name, Arrays.asList(args)); }
@Override public FunctionCallExpr clone() { return new FunctionCallExpr(callee, args.stream().map(x -> x.clone()).collect(Collectors.toList())); }
public Expr makeDeadCondition(Fuzzer fuzzer) { return new FunctionCallExpr(Constants.GLF_DEAD, makeOpaqueBoolean(false, BasicType.BOOL, false, 0, fuzzer)); }
@Override public Expr apply(Expr expr, BasicType type, boolean constContext, int depth, Fuzzer fuzzer) { // max(expr, expr) assert BasicType.allNumericTypes().contains(type); return identityConstructor( expr, new FunctionCallExpr("max", applyIdentityFunction(expr.clone(), type, constContext, depth, fuzzer), applyIdentityFunction(expr.clone(), type, constContext, depth, fuzzer))); }
@Override public Expr apply(Expr expr, BasicType type, boolean constContext, int depth, Fuzzer fuzzer) { // min(expr, expr) assert BasicType.allNumericTypes().contains(type); return identityConstructor( expr, new FunctionCallExpr("min", applyIdentityFunction(expr.clone(), type, constContext, depth, fuzzer), applyIdentityFunction(expr.clone(), type, constContext, depth, fuzzer))); }
@Override public Expr apply(Expr expr, BasicType type, boolean constContext, int depth, Fuzzer fuzzer) { // clamp(expr, expr, expr) assert BasicType.allNumericTypes().contains(type); return identityConstructor( expr, new FunctionCallExpr("clamp", applyIdentityFunction(expr.clone(), type, constContext, depth, fuzzer), applyIdentityFunction(expr.clone(), type, constContext, depth, fuzzer), applyIdentityFunction(expr.clone(), type, constContext, depth, fuzzer))); }
@Override public Expr visitFunction_call_header_no_parameters( Function_call_header_no_parametersContext ctx) { if (isBuiltinTypeConstructor(ctx.function_call_header().function_identifier()) || isStructTypeConstructor(ctx.function_call_header().function_identifier())) { throw new RuntimeException( "Found type constructor with no arguments at line " + ctx.start.getLine() + ": " + getOriginalSourceText(ctx)); } if (isRegularFunction(ctx.function_call_header().function_identifier())) { return new FunctionCallExpr(getCallee(ctx.function_call_header().function_identifier()), new ArrayList<>()); } throw new RuntimeException("Unsupported function call at line " + ctx.start.getLine() + ": " + getOriginalSourceText(ctx)); }
generator, generationParams)); block.setStmts(Arrays.asList(new SwitchStmt(new FunctionCallExpr(Constants.GLF_SWITCH, zero), new BlockStmt(switchBodyStmts, true))));
new FunctionCallExpr("mix", new TypeConstructorExpr(type.toString(), xElements), new TypeConstructorExpr(type.toString(), yElements),
be.getLhs().clone(), new FunctionCallExpr(newFunctionName, referencedVariables.stream().map(item -> new VariableIdentifierExpr(item)) .collect(Collectors.toList())), BinOp.ASSIGN));
return new FunctionCallExpr(getCallee(header.function_identifier()), params);