Esempio n. 1
0
        private void checkout(AstNode theNode)
        {
            foreach (AstNode node in theNode.Children)
            {
                if (node is BinOpNode)
                {
                    BinOpNode bnode = ((BinOpNode)node);
                    if (((BinOpNode)node).BinOp == BinaryOperation.Assignment)
                    {
                        if (!result.Symbols.Contains(bnode.Left.ToString()))
                        {
                            result.Symbols.Add(bnode.Left.ToString());
                        }
                    }
                }
                else
                {
                    checkout(node);
                }
            }

            foreach (AstNode node in theNode.Children)
            {
                if (node is FuncNode)
                {
                    FuncNode fnode = ((FuncNode)node);
                    currentLocalScope = new LocalScope();
                    result.ChildScopes[fnode.Name] = currentLocalScope;
                    currentLocalScope.Symbols.AddRange(fnode.Parameters);
                    analyseLocalCode(fnode.Body);
                }
            }
        }
Esempio n. 2
0
        private void checkout(AstNode theNode)
        {
            foreach(AstNode node in theNode.Children)
                if (node is BinOpNode)
                {
                    BinOpNode bnode = ((BinOpNode)node);
                    if (((BinOpNode)node).BinOp == BinaryOperation.Assignment)
                    {
                        if (!result.Symbols.Contains(bnode.Left.ToString()))
                        {
                            result.Symbols.Add(bnode.Left.ToString());
                        }
                    }
                }
                else
                    checkout(node);

            foreach(AstNode node in theNode.Children)
                if (node is FuncNode)
                {
                    FuncNode fnode = ((FuncNode)node);
                    currentLocalScope = new LocalScope();
                    result.ChildScopes[fnode.Name] = currentLocalScope;
                    currentLocalScope.Symbols.AddRange(fnode.Parameters);
                    analyseLocalCode(fnode.Body);
                }
        }
Esempio n. 3
0
 public HassiumFunction(Interpreter interpreter, FuncNode funcNode, LocalScope localScope)
 {
     this.interpreter = interpreter;
     this.funcNode    = funcNode;
     this.localScope  = localScope;
 }
Esempio n. 4
0
 public HassiumFunction(Interpreter interpreter, FuncNode funcNode, LocalScope localScope)
 {
     this.interpreter = interpreter;
     this.funcNode = funcNode;
     this.localScope = localScope;
 }
Esempio n. 5
0
 public StackFrame(LocalScope scope)
 {
     this.Scope  = scope;
     this.Locals = new Dictionary <string, object>();
 }
Esempio n. 6
0
 public StackFrame(LocalScope scope)
 {
     this.Scope = scope;
     this.Locals = new Dictionary<string, object>();
 }