Symbol* SymScope::insert( const char* name, Symbol * s ) { pair<ScopeTableType::iterator,bool> iret; typedef pair<const char*,Symbol*> hpair; iret = m_scopetable.insert( hpair(name,s) ); if( iret.second == true ) { //insert was successfull //update the offset and size if (as_param) { // Inserts at positive values s->m_offset = m_paramsize; m_paramsize += s->get_size(); } else { // Inserts at negative values m_localsize += s->get_size(); s->m_offset = -m_localsize; } //set the scope s->m_symscope = this; return NULL; } else { //cannot insert, there was a duplicate entry //return a pointer to the conflicting symbol return iret.first->second; } }
Symbol* SymScope::insert( char* name, Symbol * s ) { pair<ScopeTableType::iterator,bool> iret; typedef pair<char*,Symbol*> hpair; iret = m_scopetable.insert( hpair(name,s) ); if( iret.second == true ) { //insert was successfull return NULL; } else { //cannot insert, there was a duplicate entry //return a pointer to the conflicting symbol return iret.first->second; } }