Changeset 508 in dev for trunk/ab5.0


Ignore:
Timestamp:
Apr 29, 2008, 11:36:37 AM (16 years ago)
Author:
dai_9181
Message:

Symbolコンストラクタを少なくし、LexicalAnalyzer::FullNameToSymbolメソッドを実装。

Location:
trunk/ab5.0/abdev
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/ab5.0/abdev/BasicCompiler_Common/VarList.cpp

    r467 r508  
    77//デバッグ用
    88#include "../BasicCompiler_Common/debug.h"
     9
     10using namespace ActiveBasic::Compiler;
    911
    1012//変数リストのツリーハンドル
     
    445447    //Thisポインタを取得
    446448    LONG_PTR pThis;
    447     const Variable *pVar = pUserProc->GetLocalVars().Find( Symbol( "_System_LocalThis" ) );
     449    const Variable *pVar = pUserProc->GetLocalVars().Find( LexicalAnalyzer::FullNameToSymbol( "_System_LocalThis" ) );
    448450    if( !pVar ){
    449451        return;
  • trunk/ab5.0/abdev/BasicCompiler_Common/VariableOpe.cpp

    r507 r508  
    1212#include "../compiler_x86/opcode.h"
    1313#endif
     14
     15using namespace ActiveBasic::Compiler;
    1416
    1517BOOL IsPtrType(int type){
     
    563565        /////////////////
    564566
    565         pVar = UserProc::CompilingUserProc().GetLocalVars().BackSearch( Symbol( VarName ) );
     567        pVar = UserProc::CompilingUserProc().GetLocalVars().BackSearch( LexicalAnalyzer::FullNameToSymbol( VarName ) );
    566568        if( pVar ){
    567569            goto ok;
     
    614616        GetNowStaticVarFullName(VarName,temporary);
    615617
    616         pVar = compiler.GetObjectModule().meta.GetGlobalVars().Find( Symbol( temporary ) );
     618        pVar = compiler.GetObjectModule().meta.GetGlobalVars().Find( LexicalAnalyzer::FullNameToSymbol( temporary ) );
    617619        if( pVar ){
    618620            goto ok;
     
    643645        sprintf(temp2,"%s.%s",VarName,temporary);
    644646
    645         pVar = compiler.GetObjectModule().meta.GetGlobalVars().Find( Symbol( temp2 ) );
     647        pVar = compiler.GetObjectModule().meta.GetGlobalVars().Find( LexicalAnalyzer::FullNameToSymbol( temp2 ) );
    646648        if( pVar ){
    647649            lstrcpy(member,tempMember);
     
    656658        sprintf(temp2,"%s.%s",compiler.pCompilingClass->GetName().c_str(),VarName);
    657659
    658         pVar = compiler.GetObjectModule().meta.GetGlobalVars().Find( Symbol( temp2 ) );
     660        pVar = compiler.GetObjectModule().meta.GetGlobalVars().Find( LexicalAnalyzer::FullNameToSymbol( temp2 ) );
    659661        if( pVar ){
    660662            goto ok;
     
    667669    ////////////////////
    668670
    669     pVar = compiler.GetObjectModule().meta.GetGlobalVars().BackSearch( Symbol( VarName ) );
     671    pVar = compiler.GetObjectModule().meta.GetGlobalVars().BackSearch( LexicalAnalyzer::FullNameToSymbol( VarName ) );
    670672    if( pVar ){
    671673        goto ok;
     
    941943    /////////////////////////
    942944
    943     if( compiler.GetObjectModule().meta.GetGlobalVars().DuplicateCheck( Symbol( name ) ) ){
     945    if( compiler.GetObjectModule().meta.GetGlobalVars().DuplicateCheck( LexicalAnalyzer::FullNameToSymbol( name ) ) ){
    944946        //2重定義のエラー
    945947        compiler.errorMessenger.Output(15,name,cp);
     
    11671169{
    11681170    char temporary[255];
    1169     if( compiler.GetObjectModule().meta.GetGlobalVars().Find( Symbol( "_DebugSys_dwThreadID" ) ) == NULL )
     1171    if( compiler.GetObjectModule().meta.GetGlobalVars().Find( LexicalAnalyzer::FullNameToSymbol( "_DebugSys_dwThreadID" ) ) == NULL )
    11701172    {
    11711173        // 未定義の場合は定義する
  • trunk/ab5.0/abdev/BasicCompiler_Common/WatchList.cpp

    r485 r508  
    1313//デバッグ用
    1414#include "debug.h"
     15
     16using namespace ActiveBasic::Compiler;
    1517
    1618int Debugging_GetArray( const Subscripts &subscripts,char *array,const Type &type,LONG_PTR *plpOffset);
     
    350352    /////////////////
    351353    if( UserProc::IsLocalAreaCompiling() ){
    352         const Variable *pVar = UserProc::CompilingUserProc().GetLocalVars().Find( Symbol( VarName ) );
     354        const Variable *pVar = UserProc::CompilingUserProc().GetLocalVars().Find( LexicalAnalyzer::FullNameToSymbol( VarName ) );
    353355
    354356        if( pVar ){
     
    436438        ///////////////////
    437439
    438         const Variable *pVar = compiler.GetObjectModule().meta.GetGlobalVars().Find( VarName );
     440        const Variable *pVar = compiler.GetObjectModule().meta.GetGlobalVars().Find( LexicalAnalyzer::FullNameToSymbol( VarName ) );
    439441        if( !pVar ){
    440442            //一致しないとき
  • trunk/ab5.0/abdev/BasicCompiler_Common/gc.cpp

    r485 r508  
    88#include "../compiler_x86/opcode.h"
    99#endif
     10
     11using namespace ActiveBasic::Compiler;
    1012
    1113void InitGCVariables(void){
     
    1921    ///////////////////////////////
    2022
    21     if( compiler.GetObjectModule().meta.GetGlobalVars().Find( Symbol( "_System_gc_StackRoot_StartPtr" ) ) == NULL )
     23    if( compiler.GetObjectModule().meta.GetGlobalVars().Find( LexicalAnalyzer::FullNameToSymbol( "_System_gc_StackRoot_StartPtr" ) ) == NULL )
    2224    {
    2325        // 未定義の場合は定義する
  • trunk/ab5.0/abdev/BasicCompiler_Common/include/Compiler.h

    r507 r508  
    5151        : isBuildSuccessful( false )
    5252        , pObjectModule( new ObjectModule )
    53         , pNowObjectModule( pObjectModule )
    5453        , targetModuleType( Exe )
    5554        , isDebug( false )
     
    5756        , isCore( false )
    5857    {
     58        SelectObjectModule( *pObjectModule );
    5959        Symbol::RegistNamespaceSupporter( &namespaceSupporter );
    6060    }
  • trunk/ab5.0/abdev/BasicCompiler_Common/include/LexicalAnalyzer.h

    r506 r508  
    88public:
    99    static bool CollectNamespaces( const char *source, NamespaceScopesCollection &namespaceScopesCollection );
     10    static Symbol FullNameToSymbol( const char *fullName );
     11    static Symbol FullNameToSymbol( const std::string &fullName );
    1012};
    1113
  • trunk/ab5.0/abdev/BasicCompiler_Common/include/Symbol.h

    r505 r508  
    4747    {
    4848    }
    49     Symbol( const char *fullName );
    50     Symbol( const string &fullName );
    5149    Symbol( const Symbol &symbol )
    5250        : namespaceScopes( symbol.namespaceScopes )
  • trunk/ab5.0/abdev/BasicCompiler_Common/include/Variable.h

    r392 r508  
    5959public:
    6060    Variable( const string &name, const Type &type, bool isConst, bool isRef, const std::string &paramStrForConstructor, bool hasInitData )
    61         : Symbol( name )
     61        : Symbol( ActiveBasic::Compiler::LexicalAnalyzer::FullNameToSymbol( name ) )
    6262        , type( type )
    6363        , isConst( isConst )
  • trunk/ab5.0/abdev/BasicCompiler_Common/src/LexicalAnalyzer.cpp

    r506 r508  
    5353    return isSuccessful;
    5454}
     55
     56Symbol LexicalAnalyzer::FullNameToSymbol( const char *fullName )
     57{
     58    char areaName[VN_SIZE] = "";        //オブジェクト変数
     59    char nestName[VN_SIZE] = "";        //入れ子メンバ
     60    bool isNest = SplitMemberName( fullName, areaName, nestName );
     61
     62    return Symbol( NamespaceScopes( areaName ), nestName );
     63}
     64
     65Symbol LexicalAnalyzer::FullNameToSymbol( const std::string &fullName )
     66{
     67    return FullNameToSymbol( fullName.c_str() );
     68}
  • trunk/ab5.0/abdev/BasicCompiler_Common/src/ObjectModule.cpp

    r507 r508  
    4949
    5050#include <Hashmap.h>
     51#include <Configuration.h>
     52#include <Symbol.h>
     53#include <LexicalAnalyzer.h>
     54#include <Program.h>
    5155#include <Compiler.h>
     56#include <Debugger.h>
    5257
    5358
  • trunk/ab5.0/abdev/BasicCompiler_Common/src/Symbol.cpp

    r504 r508  
    55
    66const NamespaceSupporter *Symbol::namespaceSupporter = NULL;
    7 
    8 Symbol::Symbol( const char *fullName )
    9     : isTargetObjectModule( true )
    10 {
    11     char areaName[VN_SIZE] = "";        //オブジェクト変数
    12     char nestName[VN_SIZE] = "";        //入れ子メンバ
    13     bool isNest = SplitMemberName( fullName, areaName, nestName );
    14 
    15     namespaceScopes = NamespaceScopes( areaName );
    16     name = nestName;
    17 }
    18 Symbol::Symbol( const string &fullName )
    19     : isTargetObjectModule( true )
    20 {
    21     char areaName[VN_SIZE] = "";        //オブジェクト変数
    22     char nestName[VN_SIZE] = "";        //入れ子メンバ
    23     bool isNest = SplitMemberName( fullName.c_str(), areaName, nestName );
    24 
    25     namespaceScopes = NamespaceScopes( areaName );
    26     name = nestName;
    27 }
    287
    298std::string Symbol::GetFullName() const
  • trunk/ab5.0/abdev/ab_common/src/NamespaceSupporter.cpp

    r507 r508  
    55bool NamespaceSupporter::ImportsNamespace( const NamespaceScopes &namespaceScopes )
    66{
     7    _ASSERT( allNamespaceScopesCollection );
    78    if( !allNamespaceScopesCollection->IsExist( namespaceScopes ) ){
    89        return false;
  • trunk/ab5.0/abdev/compiler_x86/Compile_Var.cpp

    r465 r508  
    1313int AllLocalVarSize;
    1414
     15using namespace ActiveBasic::Compiler;
    1516
    1617void SetRelativeOffset( Type &resultType, RELATIVE_VAR *pRelativeVar,const char *lpPtrOffset){
     
    392393        //////////////////
    393394
    394         const Variable *pVar = UserProc::CompilingUserProc().GetLocalVars().BackSearch( Symbol( VarName ) );
     395        const Variable *pVar = UserProc::CompilingUserProc().GetLocalVars().BackSearch( LexicalAnalyzer::FullNameToSymbol( VarName ) );
    395396        if( pVar ){
    396397            //ポインタ変数の場合
     
    519520            GetNowStaticVarFullName(VarName,temporary);
    520521
    521             pVar = compiler.GetObjectModule().meta.GetGlobalVars().Find( Symbol( temporary ) );
     522            pVar = compiler.GetObjectModule().meta.GetGlobalVars().Find( LexicalAnalyzer::FullNameToSymbol( temporary ) );
    522523            if( pVar ){
    523524                goto GlobalOk;
     
    550551            char temp2[VN_SIZE];
    551552            sprintf(temp2,"%s.%s",VarName,temporary);
    552             pVar = compiler.GetObjectModule().meta.GetGlobalVars().Find( Symbol( temp2 ) );
     553            pVar = compiler.GetObjectModule().meta.GetGlobalVars().Find( LexicalAnalyzer::FullNameToSymbol( temp2 ) );
    553554            if( pVar ){
    554555                lstrcpy(member,tempMember);
     
    562563            char temp2[VN_SIZE];
    563564            sprintf(temp2,"%s.%s",compiler.pCompilingClass->GetName().c_str(),VarName);
    564             pVar = compiler.GetObjectModule().meta.GetGlobalVars().Find( Symbol( temp2 ) );
     565            pVar = compiler.GetObjectModule().meta.GetGlobalVars().Find( LexicalAnalyzer::FullNameToSymbol( temp2 ) );
    565566            if( pVar ){
    566567                goto GlobalOk;
     
    572573        /////////////////////
    573574
    574         pVar = compiler.GetObjectModule().meta.GetGlobalVars().BackSearch( Symbol( VarName ) );
     575        pVar = compiler.GetObjectModule().meta.GetGlobalVars().BackSearch( LexicalAnalyzer::FullNameToSymbol( VarName ) );
    575576        if( pVar ){
    576577            goto GlobalOk;
     
    11031104        /////////////////
    11041105
    1105         if( UserProc::CompilingUserProc().GetLocalVars().DuplicateCheck( Symbol( VarName ) ) ){
     1106        if( UserProc::CompilingUserProc().GetLocalVars().DuplicateCheck( LexicalAnalyzer::FullNameToSymbol( VarName ) ) ){
    11061107            //2重定義のエラー
    11071108            compiler.errorMessenger.Output(15,VarName,cp);
  • trunk/ab5.0/abdev/compiler_x86/stdafx.h

    r507 r508  
    4242#include <Hashmap.h>
    4343#include <Configuration.h>
     44#include <Symbol.h>
     45#include <LexicalAnalyzer.h>
    4446#include <Program.h>
    4547#include <Compiler.h>
    4648#include <Debugger.h>
    47 #include <LexicalAnalyzer.h>
Note: See TracChangeset for help on using the changeset viewer.