Пример #1
0
 public void walk(LuaAST chunk, AutoCompleteData ac) {
     m_ac = ac;
     m_ac.Variables.scope = new Scope();
     m_currentScope = m_ac.Variables.scope;
     m_currentScope.StartPos = chunk.start;
     m_currentScope.EndPos = chunk.end;
     walkChuck(chunk);
 }
Пример #2
0
        void walkBlock(LuaAST block) {
            Scope s = new Scope();
            s.StartPos = block.start;
            s.EndPos = block.end;
            Scope cs = m_currentScope;
            cs.addChild(s);
            m_currentScope = s;
            walkChuck(block);
            m_currentScope = cs;

        }
Пример #3
0
        //purge all variables affected by changes made after pos
        public void purge(int pos)
        {
            m_variables.Clear();
            m_scope = null;
            /*List<string> rm = new List<string>();
            foreach (Variable var in m_variables.Values) {
                if (var.IsStatic) continue;

                if (var.StartPos >= pos)
                {
                    rm.Add(var.Name);
                    continue;
                }
                if (var.EndPos >= pos)
                {
                    rm.Add(var.Name);
                    continue;
                }
            }
            foreach (string name in rm) {
                //System.Diagnostics.Debug.Print(name + " removed");
                m_variables.Remove(name);
            }*/
        }
Пример #4
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;
        }
Пример #5
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;
        }
Пример #6
0
 public void addChild(Scope child)
 {
     Childs.Add(child);
     child.Parent = this;
 }