예제 #1
0
    ///

    public static bool SetLocalVar(
        this NeuInterpreter interpreter,
        String name,
        NeuOperation newValue)
    {
        var hoistedFrame = interpreter.GetHoistedFrameWithinScope(name);

        if (hoistedFrame == null)
        {
            return(false);
        }

        ///

        var v = hoistedFrame.Operation as NeuVar;

        if (v == null)
        {
            throw new Exception();
        }

        ///

        v.Value = newValue;

        ///

        return(true);
    }
예제 #2
0
    public static NeuVar?GetLocalVar(
        this NeuInterpreter interpreter,
        String name)
    {
        var hoistedFrame = interpreter.GetHoistedFrameWithinScope(name);

        if (hoistedFrame == null)
        {
            return(null);
        }

        ///

        return(hoistedFrame.Operation as NeuVar);
    }