compiler/LexTest/AST.cpp
//search for variable in the current Scope

search for variable in the current Scope
search for variable in the current Scope
bool ID_Node::searchScope(Scope* scope,char *name,Variable*& locate)
{
	if (!scope->Local.empty())
	{
		std::list<Variable*>::const_iterator i=scope->Local.begin();
		while (i!=scope->Local.end())
		{
			Variable*u=(Variable*)*i;
			if(strcmp (u->name,name)==0)
			{
				locate=u;
				return true;
			}
			i++;
		}
	}
	if (!(scope->parent=='\0'))
		searchScope(scope->parent,name,locate);
	else return false;
}
bool ID_Node :: searchScope ( Scope * scope , char * name , Variable * & locate ) { if ( ! scope -> Local . empty ( ) ) { std :: list < Variable * > :: const_iterator i = scope -> Local . begin ( ) ; while ( i != scope -> Local . end ( ) ) { Variable * u = ( Variable * ) * i ; if ( strcmp ( u -> name , name ) == 0 ) { locate = u ; return true ; } i ++ ; } } if ( ! ( scope -> parent == ' \0 ' ) ) searchScope ( scope -> parent , name , locate ) ; else return false ; }
search for variable in the current Scope
search for variable in the current Scope