use of suite.jdk.gen.FunExprM.ConstantFunExpr in project suite by stupidsing.
the class FunFactory method _null.
public FunExpr _null() {
ConstantFunExpr expr = new ConstantFunExpr();
expr.type = Type.NULL;
expr.constant = null;
return expr;
}
use of suite.jdk.gen.FunExprM.ConstantFunExpr in project suite by stupidsing.
the class FunFactory method constant.
private FunExpr constant(Object constant, BasicType type) {
ConstantFunExpr expr = new ConstantFunExpr();
expr.type = type;
expr.constant = constant;
return expr;
}
use of suite.jdk.gen.FunExprM.ConstantFunExpr in project suite by stupidsing.
the class FunExpand method expand_.
private FunExpr expand_(FunExpr e0, int depth) {
return //
e0.<//
FunExpr>switch_().applyIf(ApplyFunExpr.class, e1 -> {
FunExpr object0 = e1.object;
FunExpr object1 = object0 instanceof CastFunExpr ? ((CastFunExpr) object0).expr : object0;
if (object1 instanceof Declare0ParameterFunExpr) {
Declare0ParameterFunExpr object_ = (Declare0ParameterFunExpr) object1;
return expand(object_.do_, depth);
} else if (object1 instanceof Declare1ParameterFunExpr) {
Declare1ParameterFunExpr object_ = (Declare1ParameterFunExpr) object1;
return expand(replace(object_.do_, object_.parameter, e1.parameters.get(0)), depth);
} else if (object1 instanceof Declare2ParameterFunExpr) {
Declare2ParameterFunExpr object_ = (Declare2ParameterFunExpr) object1;
FunExpr do0 = object_.do_;
FunExpr do1 = replace(do0, object_.p0, e1.parameters.get(0));
FunExpr do2 = replace(do1, object_.p1, e1.parameters.get(1));
return expand(do2, depth);
} else
return null;
}).applyIf(DeclareLocalFunExpr.class, e1 -> {
return expand(replace(e1.do_, e1.var, e1.value), depth);
}).applyIf(InvokeLambdaFunExpr.class, e1 -> {
if (Boolean.FALSE) {
LambdaInstance<?> l_inst = e1.lambda;
LambdaImplementation<?> l_impl = l_inst.lambdaImplementation;
if (e1.isExpand || weight(l_impl.expr) <= 5) {
LambdaInterface<?> l_iface = l_impl.lambdaInterface;
FunExpr fe = l_impl.expr;
for (String fieldName : l_impl.fieldTypes.keySet()) fe = replaceFieldInject(fe, fieldName, object(l_inst.fieldValues.get(fieldName), l_impl.fieldTypes.get(fieldName)));
return expand(fe.cast_(l_iface.interfaceClass).apply(e1.parameters), depth - 1);
} else
return null;
} else
return null;
}).applyIf(If1FunExpr.class, e1 -> {
FunExpr if_ = e1.if_;
if (if_ instanceof ConstantFunExpr) {
ConstantFunExpr e2 = (ConstantFunExpr) if_;
if (e2.type == Type.INT)
return ((Integer) e2.constant).intValue() != 0 ? e1.then : e1.else_;
else
return null;
} else
return null;
}).result();
}
Aggregations