Search in sources :

Example 16 with IVariable

use of com.laytonsmith.core.constructs.IVariable in project CommandHelper by EngineHub.

the class Script method seval.

/**
 * Runs eval on the code tree, and if it returns an ival, resolves it.
 *
 * @param c
 * @param env
 * @return
 */
public Construct seval(ParseTree c, final Environment env) {
    Construct ret = eval(c, env);
    while (ret instanceof IVariable) {
        IVariable cur = (IVariable) ret;
        ret = env.getEnv(GlobalEnv.class).GetVarList().get(cur.getVariableName(), cur.getTarget()).ival();
    }
    return ret;
}
Also used : IVariable(com.laytonsmith.core.constructs.IVariable) Construct(com.laytonsmith.core.constructs.Construct)

Aggregations

IVariable (com.laytonsmith.core.constructs.IVariable)16 Construct (com.laytonsmith.core.constructs.Construct)10 CString (com.laytonsmith.core.constructs.CString)9 CArray (com.laytonsmith.core.constructs.CArray)8 GlobalEnv (com.laytonsmith.core.environments.GlobalEnv)8 CFunction (com.laytonsmith.core.constructs.CFunction)6 ConfigRuntimeException (com.laytonsmith.core.exceptions.ConfigRuntimeException)6 ConfigCompileException (com.laytonsmith.core.exceptions.ConfigCompileException)5 Variable (com.laytonsmith.core.constructs.Variable)4 Environment (com.laytonsmith.core.environments.Environment)4 ArrayList (java.util.ArrayList)4 ParseTree (com.laytonsmith.core.ParseTree)3 CDouble (com.laytonsmith.core.constructs.CDouble)3 CInt (com.laytonsmith.core.constructs.CInt)3 CNull (com.laytonsmith.core.constructs.CNull)3 IVariableList (com.laytonsmith.core.constructs.IVariableList)3 CommandHelperEnvironment (com.laytonsmith.core.environments.CommandHelperEnvironment)3 ConfigCompileGroupException (com.laytonsmith.core.exceptions.ConfigCompileGroupException)3 FunctionReturnException (com.laytonsmith.core.exceptions.FunctionReturnException)3 FunctionList (com.laytonsmith.core.functions.FunctionList)3