Changeset 364 in dev
- Timestamp:
- Nov 11, 2007, 3:12:06 PM (17 years ago)
- Location:
- trunk/abdev
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler32/Opcode.h
r350 r364 188 188 189 189 private: 190 bool EvaluateOverloadScore( int level, const Parameters &targetParms, const Type &targetResultType );190 bool EvaluateOverloadScore( int level, const Parameters &targetParms, const Type &targetResultType, bool &isErrored ); 191 191 public: 192 192 const UserProc *_OverloadSolution( const char *name, std::vector<const UserProc *> &subs, bool isEnabledReturnType = false ); -
trunk/abdev/BasicCompiler32/commandvalue.h
r118 r364 94 94 #define COM_ABSTRACT 0x11B2 95 95 #define COM_NAMESPACE 0x11B3 96 #define COM_TRY 0x11B4 96 97 97 98 //ウィンドウ制御 -
trunk/abdev/BasicCompiler64/Compile_ProcOp.cpp
r358 r364 148 148 // グローバル領域をコンパイル 149 149 //////////////////////////////////////// 150 151 UserProc::pGlobalProc = &userProc; 150 152 151 153 const UserProc *pBackUserProc = &UserProc::CompilingUserProc(); -
trunk/abdev/BasicCompiler64/Opcode.h
r350 r364 287 287 288 288 private: 289 bool EvaluateOverloadScore( int level, const Parameters &targetParms, const Type &targetResultType );289 bool EvaluateOverloadScore( int level, const Parameters &targetParms, const Type &targetResultType, bool &isErrored ); 290 290 291 291 public: -
trunk/abdev/BasicCompiler_Common/ParamImpl.cpp
r353 r364 107 107 } 108 108 109 bool ParamImpl::EvaluateOverloadScore( int level, const Parameters &targetParms, const Type &targetResultType ){109 bool ParamImpl::EvaluateOverloadScore( int level, const Parameters &targetParms, const Type &targetResultType, bool &isErrored ){ 110 110 //パラメータを識別してオーバーロードを解決 111 112 isErrored = false; 111 113 112 114 //パラメータの個数が不一致の場合 … … 137 139 Type nullParam( DEF_NON ); 138 140 139 NumOpe_GetType(Parms[i],141 if( !NumOpe_GetType(Parms[i], 140 142 ( level <= OVERLOAD_LEVEL3 )? nullParam : param, 141 argType); 143 argType) ) 144 { 145 isErrored = true; 146 return false; 147 } 142 148 } 143 149 else{ … … 206 212 const UserProc *pUserProc = NULL; 207 213 208 for( int level=OVERLOAD_MIN_LEVEL; level<=OVERLOAD_MAX_LEVEL; level++ ){ 209 210 BOOST_FOREACH( const UserProc *pTempUserProc, subs ){ 211 212 if(EvaluateOverloadScore( level, pTempUserProc->Params(), isEnabledReturnType?pTempUserProc->ReturnType():Type() )){ 214 for( int level=OVERLOAD_MIN_LEVEL; level<=OVERLOAD_MAX_LEVEL; level++ ) 215 { 216 BOOST_FOREACH( const UserProc *pTempUserProc, subs ) 217 { 218 bool isErrored = false; 219 bool isHit = false; 220 isHit = EvaluateOverloadScore( level, pTempUserProc->Params(), isEnabledReturnType?pTempUserProc->ReturnType():Type(), isErrored ); 221 if( isErrored ) 222 { 223 // 照合中にエラーが起きた場合 224 return NULL; 225 } 226 227 if( isHit ) 228 { 213 229 trace_for_overload( "レベル" << level << " ○適合..." << pTempUserProc->_paramStr ); 214 230 … … 216 232 if( isEnabledReturnType ){ 217 233 SetError(52,name,cp); 234 return NULL; 218 235 } 219 236 else{ … … 238 255 239 256 if( !pUserProc ){ 240 BOOST_FOREACH( const UserProc *pTempUserProc, subs ) {241 257 BOOST_FOREACH( const UserProc *pTempUserProc, subs ) 258 { 242 259 //エラーチェック 243 if(pTempUserProc->Params().size()==this->ParmsNum){ 244 if( pUserProc ){ 260 if(pTempUserProc->Params().size()==this->ParmsNum) 261 { 262 if( pUserProc ) 263 { 245 264 SetError(52,name,cp); 265 return NULL; 246 266 } 247 267 -
trunk/abdev/BasicCompiler_Common/include/CodeGenerator.h
r357 r364 99 99 public: 100 100 enum SCOPE_TYPE{ 101 // ベース101 // ベース 102 102 SCOPE_TYPE_BASE, 103 103 104 // 分岐104 // 分岐 105 105 SCOPE_TYPE_IF, 106 106 107 // ループ107 // ループ 108 108 SCOPE_TYPE_DO, 109 109 SCOPE_TYPE_FOR, 110 110 SCOPE_TYPE_WHILE, 111 111 112 // ケース分け112 // ケース分け 113 113 SCOPE_TYPE_SELECT, 114 115 // 例外処理 116 SCOPE_TRY, 117 SCOPE_CATCH, 118 SCOPE_FINALLY, 114 119 }; 115 120 -
trunk/abdev/BasicCompiler_Common/include/Procedure.h
r353 r364 382 382 static const UserProc *pCompilingUserProc; 383 383 public: 384 static const UserProc *pGlobalProc; 384 385 static void CompileStartForGlobalArea(){ 385 386 pCompilingUserProc = NULL; -
trunk/abdev/BasicCompiler_Common/include/ver.h
r363 r364 6 6 // バージョン付加文字列 7 7 #ifdef _AMD64_ 8 #define VER_INFO "(x64) (rev.37 4)"8 #define VER_INFO "(x64) (rev.375)" 9 9 #else 10 #define VER_INFO "(rev.37 4)"10 #define VER_INFO "(rev.375)" 11 11 #endif -
trunk/abdev/BasicCompiler_Common/src/Exception.cpp
r361 r364 103 103 void Try() 104 104 { 105 // レキシカルスコープをレベルアップ 106 compiler.codeGenerator.lexicalScopes.Start( 107 compiler.codeGenerator.GetNativeCodeSize(), 108 LexicalScope::SCOPE_TRY 109 ); 105 110 } 106 111 … … 113 118 } 114 119 120 if( catchScopes.size() ) 121 { 122 // 既に1回以上のCatchが存在するとき 123 124 // レキシカルスコープをレベルダウン 125 compiler.codeGenerator.lexicalScopes.End(); 126 } 127 115 128 JmpFinally(); 116 129 117 130 catchScopes.push_back( CatchScope( paramType, compiler.codeGenerator.GetNativeCodeSize() ) ); 131 132 // レキシカルスコープをレベルアップ 133 compiler.codeGenerator.lexicalScopes.Start( 134 compiler.codeGenerator.GetNativeCodeSize(), 135 LexicalScope::SCOPE_CATCH 136 ); 118 137 } 119 138 void Finally() … … 125 144 } 126 145 146 if( catchScopes.size() ) 147 { 148 // 既に1回以上のCatchが存在するとき 149 150 // レキシカルスコープをレベルダウン 151 compiler.codeGenerator.lexicalScopes.End(); 152 } 153 127 154 isDefinedFinally = true; 128 155 129 156 ResolveJmpFinally(); 157 158 // レキシカルスコープをレベルアップ 159 compiler.codeGenerator.lexicalScopes.Start( 160 compiler.codeGenerator.GetNativeCodeSize(), 161 LexicalScope::SCOPE_FINALLY 162 ); 130 163 } 131 164 … … 136 169 Finally(); 137 170 } 171 172 if( catchScopes.size() || isDefinedFinally ) 173 { 174 // 既に1回以上のCatch、またはFinallyが存在するとき 175 176 // レキシカルスコープをレベルダウン 177 compiler.codeGenerator.lexicalScopes.End(); 178 } 179 180 // レキシカルスコープをレベルダウン 181 compiler.codeGenerator.lexicalScopes.End(); 138 182 } 139 183 … … 174 218 175 219 // Catchアドレス 176 compiler.GetObjectModule().dataTable.schedules.push_back( Schedule( &UserProc::CompilingUserProc(), dataTableOffset + pos ) ); 220 const UserProc *pUserProc = &UserProc::CompilingUserProc(); 221 if( UserProc::IsGlobalAreaCompiling() ) 222 { 223 pUserProc = UserProc::pGlobalProc; 224 } 225 compiler.GetObjectModule().dataTable.schedules.push_back( Schedule( pUserProc, dataTableOffset + pos ) ); 177 226 compiler.GetObjectModule().dataTable.schedules.back().SpecifyCatchAddress(); 178 227 pos += sizeof(LONG_PTR); … … 188 237 void TryCommand() 189 238 { 190 if( UserProc::IsGlobalAreaCompiling() )191 {192 SetError();193 }194 195 239 tryScopes.push_back( TryScope() ); 196 240 tryScopes.back().Try(); … … 213 257 } 214 258 259 char varName[VN_SIZE]; 215 260 Type paramType; 216 261 if( parameter[0] ) 217 262 { 218 char varName[VN_SIZE],typeName[VN_SIZE];263 char typeName[VN_SIZE]; 219 264 SplitSyntacticForAs( parameter, varName, typeName ); 220 265 if( !typeName[0] ) … … 232 277 233 278 tryScopes.back().Catch( paramType ); 279 280 if( paramType.IsObject() ) 281 { 282 int backCp = cp; 283 284 char temporary[1024]; 285 sprintf( temporary, "Dim %s = Thread.CurrentThread().__GetThrowintParamObject() As %s", varName, paramType.GetClass().GetFullName().c_str() ); 286 MakeMiddleCode( temporary ); 287 ChangeOpcode( temporary ); 288 lstrcpy( temporary, "Thread.CurrentThread().__Catched()" ); 289 MakeMiddleCode( temporary ); 290 ChangeOpcode( temporary ); 291 292 cp = backCp; 293 } 234 294 } 235 295 void FinallyCommand() -
trunk/abdev/BasicCompiler_Common/src/NativeCode.cpp
r357 r364 43 43 if( scheduleType == Schedule::CatchAddress ) 44 44 { 45 PutCatchAddressSchedule( &UserProc::CompilingUserProc(), l ); 45 const UserProc *pUserProc = &UserProc::CompilingUserProc(); 46 if( UserProc::IsGlobalAreaCompiling() ) 47 { 48 pUserProc = UserProc::pGlobalProc; 49 } 50 PutCatchAddressSchedule( pUserProc, l ); 46 51 } 47 52 else -
trunk/abdev/BasicCompiler_Common/src/Procedure.cpp
r353 r364 434 434 435 435 const UserProc *UserProc::pCompilingUserProc = NULL; 436 const UserProc *UserProc::pGlobalProc = NULL; 436 437 437 438 -
trunk/abdev/ProjectEditor/Common.h
r350 r364 66 66 #define APPLICATION_NAME "ActiveBasic 5.0" 67 67 #define VERSION_APPLI_NAME APPLICATION_NAME 68 #define VERSION_STRING "5.00.00 (rev.3 56)"68 #define VERSION_STRING "5.00.00 (rev.375)" 69 69 70 70 #endif -
trunk/abdev/ProjectEditor/EndPairCommandComplement.cpp
r118 r364 75 75 if(lstrcmpi(temporary,"Select")==0) return COM_SELECT; 76 76 if(lstrcmpi(temporary,"Sub")==0) return COM_SUB; 77 if(lstrcmpi(temporary,"Try")==0) return COM_TRY; 77 78 if(lstrcmpi(temporary,"Type")==0) return COM_TYPE; 78 79 if(lstrcmpi(temporary,"While")==0) return COM_WHILE; … … 150 151 lstrcpy(buffer,"End Sub"); 151 152 break; 153 case COM_TRY: 154 lstrcpy(buffer,"End Try"); 155 break; 152 156 case COM_TYPE: 153 157 lstrcpy(buffer,"End Type"); … … 317 321 ComplementWndInfo.pMemberInfo[1].dwProc=0; 318 322 ComplementWndInfo.pMemberInfo[1].dwAccess=ACCESS_PAIRCOMMAND; 323 } 324 else if(CmdId==COM_TRY){ 325 ComplementWndInfo.pMemberInfo=(MEMBERINFO *)HeapAlloc(hHeap,0,sizeof(MEMBERINFO)*4); 326 ComplementWndInfo.MemberNum=3; 327 328 ComplementWndInfo.pMemberInfo[0].pName=(char *)HeapAlloc(hHeap,0,10); 329 lstrcpy(ComplementWndInfo.pMemberInfo[0].pName,"End Try"); 330 ComplementWndInfo.pMemberInfo[0].dwProc=0; 331 ComplementWndInfo.pMemberInfo[0].dwAccess=ACCESS_PAIRCOMMAND; 332 333 ComplementWndInfo.pMemberInfo[1].pName=(char *)HeapAlloc(hHeap,0,10); 334 lstrcpy(ComplementWndInfo.pMemberInfo[1].pName,"Catch"); 335 ComplementWndInfo.pMemberInfo[1].dwProc=0; 336 ComplementWndInfo.pMemberInfo[1].dwAccess=ACCESS_PAIRCOMMAND; 337 338 ComplementWndInfo.pMemberInfo[2].pName=(char *)HeapAlloc(hHeap,0,8); 339 lstrcpy(ComplementWndInfo.pMemberInfo[2].pName,"Finally"); 340 ComplementWndInfo.pMemberInfo[2].dwProc=0; 341 ComplementWndInfo.pMemberInfo[2].dwAccess=ACCESS_PAIRCOMMAND; 319 342 } 320 343 else{ -
trunk/abdev/ProjectEditor/SubOperation.cpp
r350 r364 439 439 case COM_SELECT: 440 440 case COM_SUB: 441 case COM_TRY: 441 442 case COM_TYPE: 442 443 case COM_TYPEDEF: … … 465 466 } 466 467 else if(str[0]=='c'||str[0]=='C'){ 468 if(lstrcmpi(str,"Catch")==0) return -1; 467 469 if(lstrcmpi(str,"Case")==0) return -1; 468 470 if(lstrcmp(str,"Char")==0) return -1; … … 508 510 if(lstrcmp(str,"False")==0) return -1; 509 511 if(lstrcmpi(str,"Field")==0) return COM_FIELD; 512 if(lstrcmpi(str,"Finally")==0) return -1; 510 513 if(lstrcmpi(str,"For")==0) return COM_FOR; 511 514 if(lstrcmpi(str,"Function")==0) return COM_FUNCTION; … … 583 586 if(lstrcmpi(str,"Then")==0) return -1; 584 587 if(lstrcmpi(str,"This")==0) return -1; 588 if(lstrcmpi(str,"Throw")==0) return -1; 585 589 if(lstrcmp(str,"True")==0) return -1; 590 if(lstrcmp(str,"Try")==0) return COM_TRY; 586 591 if(lstrcmpi(str,"Type")==0) return COM_TYPE; 587 592 if(lstrcmpi(str,"TypeDef")==0) return COM_TYPEDEF; -
trunk/abdev/ProjectEditor/TextEditor_KeyEvent.cpp
r118 r364 82 82 lstrcmpi(temporary,"Private")==0|| 83 83 lstrcmpi(temporary,"Protected")==0|| 84 lstrcmpi(temporary,"Public")==0 84 lstrcmpi(temporary,"Public")==0|| 85 86 lstrcmpi(temporary,"Try")==0|| 87 lstrcmpi(temporary,"Catch")==0|| 88 lstrcmpi(temporary,"Finally")==0 85 89 ) return 1; 86 90 else if(lstrcmpi(temporary,"Select")==0) return 2; … … 135 139 lstrcmpi(temporary,"Private")==0|| 136 140 lstrcmpi(temporary,"Protected")==0|| 137 lstrcmpi(temporary,"Public")==0 141 lstrcmpi(temporary,"Public")==0|| 142 143 lstrcmpi(temporary,"Catch")==0|| 144 lstrcmpi(temporary,"Finally")==0 138 145 ) return 1; 139 146 else if(lstrcmpi(temporary,"EndSelect")==0) return 2; … … 816 823 if( 817 824 pobj_nv->BackNum_PairStatementComplement&& 818 (nVirtualKey=='c'||nVirtualKey=='C'|| //Case 825 (nVirtualKey=='c'||nVirtualKey=='C'|| //Case、Catch 819 826 nVirtualKey=='e'||nVirtualKey=='E'|| //End ~ 827 nVirtualKey=='f'||nVirtualKey=='F'|| //Finally 820 828 nVirtualKey=='l'||nVirtualKey=='L'|| //Loop 821 829 nVirtualKey=='n'||nVirtualKey=='N'|| //Next
Note:
See TracChangeset
for help on using the changeset viewer.