#include "stdafx.h" #include #include #include /* TODO: 消す bool Variable::IsEqualSymbol( const Symbol &symbol, bool isSupportStaticMember ) const { if( GetName() == symbol.GetName() && compiler.GetNamespaceSupporter().IsSameAreaNamespace( this->GetNamespaceScopes(), symbol.GetNamespaceScopes() ) ) { return true; } if( isSupportStaticMember && symbol.GetNamespaceScopes().size() >= 1 ) { // 静的メンバを考慮 NamespaceScopes namespaceScopes( symbol.GetNamespaceScopes() ); string name = namespaceScopes[namespaceScopes.size()-1] + "." + symbol.GetName(); namespaceScopes.pop_back(); return IsEqualSymbol( Symbol( namespaceScopes, name ), false ); } return false; }*/ bool Variables::DuplicateCheck( const Symbol &symbol ) const { //レキシカルスコープを考慮して重複判定 for( int i=(int)this->size()-1; i>=0 ; i-- ){ Variable &var = *(*this)[i]; if( var.bLiving //現在のスコープで有効なもの && var.GetScopeLevel() == compiler.codeGenerator.lexicalScopes.GetNowLevel() //現在のスコープと同一レベル ) { if( var.IsEqualSymbol( symbol ) ){ return true; } } } return false; } const Variable *Variables::BackSearch( const Symbol &symbol ) const { //レキシカルスコープを考慮してバックサーチ for( int i=(int)this->size()-1; i>=0 ; i-- ){ Variable &var = *(*this)[i]; if( var.bLiving //現在のスコープで有効なもの && var.GetScopeLevel() <= compiler.codeGenerator.lexicalScopes.GetNowLevel() //現在のスコープレベルを超さないもの(Returnによる解放処理中を考慮) ){ if( var.IsEqualSymbol( symbol ) ){ return &var; } } } return NULL; } const Variable *Variables::Find( const Symbol &symbol )const { int max = (int)this->size(); for( int i=0; iIsEqualSymbol( symbol ) ){ return pVar; } } return NULL; }