[206] | 1 | #include "stdafx.h"
|
---|
| 2 |
|
---|
[598] | 3 | using namespace ActiveBasic::Compiler;
|
---|
| 4 |
|
---|
[195] | 5 | Compiler compiler;
|
---|
[193] | 6 |
|
---|
[636] | 7 | Compiler::Compiler()
|
---|
| 8 | : isBuildSuccessful( false )
|
---|
| 9 | , targetModuleType( ActiveBasic::Common::TargetModuleType::Exe )
|
---|
| 10 | , isDebug( false )
|
---|
| 11 | , isUnicode( false )
|
---|
| 12 | , isCore( false )
|
---|
| 13 | , currentRelationalObjectModuleIndexForSource( 0 )
|
---|
| 14 | {
|
---|
| 15 | // 生成先のオブジェクトモジュールを登録
|
---|
| 16 | ObjectModule *pObjectModule = new ObjectModule();
|
---|
| 17 | staticLibraries.push_back( pObjectModule );
|
---|
| 18 | SelectObjectModule( pObjectModule );
|
---|
| 19 |
|
---|
| 20 | namespaceSupporter.RegistAllNamespaceScopesCollection( &GetObjectModule().meta.GetNamespaces() );
|
---|
| 21 |
|
---|
| 22 | Symbol::RegistNamespaceSupporter( &namespaceSupporter );
|
---|
| 23 | }
|
---|
| 24 | Compiler::~Compiler()
|
---|
| 25 | {
|
---|
| 26 | BOOST_FOREACH( ObjectModule *pStaticLibrary, staticLibraries )
|
---|
| 27 | {
|
---|
| 28 | delete pStaticLibrary;
|
---|
| 29 | }
|
---|
| 30 | staticLibraries.clear();
|
---|
| 31 | }
|
---|
| 32 |
|
---|
| 33 | void Compiler::PreStaticLink( const ObjectModules &staticLibraries )
|
---|
| 34 | {
|
---|
| 35 | BOOST_FOREACH( const ObjectModule *pStaticLibrary, staticLibraries )
|
---|
| 36 | {
|
---|
| 37 | // 関連オブジェクトモジュールの名前リスト
|
---|
| 38 | this->GetObjectModule().relationalObjectModuleNames.push_back( pStaticLibrary->GetName() );
|
---|
| 39 | }
|
---|
| 40 | }
|
---|
[270] | 41 | void Compiler::StaticLink( ObjectModules &staticLibraries )
|
---|
| 42 | {
|
---|
| 43 | BOOST_FOREACH( ObjectModule *pStaticLibrary, staticLibraries )
|
---|
| 44 | {
|
---|
[636] | 45 | if( &this->GetObjectModule() == pStaticLibrary )
|
---|
| 46 | {
|
---|
| 47 | // 自分自身の場合はリンクしない
|
---|
| 48 | continue;
|
---|
| 49 | }
|
---|
| 50 |
|
---|
[270] | 51 | // メタ情報
|
---|
[637] | 52 | this->GetObjectModule().StaticLink( *pStaticLibrary, this->IsSll() );
|
---|
[270] | 53 | }
|
---|
| 54 | }
|
---|
| 55 |
|
---|
[632] | 56 | ActiveBasic::Compiler::Error::StringToTypeErrorCode::EnumType Compiler::StringToGenericTypeEx( const std::string &typeName, Type &type )
|
---|
[628] | 57 | {
|
---|
[632] | 58 | // ジェネリッククラスをインスタンス化した型の場合
|
---|
| 59 | int i = 0;
|
---|
| 60 | char className[VN_SIZE];
|
---|
| 61 | GetIdentifierToken( className, typeName.c_str(), i );
|
---|
[193] | 62 |
|
---|
[632] | 63 | // ジェネリクスクラスを取得
|
---|
| 64 | const CClass *pGenericClass = this->GetObjectModule().meta.FindClassSupportedTypeDef(
|
---|
| 65 | LexicalAnalyzer::FullNameToSymbol( className )
|
---|
| 66 | );
|
---|
[290] | 67 |
|
---|
[632] | 68 | if( !pGenericClass )
|
---|
| 69 | {
|
---|
| 70 | return ActiveBasic::Compiler::Error::StringToTypeErrorCode::NotfoundGenericClass;
|
---|
| 71 | }
|
---|
[290] | 72 |
|
---|
[632] | 73 | if( typeName[i] != '<' )
|
---|
[290] | 74 | {
|
---|
[632] | 75 | Jenga::Throw( "StringToType内でジェネリクス構文の解析に失敗" );
|
---|
| 76 | }
|
---|
[290] | 77 |
|
---|
[632] | 78 | GenericTypes genericTypes;
|
---|
| 79 | bool isValueType = false;
|
---|
| 80 | while( true )
|
---|
| 81 | {
|
---|
| 82 | i++;
|
---|
[290] | 83 |
|
---|
[632] | 84 | char typeParameterStr[VN_SIZE];
|
---|
| 85 | GetIdentifierToken( typeParameterStr, typeName.c_str(), i );
|
---|
| 86 |
|
---|
| 87 | // 型パラメータの型情報を取得
|
---|
| 88 | Type typeParameterType;
|
---|
| 89 | StringToType( typeParameterStr, typeParameterType );
|
---|
| 90 |
|
---|
| 91 | genericTypes.push_back( GenericType( "(non support)", typeParameterType ) );
|
---|
| 92 |
|
---|
| 93 | if( typeParameterType.IsValueType() )
|
---|
[301] | 94 | {
|
---|
[632] | 95 | // 値型の場合
|
---|
| 96 | isValueType = true;
|
---|
[301] | 97 | }
|
---|
[290] | 98 |
|
---|
[632] | 99 | if( typeName[i] != ',' )
|
---|
[301] | 100 | {
|
---|
[632] | 101 | break;
|
---|
[301] | 102 | }
|
---|
[632] | 103 | }
|
---|
[301] | 104 |
|
---|
[632] | 105 | // 基本型をセット
|
---|
| 106 | type.SetBasicType( DEF_OBJECT );
|
---|
[290] | 107 |
|
---|
[632] | 108 | if( isValueType )
|
---|
| 109 | {
|
---|
| 110 | // 型パラメータに値型が指定された場合
|
---|
[301] | 111 |
|
---|
[632] | 112 | // 仮型パラメータを実型パラメータに変換
|
---|
| 113 | Types actualTypes;
|
---|
| 114 | BOOST_FOREACH( const GenericType &genericType, genericTypes )
|
---|
| 115 | {
|
---|
| 116 | actualTypes.push_back( genericType.GetType() );
|
---|
| 117 | }
|
---|
[301] | 118 |
|
---|
[632] | 119 | // テンプレートとしてクラスを展開する
|
---|
| 120 | const CClass *pExpandedClass = LexicalAnalyzer::TemplateExpand( *const_cast<CClass *>(pGenericClass), actualTypes );
|
---|
[301] | 121 |
|
---|
[632] | 122 | if( pExpandedClass )
|
---|
| 123 | {
|
---|
| 124 | // 拡張情報をセット
|
---|
| 125 | type.SetClassPtr( pExpandedClass );
|
---|
[301] | 126 | }
|
---|
[632] | 127 | else
|
---|
| 128 | {
|
---|
| 129 | // TODO: 消す
|
---|
| 130 | goto Generic;
|
---|
| 131 | }
|
---|
| 132 | }
|
---|
| 133 | else
|
---|
| 134 | {
|
---|
| 135 | Generic:
|
---|
| 136 | // 型パラメータにクラス型が指定された場合
|
---|
[301] | 137 |
|
---|
[632] | 138 | // ジェネリック クラスとして利用する
|
---|
[290] | 139 |
|
---|
| 140 | // 拡張情報をセット
|
---|
| 141 | type.SetClassPtr( pGenericClass );
|
---|
| 142 | type.SetActualGenericTypes( genericTypes );
|
---|
[632] | 143 | }
|
---|
[290] | 144 |
|
---|
[632] | 145 | return ActiveBasic::Compiler::Error::StringToTypeErrorCode::Successful;
|
---|
| 146 | }
|
---|
| 147 | ActiveBasic::Compiler::Error::StringToTypeErrorCode::EnumType Compiler::StringToTypeEx( const std::string &typeName, Type &type, bool isResolveGenerics )
|
---|
| 148 | {
|
---|
| 149 | type.SetIndex( -1 );
|
---|
| 150 |
|
---|
| 151 |
|
---|
| 152 | /////////////////////////////////////////////////////////
|
---|
| 153 | // ☆★☆ ジェネリクスサポート ☆★☆
|
---|
| 154 |
|
---|
| 155 | if( strstr( typeName.c_str(), "<" ) )
|
---|
| 156 | {
|
---|
| 157 | return StringToGenericTypeEx( typeName, type );
|
---|
[290] | 158 | }
|
---|
| 159 |
|
---|
| 160 | //
|
---|
| 161 | /////////////////////////////////////////////////////////
|
---|
| 162 |
|
---|
| 163 |
|
---|
[193] | 164 | if( typeName[0] == '*' ){
|
---|
| 165 | if( typeName.size() >= 3
|
---|
[575] | 166 | && typeName[1] == 1 && ( typeName[2] == ESC_FUNCTION || typeName[2] == ESC_SUB ) )
|
---|
| 167 | {
|
---|
| 168 | // 関数ポインタを追加する
|
---|
| 169 | {
|
---|
| 170 | DWORD dwProcType = (DWORD)typeName[2];
|
---|
| 171 | const std::string ¶mStr = typeName.substr( 3 );
|
---|
| 172 |
|
---|
| 173 | Procedure::Kind kind = ( dwProcType == ESC_FUNCTION )
|
---|
| 174 | ? Procedure::Function
|
---|
| 175 | : Procedure::Sub;
|
---|
| 176 |
|
---|
| 177 | ProcPointer *pProcPointer = new ProcPointer( kind );
|
---|
| 178 |
|
---|
| 179 | //buffer[0]は'('となっている
|
---|
| 180 | extern int cp;
|
---|
| 181 | ActiveBasic::Compiler::LexicalAnalyzer::SetParamsAndReturnType( pProcPointer, paramStr.c_str(), false, cp );
|
---|
| 182 |
|
---|
| 183 | this->GetObjectModule().meta.GetProcPointers().push_back( pProcPointer );
|
---|
| 184 | }
|
---|
| 185 |
|
---|
| 186 | //関数ポインタ(*Function)
|
---|
| 187 | type.SetBasicType( DEF_PTR_PROC );
|
---|
| 188 | type.SetIndex( this->GetObjectModule().meta.GetProcPointers().size() - 1 );
|
---|
[628] | 189 | return ActiveBasic::Compiler::Error::StringToTypeErrorCode::Successful;
|
---|
[193] | 190 | }
|
---|
| 191 |
|
---|
[523] | 192 | const std::string &nextTypeName = typeName.substr( 1 );
|
---|
[193] | 193 |
|
---|
[628] | 194 | ActiveBasic::Compiler::Error::StringToTypeErrorCode::EnumType result = StringToTypeEx( nextTypeName, type, isResolveGenerics );
|
---|
| 195 | if( result != ActiveBasic::Compiler::Error::StringToTypeErrorCode::Successful )
|
---|
| 196 | {
|
---|
| 197 | return result;
|
---|
[193] | 198 | }
|
---|
| 199 |
|
---|
| 200 | type.PtrLevelUp();
|
---|
| 201 |
|
---|
[628] | 202 | return ActiveBasic::Compiler::Error::StringToTypeErrorCode::Successful;
|
---|
[193] | 203 | }
|
---|
| 204 |
|
---|
| 205 | {
|
---|
| 206 | int basicType;
|
---|
[628] | 207 | if( Type::StringToBasicType( typeName, basicType ) )
|
---|
| 208 | {
|
---|
[193] | 209 | // 基本型だったとき
|
---|
| 210 | type.SetBasicType( basicType );
|
---|
[628] | 211 | return ActiveBasic::Compiler::Error::StringToTypeErrorCode::Successful;
|
---|
[193] | 212 | }
|
---|
| 213 | }
|
---|
| 214 |
|
---|
| 215 | // Object型だったとき
|
---|
[628] | 216 | if( typeName == "Object" )
|
---|
| 217 | {
|
---|
[299] | 218 | type.SetType( DEF_OBJECT, this->GetObjectModule().meta.GetClasses().GetObjectClassPtr() );
|
---|
[628] | 219 | return ActiveBasic::Compiler::Error::StringToTypeErrorCode::Successful;
|
---|
[193] | 220 | }
|
---|
| 221 |
|
---|
| 222 | // String型だったとき
|
---|
[628] | 223 | if( typeName == "String" )
|
---|
| 224 | {
|
---|
[299] | 225 | type.SetType( DEF_OBJECT, this->GetObjectModule().meta.GetClasses().GetStringClassPtr() );
|
---|
[628] | 226 | return ActiveBasic::Compiler::Error::StringToTypeErrorCode::Successful;
|
---|
[193] | 227 | }
|
---|
| 228 |
|
---|
| 229 |
|
---|
| 230 | ////////////////////
|
---|
| 231 | // TypeDefされた型
|
---|
| 232 | ////////////////////
|
---|
[632] | 233 | const TypeDef *pTypeDef = this->GetObjectModule().meta.GetTypeDefs().Find( LexicalAnalyzer::FullNameToSymbol( typeName ) );
|
---|
| 234 | if( pTypeDef )
|
---|
[628] | 235 | {
|
---|
[632] | 236 | type = pTypeDef->GetBaseType();
|
---|
| 237 |
|
---|
| 238 | if( type.IsObject() )
|
---|
| 239 | {
|
---|
| 240 | if( isResolveGenerics && !type.HasActualGenericType() )
|
---|
| 241 | {
|
---|
| 242 | // ジェネリッククラスの場合
|
---|
| 243 | trace( "型解決されていない" );
|
---|
| 244 | return ActiveBasic::Compiler::Error::StringToTypeErrorCode::FailedResolveGenericType;
|
---|
| 245 | }
|
---|
| 246 | }
|
---|
| 247 |
|
---|
[628] | 248 | return ActiveBasic::Compiler::Error::StringToTypeErrorCode::Successful;
|
---|
[193] | 249 | }
|
---|
| 250 |
|
---|
| 251 | //クラス
|
---|
[632] | 252 | const CClass *pobj_c = this->GetObjectModule().meta.FindClassSupportedTypeDef( LexicalAnalyzer::FullNameToSymbol( typeName ) );
|
---|
[628] | 253 | if(pobj_c)
|
---|
| 254 | {
|
---|
| 255 | if( isResolveGenerics )
|
---|
| 256 | {
|
---|
| 257 | if( pobj_c->IsGeneric() )
|
---|
| 258 | {
|
---|
| 259 | // ジェネリッククラスの場合
|
---|
| 260 | trace( "型解決されていない" );
|
---|
| 261 | return ActiveBasic::Compiler::Error::StringToTypeErrorCode::FailedResolveGenericType;
|
---|
| 262 | }
|
---|
| 263 | }
|
---|
| 264 |
|
---|
| 265 | if( pobj_c->IsStructure() )
|
---|
| 266 | {
|
---|
[193] | 267 | type.SetBasicType( DEF_STRUCT );
|
---|
| 268 | }
|
---|
[628] | 269 | else
|
---|
| 270 | {
|
---|
[193] | 271 | type.SetBasicType( DEF_OBJECT );
|
---|
| 272 | }
|
---|
[290] | 273 | type.SetClassPtr( pobj_c );
|
---|
[628] | 274 | return ActiveBasic::Compiler::Error::StringToTypeErrorCode::Successful;
|
---|
[193] | 275 | }
|
---|
| 276 |
|
---|
[290] | 277 |
|
---|
| 278 | /////////////////////////////////////////////////////////
|
---|
| 279 | // ☆★☆ ジェネリクスサポート ☆★☆
|
---|
| 280 |
|
---|
| 281 | // 型パラメータ
|
---|
[536] | 282 | if( this->IsCompilingClass() )
|
---|
[290] | 283 | {
|
---|
| 284 | // クラスに属するメソッドをコンパイルしているとき
|
---|
[536] | 285 | int formalTypeIndex = this->GetCompilingClass().GetFormalGenericTypeParameterIndex( typeName );
|
---|
[299] | 286 | if( formalTypeIndex != -1 )
|
---|
[290] | 287 | {
|
---|
| 288 | // コンパイル中クラスにおけるジェネリクス用の型パラメータのとき
|
---|
| 289 | type.SetBasicType( DEF_TYPE_PARAMETER );
|
---|
[536] | 290 | type.SetClassPtr( &this->GetCompilingClass().GetFormalGenericTypes()[formalTypeIndex].GetType().GetClass() );
|
---|
[299] | 291 | type.SetFormalTypeName( typeName );
|
---|
| 292 | type.SetFormalTypeIndex( formalTypeIndex );
|
---|
[628] | 293 | return ActiveBasic::Compiler::Error::StringToTypeErrorCode::Successful;
|
---|
[290] | 294 | }
|
---|
| 295 | }
|
---|
| 296 |
|
---|
| 297 | //
|
---|
| 298 | /////////////////////////////////////////////////////////
|
---|
| 299 |
|
---|
[628] | 300 | return ActiveBasic::Compiler::Error::StringToTypeErrorCode::NotfoundType;
|
---|
[193] | 301 | }
|
---|
| 302 |
|
---|
[628] | 303 | bool Compiler::StringToType( const std::string &typeName, Type &type )
|
---|
| 304 | {
|
---|
| 305 | return ( StringToTypeEx( typeName, type, false ) == ActiveBasic::Compiler::Error::StringToTypeErrorCode::Successful );
|
---|
| 306 | }
|
---|
| 307 |
|
---|
[523] | 308 | const std::string Compiler::TypeToString( const Type &type )
|
---|
[193] | 309 | {
|
---|
| 310 | if( PTR_LEVEL( type.GetBasicType() ) ){
|
---|
| 311 | //ポインタレベルが1以上の場合
|
---|
| 312 | Type tempType( type );
|
---|
| 313 | tempType.PtrLevelDown();
|
---|
| 314 |
|
---|
[523] | 315 | return (std::string)"*" + TypeToString( tempType );
|
---|
[193] | 316 | }
|
---|
[683] | 317 | else if( type.IsObject() || type.IsStruct() )
|
---|
| 318 | {
|
---|
[193] | 319 | //オブジェクトまたは構造体
|
---|
| 320 |
|
---|
[683] | 321 | if( !( type.GetIndex() == 0 || type.GetIndex() == -1 ) )
|
---|
| 322 | {
|
---|
| 323 | std::string result = type.GetClass().GetName();
|
---|
[193] | 324 | if( type.GetClass().GetNamespaceScopes().size() >= 1 )
|
---|
| 325 | {
|
---|
[683] | 326 | result = type.GetClass().GetNamespaceScopes().ToString()
|
---|
| 327 | + "."
|
---|
| 328 | + result;
|
---|
[193] | 329 | }
|
---|
[683] | 330 |
|
---|
| 331 | if( type.GetClass().IsExpanded() )
|
---|
| 332 | {
|
---|
| 333 | // テンプレート展開済みのクラスの場合
|
---|
| 334 | std::string actualGenericTypesName;
|
---|
| 335 | BOOST_FOREACH( const Type &typeParameter, type.GetClass().expandedClassActualTypeParameters )
|
---|
| 336 | {
|
---|
| 337 | if( actualGenericTypesName.size() )
|
---|
| 338 | {
|
---|
| 339 | actualGenericTypesName += ",";
|
---|
| 340 | }
|
---|
| 341 | actualGenericTypesName += typeParameter.ToString();
|
---|
| 342 | }
|
---|
| 343 |
|
---|
| 344 | result += "<" + actualGenericTypesName + ">";
|
---|
| 345 | }
|
---|
| 346 |
|
---|
| 347 | return result;
|
---|
[193] | 348 | }
|
---|
| 349 | }
|
---|
| 350 | else if( type.IsProcPtr() ){
|
---|
| 351 | if( type.GetIndex() == 0 || type.GetIndex() == -1 ){
|
---|
| 352 | return "VoidPtr";
|
---|
| 353 | }
|
---|
| 354 | else{
|
---|
[299] | 355 | if( this->GetObjectModule().meta.GetProcPointers()[type.GetIndex()]->ReturnType().IsNull() ){
|
---|
[193] | 356 | return "*Sub";
|
---|
| 357 | }
|
---|
| 358 | return "*Function";
|
---|
| 359 | }
|
---|
| 360 | }
|
---|
| 361 | else{
|
---|
| 362 | // 基本型
|
---|
| 363 | const char *lpszTypeName = Type::BasicTypeToCharPtr( type );
|
---|
| 364 | if( lpszTypeName )
|
---|
| 365 | {
|
---|
[523] | 366 | return (const std::string)lpszTypeName;
|
---|
[193] | 367 | }
|
---|
| 368 | }
|
---|
| 369 |
|
---|
[465] | 370 | compiler.errorMessenger.Output(1, NULL, cp);
|
---|
[193] | 371 |
|
---|
[523] | 372 | return (std::string)"(null)";
|
---|
[193] | 373 | }
|
---|
[533] | 374 |
|
---|
[672] | 375 | int Compiler::SizeOf( const Type &type )
|
---|
| 376 | {
|
---|
| 377 | Type tempType( type );
|
---|
| 378 | if( this->IsCompilingClass() )
|
---|
| 379 | {
|
---|
| 380 | if( this->pCompilingClass->IsExpanded() && tempType.IsTypeParameter() )
|
---|
| 381 | {
|
---|
| 382 | // 現在コンパイル中のクラスがテンプレート展開済みのクラスで、
|
---|
| 383 | // 尚且つターゲットとなる型が型パラメータだったとき
|
---|
| 384 |
|
---|
| 385 | // テンプレート展開情報を用いて型解決を行う
|
---|
| 386 | this->pCompilingClass->ResolveExpandedClassActualTypeParameter( tempType );
|
---|
| 387 | }
|
---|
| 388 | }
|
---|
| 389 | return tempType.GetSize();
|
---|
| 390 | }
|
---|
| 391 |
|
---|
[536] | 392 | void Compiler::ClearCompilingUserProcAndClass()
|
---|
| 393 | {
|
---|
| 394 | this->pCompilingUserProc = NULL;
|
---|
| 395 | this->pCompilingClass = NULL;
|
---|
| 396 | }
|
---|
| 397 |
|
---|
| 398 | void Compiler::SetCompilingClass( const CClass *pClass )
|
---|
| 399 | {
|
---|
| 400 | this->pCompilingClass = pClass;
|
---|
| 401 | }
|
---|
| 402 |
|
---|
[537] | 403 | void Compiler::SetCompilingUserProc( const UserProc *pUserProc )
|
---|
[533] | 404 | {
|
---|
[536] | 405 | this->pCompilingUserProc = pUserProc;
|
---|
| 406 |
|
---|
| 407 | this->SetCompilingClass( pUserProc->GetParentClassPtr() );
|
---|
[537] | 408 | }
|
---|
[533] | 409 |
|
---|
[537] | 410 | void Compiler::StartGlobalAreaCompile()
|
---|
| 411 | {
|
---|
| 412 | ClearCompilingUserProcAndClass();
|
---|
| 413 | }
|
---|
| 414 |
|
---|
| 415 | void Compiler::StartProcedureCompile( const UserProc *pUserProc )
|
---|
| 416 | {
|
---|
| 417 | //コンパイル中の関数
|
---|
| 418 | this->SetCompilingUserProc( pUserProc );
|
---|
| 419 |
|
---|
[540] | 420 | if( pUserProc->HasParentClass() )
|
---|
| 421 | {
|
---|
| 422 | // クラスの使用チェック
|
---|
| 423 | pUserProc->GetParentClass().Using();
|
---|
| 424 | }
|
---|
[533] | 425 |
|
---|
| 426 | // コンパイル中の関数が属する名前空間
|
---|
| 427 | this->GetNamespaceSupporter().SetLivingNamespaceScopes( pUserProc->GetNamespaceScopes() );
|
---|
| 428 |
|
---|
| 429 | // コンパイル中の関数でImportsされている名前空間
|
---|
| 430 | this->GetNamespaceSupporter().SetImportedNamespaces( pUserProc->GetImportedNamespaces() );
|
---|
| 431 |
|
---|
| 432 | // コード生成対象を選択
|
---|
| 433 | this->codeGenerator.Select( (const_cast<UserProc *>(pUserProc))->GetNativeCode() );
|
---|
| 434 | }
|
---|
| 435 | void Compiler::FinishProcedureCompile()
|
---|
| 436 | {
|
---|
[536] | 437 | this->pCompilingUserProc = NULL;
|
---|
| 438 | this->pCompilingClass = NULL;
|
---|
[533] | 439 | }
|
---|
[536] | 440 |
|
---|
| 441 | bool Compiler::IsGlobalAreaCompiling()
|
---|
| 442 | {
|
---|
[641] | 443 | if( pCompilingUserProc == NULL )
|
---|
| 444 | {
|
---|
| 445 | return true;
|
---|
| 446 | }
|
---|
| 447 | return ( pCompilingUserProc->GetName() == this->globalAreaProcName );
|
---|
[536] | 448 | }
|
---|
[537] | 449 | bool Compiler::IsLocalAreaCompiling()
|
---|
| 450 | {
|
---|
[641] | 451 | return !IsGlobalAreaCompiling();
|
---|
[537] | 452 | }
|
---|
[536] | 453 | const UserProc &Compiler::GetCompilingUserProc()
|
---|
| 454 | {
|
---|
[641] | 455 | if( pCompilingUserProc == NULL )
|
---|
[536] | 456 | {
|
---|
[641] | 457 | _ASSERTE( false );
|
---|
| 458 | throw;
|
---|
[536] | 459 | }
|
---|
[641] | 460 | return *pCompilingUserProc;
|
---|
[536] | 461 | }
|
---|
| 462 |
|
---|
| 463 | bool Compiler::IsCompilingClass()
|
---|
| 464 | {
|
---|
| 465 | return ( pCompilingClass != NULL );
|
---|
| 466 | }
|
---|
| 467 | const CClass &Compiler::GetCompilingClass()
|
---|
| 468 | {
|
---|
| 469 | if( this->IsCompilingClass() )
|
---|
| 470 | {
|
---|
| 471 | return *pCompilingClass;
|
---|
| 472 | }
|
---|
| 473 |
|
---|
| 474 | throw;
|
---|
| 475 | }
|
---|