Exemplo n.º 1
0
        public override EVariable Exec(EScope scope)
        {
            EVariable newVar = new EVVoid();

            foreach (EWord variable in variables)
            {
                newVar = EVariable.New(type);
                scope.Set(variable.ToString(), newVar);
            }

            if (assignOperations != null)
            {
                foreach (EAssignOperation assignOp in assignOperations)
                {
                    assignOp.Exec(scope);
                }
            }

            return(newVar);
        }
Exemplo n.º 2
0
        public override EVariable Exec(EScope scope, ESolvable[] args)
        {
            // TODO: output type casting
            if (args.Length != arguments.Length)
            {
                throw new ELangException("Wrong amount of args for function " + name);
            }

            EScope lowerScope = scope.GetChild();

            for (int i = 0; i < arguments.Length; i++)
            {
                string    argname = arguments[i].GetVariable().ToString();
                ETypeWord argtype = arguments[i].GetEType();

                EVariable solved = EVariable.New(argtype).Assign(args[i].Solve(lowerScope));
                lowerScope.Set(argname, solved);
            }

            return(Interpreter.Run(program, lowerScope));
        }