Esempio n. 1
0
        public LOLMethod(FunctionRef info, LOLProgram prog)
        {
            this.info    = info;
            this.args    = new ArgumentRef[info.Arity + (info.IsVariadic ? 1 : 0)];
            this.program = prog;
            this.locals  = new Scope(prog.globals);

            LocalRef it = new LocalRef("IT");

            locals.AddSymbol(it);
        }
Esempio n. 2
0
        public override void Process(LOLMethod lm, CompilerErrorCollection errors, ILGenerator gen)
        {
            if (operation != null)
            {
                FunctionRef fr = ((operation as AssignmentStatement).rval as FunctionExpression).func;
                if (fr.Arity > 1 || (fr.IsVariadic && fr.Arity != 0))
                {
                    errors.Add(new CompilerError(location.filename, location.startLine, location.startColumn, null, "Function used in loop must take 1 argument"));
                }
            }

            m_breakLabel    = gen.DefineLabel();
            m_continueLabel = gen.DefineLabel();

            lm.breakables.Add(this);
            statements.Process(lm, errors, gen);
            lm.breakables.RemoveAt(lm.breakables.Count - 1);
        }
Esempio n. 3
0
 public void SetOperationFunction(FunctionRef fr)
 {
     (operation as AssignmentStatement).rval = new FunctionExpression(operation.location, fr);
 }
Esempio n. 4
0
 public FunctionExpression(CodePragma loc, FunctionRef fr) : base(loc)
 {
     func = fr;
 }