Esempio n. 1
0
        public virtual CVar call(CVar[] call, VariabelDatabase db, EnegyData data, Posision pos)
        {
            if(func.extraVariabelDatabase != null)
            {
                db = func.extraVariabelDatabase.createShadow();
                if (SetVariabel)
                {
                    for (int i = 0; i < func.agument.size(); i++)
                        db.push(func.agument.get(i).Name, call[i], data);
                }
            }

            CVar r = func.callFunction(call, db, data, pos);
            db.garbageCollector();
            if(func.ReturnType != null)
            {
                //this function is lock to a type :)
                if (r == null)
                    r = new NullVariabel();

                if(!TypeHandler.controlType(r, func.ReturnType))
                {
                    data.setError(new ScriptError("a function '"+func.Name+"' returns can not be convertet to '" + func.ReturnType + "'", pos), db);
                    return new NullVariabel();
                }
            }

            if (r == null)
                return new NullVariabel();

            return r;
        }
Esempio n. 2
0
        public override CVar call(CVar[] call, VariabelDatabase db, EnegyData data, Posision pos)
        {
            if(extraVariabelDatabase != null)
            {
                db = getShadowVariabelDatabase(extraVariabelDatabase);
                if (SetVariabel)
                {
                    for (int i = 0; i < method.Agument.size(); i++)
                        db.push(method.Agument.get(i).Name, call[i], data);
                }
            }

            CVar cache = method.Body(obj, db, call, data, pos);
            db.garbageCollector();
            if(method.ReturnType != null)
            {
                if(!TypeHandler.controlType(cache, method.ReturnType))
                {
                    data.setError(new ScriptError("a method '" + obj.Name + "->"+method.Name+"' returns can not be convertet to '" + method.ReturnType + "'", pos), db);
                    return new NullVariabel();
                }
            }

            return cache;
        }
        public override CVar call(CVar[] call, VariabelDatabase db, EnegyData data, Posision pos)
        {
            CVar cache = method.Body(c, db, call, data, pos);
            db.garbageCollector();

            if (method.ReturnType != null)
            {

                if(!TypeHandler.controlType(cache, method.ReturnType))
                {
                    data.setError(new ScriptError("a static method '" + c.Name + "->" + method.Name + "' returns can not be convertet to '" + method.ReturnType + "'", pos), db);
                    return new NullVariabel();
                }
            }

            return cache;
        }