Exemple #1
0
        void walkFuncionBody(LuaAST st)
        {
            Scope s = new Scope();

            s.StartPos = st.start;
            s.EndPos   = st.end;
            Scope cs = m_currentScope;

            cs.addChild(s);
            m_currentScope = s;
            {
                if (st.Components.ContainsKey("parlist"))
                {
                    if (st.Components["parlist"].Components.ContainsKey("namelist"))
                    {
                        List <LuaVariable> vl = getNamelist(st.Components["parlist"].Components["namelist"]);
                        foreach (LuaVariable var in vl)
                        {
                            Variable v = new Variable(var.Name);
                            v.Type     = m_ac.Types.NullType;
                            v.StartPos = var.StartPos;
                            m_currentScope.addVariable(v);
                        }
                    }
                }

                walkChuck(st.Components["block"]);
            }
            m_currentScope = cs;
        }
Exemple #2
0
        void walkAssignExp(LuaAST assignExp)
        {
            LuaAST varlist = assignExp.Components["varlist"];
            LuaAST explist = assignExp.Components["explist"];

            List <LuaVariable> vl = getVariables(varlist);

            for (int i = 0; i < vl.Count; i++)
            {
                LuaVariable var = vl[i];
                if (var != null)
                {
                    Variable v = new Variable(var.Name);
                    if (i >= explist.ComponentGroup.Count)
                    {
                        continue;
                    }
                    else
                    {
                        v.Type = getExpressionType(explist.ComponentGroup[i]);
                        if (v.Type.InternalName == "(UnknownType)")
                        {
                            continue;
                        }
                    }
                    v.StartPos = var.StartPos;

                    m_currentScope.addVariable(v);
                }
            }
        }
Exemple #3
0
        // Public Methods (6) 

        public void add(Variable var)
        {
            m_variables[var.Name] = var;

            if (m_scope != null)
            {
                m_scope.addVariable(var);
            }
        }
Exemple #4
0
        void walkForExp(LuaAST st)
        {
            Scope s = new Scope();

            s.StartPos = st.start;
            s.EndPos   = st.end;
            Scope cs = m_currentScope;

            cs.addChild(s);
            m_currentScope = s;
            {
                LuaVariable var = getVariable(st.Components["name"]);
                Variable    v   = new Variable(var.Name);
                v.Type     = getExpressionType(st.Components["initExp"]);//m_ac.Types.get("object");
                v.StartPos = var.StartPos;
                m_currentScope.addVariable(v);

                walkChuck(st.Components["block"]);
            }
            m_currentScope = cs;
        }
Exemple #5
0
        void walkFuncionBody(LuaAST st) {
            Scope s = new Scope();
            s.StartPos = st.start;
            s.EndPos = st.end;
            Scope cs = m_currentScope;
            cs.addChild(s);
            m_currentScope = s;
            {
                if(st.Components.ContainsKey("parlist")){
                    if (st.Components["parlist"].Components.ContainsKey("namelist"))
                    {
                        List<LuaVariable> vl = getNamelist(st.Components["parlist"].Components["namelist"]);
                        foreach (LuaVariable var in vl)
                        {
                            Variable v = new Variable(var.Name);
                            v.Type = m_ac.Types.NullType;
                            v.StartPos = var.StartPos;
                            m_currentScope.addVariable(v);
                        }
                    }
                }

                walkChuck(st.Components["block"]);

            }
            m_currentScope = cs;
        }
Exemple #6
0
        void walkForExp(LuaAST st)
        {
            Scope s = new Scope();
            s.StartPos = st.start;
            s.EndPos = st.end;
            Scope cs = m_currentScope;
            cs.addChild(s);
            m_currentScope = s;
            {
                LuaVariable var = getVariable(st.Components["name"]);
                Variable v = new Variable(var.Name);
                v.Type = getExpressionType(st.Components["initExp"]);//m_ac.Types.get("object");
                v.StartPos = var.StartPos;
                m_currentScope.addVariable(v);

                walkChuck(st.Components["block"]);

            }
            m_currentScope = cs;
        }