示例#1
0
            private static int GetArgNumber(AST.VariableDeclNode arg, AST.FunctionDefinitionNode funDef)
            {
                for (int i = 0; i < funDef.Parameters.Count(); i++)
                {
                    if (Object.ReferenceEquals(arg, funDef.Parameters.ElementAt(i)))
                    {
                        return(i);
                    }
                }

                return(-1);
            }
示例#2
0
        // ----- Methods -----

        #region implemented abstract members of Node

        private IEnumerable <VariableDeclNode> GetParameters <TSymbol>(IParseTree <TSymbol> parseTree) where TSymbol : ISymbol <TSymbol>
        {
            var parList = new LinkedList <VariableDeclNode>();
            var childs  = ASTBuilder.ChildrenEnumerator(parseTree);

            while (childs.MoveNext())
            {
                var par = new VariableDeclNode();
                par.BuildNode(childs.Current);
                parList.AddLast(par);
                childs.MoveNext(); // skip ',' if present
            }
            return(parList);
        }
 public VariableUseNode(string name, VariableDeclNode declaration)
 {
     this.Name        = name;
     this.Declaration = declaration;
 }