FindByName() 공개 메소드

public FindByName ( String s ) : Var
s String
리턴 Var
예제 #1
0
        void addOuter(Var e)
        {
#if DEBUG
            Console.WriteLine("addOuter e=[" + e + "]\n");
#endif

            /*
             * validate this declaration as a potential variable
             */
            if (e.getClassId() == Tok.T_AUTO)
            {
                io.Abort("?Cannot allocate automatic variable outside a function\n");
            }
            if (staticvar.FindByName(e.getName()) != null)
            {
                io.Abort("?Cannot redefine static name '" + e.getName() + "'\n");
            }
            staticvar.add(e);
        }
예제 #2
0
        void addInner(Var e)
        {
            /*
             * validate this declaration as a potential variable
             */
            int id = e.getClassId();

#if DEBUG
            Console.WriteLine("addInner e=[" + e + "]\n");
#endif
            if (id == Tok.T_EXTERN || id == Tok.T_STATIC)
            {
                io.Abort("Cannot allocate static within a method\n");
            }
            if (paramvar.FindByName(e.getName()) != null) /* cannot redefine param name */
            {
                io.Abort("Cannot redefine parameter name '" + e.getName() + "'\n");
            }
            if (localvar.FindByName(e.getName()) != null) /* check not already set */
            {
                io.Abort("Local variable '" + e.getName() + "' already defined\n");
            }
            localvar.add(e);
        }