mirror of
https://github.com/GTNewHorizons/CraftTweaker.git
synced 2026-11-17 10:55:04 +00:00
40 lines
1.2 KiB
Java
40 lines
1.2 KiB
Java
/*
|
|
* To change this license header, choose License Headers in Project Properties.
|
|
* To change this template file, choose Tools | Templates
|
|
* and open the template in the editor.
|
|
*/
|
|
|
|
package stanhebben.zenscript.parser.expression;
|
|
|
|
import stanhebben.zenscript.compiler.IEnvironmentMethod;
|
|
import stanhebben.zenscript.expression.ExpressionConditional;
|
|
import stanhebben.zenscript.expression.partial.IPartialExpression;
|
|
import stanhebben.zenscript.util.ZenPosition;
|
|
|
|
/**
|
|
*
|
|
* @author Stanneke
|
|
*/
|
|
public class ParsedExpressionConditional extends ParsedExpression {
|
|
private final ParsedExpression condition;
|
|
private final ParsedExpression ifThen;
|
|
private final ParsedExpression ifElse;
|
|
|
|
public ParsedExpressionConditional(ZenPosition position, ParsedExpression condition, ParsedExpression ifThen, ParsedExpression ifElse) {
|
|
super(position);
|
|
|
|
this.condition = condition;
|
|
this.ifThen = ifThen;
|
|
this.ifElse = ifElse;
|
|
}
|
|
|
|
@Override
|
|
public IPartialExpression compile(IEnvironmentMethod environment) {
|
|
return new ExpressionConditional(
|
|
getPosition(),
|
|
condition.compile(environment).eval(environment),
|
|
ifThen.compile(environment).eval(environment),
|
|
ifElse.compile(environment).eval(environment));
|
|
}
|
|
}
|