Index: /trunk/ab5.0/abdev/BasicCompiler_Common/Compile.cpp
===================================================================
--- /trunk/ab5.0/abdev/BasicCompiler_Common/Compile.cpp	(revision 536)
+++ /trunk/ab5.0/abdev/BasicCompiler_Common/Compile.cpp	(revision 537)
@@ -242,5 +242,5 @@
 
 			case ESC_TYPEDEF:
-				if( UserProc::IsLocalAreaCompiling() ){
+				if( compiler.IsLocalAreaCompiling() ){
 					// ローカル領域をコンパイルしているとき
 					compiler.errorMessenger.Output(65,"TypeDef",cp );
@@ -251,5 +251,5 @@
 
 			case ESC_DELEGATE:
-				if( UserProc::IsLocalAreaCompiling() ){
+				if( compiler.IsLocalAreaCompiling() ){
 					// ローカル領域をコンパイルしているとき
 					compiler.errorMessenger.Output(65,"Delegate",cp );
@@ -335,5 +335,5 @@
 				break;
 			case ESC_DECLARE:
-				if( UserProc::IsLocalAreaCompiling() ){
+				if( compiler.IsLocalAreaCompiling() ){
 					// ローカル領域をコンパイルしているとき
 					compiler.errorMessenger.Output(65,"Declare",cp );
Index: /trunk/ab5.0/abdev/BasicCompiler_Common/NumOpe_GetType.cpp
===================================================================
--- /trunk/ab5.0/abdev/BasicCompiler_Common/NumOpe_GetType.cpp	(revision 536)
+++ /trunk/ab5.0/abdev/BasicCompiler_Common/NumOpe_GetType.cpp	(revision 537)
@@ -751,7 +751,7 @@
 								// Blittable型のときは基本型として扱う
 								// ※ただし、コンパイル中のメソッドがBlittable型クラスに属していないこと
-								if( UserProc::IsLocalAreaCompiling()
-									&& UserProc::CompilingUserProc().HasParentClass()
-									&& UserProc::CompilingUserProc().GetParentClass().IsBlittableType() )
+								if( compiler.IsLocalAreaCompiling()
+									&& compiler.GetCompilingUserProc().HasParentClass()
+									&& compiler.GetCompilingUserProc().GetParentClass().IsBlittableType() )
 								{
 									// コンパイル中のメソッドがBlittable型クラスに属している
Index: /trunk/ab5.0/abdev/BasicCompiler_Common/VarList.cpp
===================================================================
--- /trunk/ab5.0/abdev/BasicCompiler_Common/VarList.cpp	(revision 536)
+++ /trunk/ab5.0/abdev/BasicCompiler_Common/VarList.cpp	(revision 537)
@@ -779,5 +779,4 @@
 		if(pUserProc){
 			compiler.StartProcedureCompile( pUserProc );
-			UserProc::CompileStartForUserProc( pUserProc );
 		}
 	}
Index: /trunk/ab5.0/abdev/BasicCompiler_Common/VariableOpe.cpp
===================================================================
--- /trunk/ab5.0/abdev/BasicCompiler_Common/VariableOpe.cpp	(revision 536)
+++ /trunk/ab5.0/abdev/BasicCompiler_Common/VariableOpe.cpp	(revision 537)
@@ -560,10 +560,10 @@
 	const Variable *pVar = NULL;
 
-	if( UserProc::IsLocalAreaCompiling() ){
+	if( compiler.IsLocalAreaCompiling() ){
 		/////////////////
 		// ローカル変数
 		/////////////////
 
-		pVar = UserProc::CompilingUserProc().GetLocalVars().BackSearch( LexicalAnalyzer::FullNameToSymbol( VarName ) );
+		pVar = compiler.GetCompilingUserProc().GetLocalVars().BackSearch( LexicalAnalyzer::FullNameToSymbol( VarName ) );
 		if( pVar ){
 			goto ok;
@@ -613,5 +613,5 @@
 
 	char temporary[VN_SIZE];
-	if( UserProc::IsLocalAreaCompiling() ){
+	if( compiler.IsLocalAreaCompiling() ){
 		GetNowStaticVarFullName(VarName,temporary);
 
@@ -905,10 +905,10 @@
 
 BOOL GetNowStaticVarFullName(char *VarName,char *FullName){
-	if( UserProc::IsGlobalAreaCompiling() ){
+	if( compiler.IsGlobalAreaCompiling() ){
 		// グローバル領域をコンパイル中のとき
 		return 0;
 	}
 
-	const UserProc &proc = UserProc::CompilingUserProc();
+	const UserProc &proc = compiler.GetCompilingUserProc();
 
 	//Static識別
@@ -1082,7 +1082,7 @@
 			// Blittable型のときは基本型として扱う
 			// ※ただし、コンパイル中のメソッドがBlittable型クラスに属していないこと
-			if( UserProc::IsLocalAreaCompiling()
-				&& UserProc::CompilingUserProc().HasParentClass()
-				&& UserProc::CompilingUserProc().GetParentClass().IsBlittableType() )
+			if( compiler.IsLocalAreaCompiling()
+				&& compiler.GetCompilingUserProc().HasParentClass()
+				&& compiler.GetCompilingUserProc().GetParentClass().IsBlittableType() )
 			{
 				// コンパイル中のメソッドがBlittable型クラスに属している
@@ -1094,6 +1094,8 @@
 	}
 
-	if(dwFlags&DIMFLAG_STATIC){
-		if( UserProc::IsGlobalAreaCompiling() ){
+	if(dwFlags&DIMFLAG_STATIC)
+	{
+		if( compiler.IsGlobalAreaCompiling() )
+		{
 			compiler.errorMessenger.Output(60,NULL,cp);
 			return;
Index: /trunk/ab5.0/abdev/BasicCompiler_Common/WatchList.cpp
===================================================================
--- /trunk/ab5.0/abdev/BasicCompiler_Common/WatchList.cpp	(revision 536)
+++ /trunk/ab5.0/abdev/BasicCompiler_Common/WatchList.cpp	(revision 537)
@@ -351,6 +351,6 @@
 	// ローカル変数
 	/////////////////
-	if( UserProc::IsLocalAreaCompiling() ){
-		const Variable *pVar = UserProc::CompilingUserProc().GetLocalVars().Find( LexicalAnalyzer::FullNameToSymbol( VarName ) );
+	if( compiler.IsLocalAreaCompiling() ){
+		const Variable *pVar = compiler.GetCompilingUserProc().GetLocalVars().Find( LexicalAnalyzer::FullNameToSymbol( VarName ) );
 
 		if( pVar ){
Index: /trunk/ab5.0/abdev/BasicCompiler_Common/include/Compiler.h
===================================================================
--- /trunk/ab5.0/abdev/BasicCompiler_Common/include/Compiler.h	(revision 536)
+++ /trunk/ab5.0/abdev/BasicCompiler_Common/include/Compiler.h	(revision 537)
@@ -192,9 +192,13 @@
 
 	void ClearCompilingUserProcAndClass();
+	void StartGlobalAreaCompile();
+	void FinishGlobalAreaCompile();
 	void SetCompilingClass( const CClass *pClass );
+	void SetCompilingUserProc( const UserProc *pUserProc );
 	void StartProcedureCompile( const UserProc *pUserProc );
 	void FinishProcedureCompile();
 
 	bool IsGlobalAreaCompiling();
+	bool IsLocalAreaCompiling();
 	const UserProc &GetCompilingUserProc();
 	bool IsCompilingClass();
Index: /trunk/ab5.0/abdev/BasicCompiler_Common/include/Procedure.h
===================================================================
--- /trunk/ab5.0/abdev/BasicCompiler_Common/include/Procedure.h	(revision 536)
+++ /trunk/ab5.0/abdev/BasicCompiler_Common/include/Procedure.h	(revision 537)
@@ -371,27 +371,5 @@
 
 
-
-	/////////////////////////////////////////////////////////////////
-	// コンパイル中の関数を管理
-	/////////////////////////////////////////////////////////////////
-private:
-	static const UserProc *pCompilingUserProc;
-public:
 	static const UserProc *pGlobalProc;
-	static void CompileStartForGlobalArea(){
-		pCompilingUserProc = NULL;
-	}
-	static void CompileStartForUserProc( const UserProc *pUserProc ){
-		pCompilingUserProc = pUserProc;
-	}
-	static bool IsGlobalAreaCompiling(){
-		return ( pCompilingUserProc == NULL );
-	}
-	static bool IsLocalAreaCompiling(){
-		return ( pCompilingUserProc != NULL );
-	}
-	static const UserProc &CompilingUserProc(){
-		return *pCompilingUserProc;
-	}
 };
 
Index: /trunk/ab5.0/abdev/BasicCompiler_Common/src/Compiler.cpp
===================================================================
--- /trunk/ab5.0/abdev/BasicCompiler_Common/src/Compiler.cpp	(revision 536)
+++ /trunk/ab5.0/abdev/BasicCompiler_Common/src/Compiler.cpp	(revision 537)
@@ -222,18 +222,24 @@
 }
 
+void Compiler::SetCompilingUserProc( const UserProc *pUserProc )
+{
+	this->pCompilingUserProc = pUserProc;
+
+	this->SetCompilingClass( pUserProc->GetParentClassPtr() );
+}
+
+void Compiler::StartGlobalAreaCompile()
+{
+	ClearCompilingUserProcAndClass();
+}
+
 void Compiler::StartProcedureCompile( const UserProc *pUserProc )
 {
 	//コンパイル中の関数
-	this->pCompilingUserProc = pUserProc;
-
-	//コンパイル中の関数が属するクラス
-	this->SetCompilingClass( pUserProc->GetParentClassPtr() );
+	this->SetCompilingUserProc( pUserProc );
 
 	//コンパイルスタートをクラス管理クラスに追加
 	this->GetObjectModule().meta.GetClasses().StartCompile( pUserProc );
 
-	//コンパイル中の関数
-	UserProc::CompileStartForUserProc( pUserProc );
-
 	// コンパイル中の関数が属する名前空間
 	this->GetNamespaceSupporter().SetLivingNamespaceScopes( pUserProc->GetNamespaceScopes() );
@@ -255,4 +261,8 @@
 	return ( pCompilingUserProc == NULL );
 }
+bool Compiler::IsLocalAreaCompiling()
+{
+	return ( pCompilingUserProc != NULL );
+}
 const UserProc &Compiler::GetCompilingUserProc()
 {
Index: /trunk/ab5.0/abdev/BasicCompiler_Common/src/Exception.cpp
===================================================================
--- /trunk/ab5.0/abdev/BasicCompiler_Common/src/Exception.cpp	(revision 536)
+++ /trunk/ab5.0/abdev/BasicCompiler_Common/src/Exception.cpp	(revision 537)
@@ -222,6 +222,6 @@
 
 			// Catchアドレス
-			const UserProc *pUserProc = &UserProc::CompilingUserProc();
-			if( UserProc::IsGlobalAreaCompiling() )
+			const UserProc *pUserProc = &compiler.GetCompilingUserProc();
+			if( compiler.IsGlobalAreaCompiling() )
 			{
 				pUserProc = UserProc::pGlobalProc;
Index: /trunk/ab5.0/abdev/BasicCompiler_Common/src/LexicalScope.cpp
===================================================================
--- /trunk/ab5.0/abdev/BasicCompiler_Common/src/LexicalScope.cpp	(revision 536)
+++ /trunk/ab5.0/abdev/BasicCompiler_Common/src/LexicalScope.cpp	(revision 537)
@@ -71,7 +71,7 @@
 	CallDestructorsOfScopeEnd();
 
-	Variables *pVars = UserProc::IsGlobalAreaCompiling() ?
+	Variables *pVars = compiler.IsGlobalAreaCompiling() ?
 		&compiler.GetObjectModule().meta.GetGlobalVars() :
-		&UserProc::CompilingUserProc().GetLocalVars();
+		&compiler.GetCompilingUserProc().GetLocalVars();
 
 	//使用済みローカル変数の生存チェックを外す
@@ -98,7 +98,7 @@
 void LexicalScopes::CallDestructorsOfScopeEnd(){
 
-	Variables *pVariabls = UserProc::IsGlobalAreaCompiling() ?
+	Variables *pVariabls = compiler.IsGlobalAreaCompiling() ?
 		&compiler.GetObjectModule().meta.GetGlobalVars() :
-		&UserProc::CompilingUserProc().GetLocalVars();
+		&compiler.GetCompilingUserProc().GetLocalVars();
 
 
@@ -109,5 +109,5 @@
 		Variable *pVar = (*pVariabls)[i3];
 
-		if( UserProc::IsGlobalAreaCompiling() && GetNowLevel() == 0 ){
+		if( compiler.IsGlobalAreaCompiling() && GetNowLevel() == 0 ){
 			if( pVar->GetName() == "_System_GC" ){
 				indexSystemGC=i3;
@@ -152,5 +152,5 @@
 
 
-			if( UserProc::IsGlobalAreaCompiling() ){
+			if( compiler.IsGlobalAreaCompiling() ){
 				//ここには来ないハズ
 				compiler.errorMessenger.Output(300,NULL,cp);
Index: /trunk/ab5.0/abdev/BasicCompiler_Common/src/NativeCode.cpp
===================================================================
--- /trunk/ab5.0/abdev/BasicCompiler_Common/src/NativeCode.cpp	(revision 536)
+++ /trunk/ab5.0/abdev/BasicCompiler_Common/src/NativeCode.cpp	(revision 537)
@@ -85,6 +85,6 @@
 	if( scheduleType == Schedule::CatchAddress )
 	{
-		const UserProc *pUserProc = &UserProc::CompilingUserProc();
-		if( UserProc::IsGlobalAreaCompiling() )
+		const UserProc *pUserProc = &compiler.GetCompilingUserProc();
+		if( compiler.IsGlobalAreaCompiling() )
 		{
 			pUserProc = UserProc::pGlobalProc;
Index: /trunk/ab5.0/abdev/BasicCompiler_Common/src/Procedure.cpp
===================================================================
--- /trunk/ab5.0/abdev/BasicCompiler_Common/src/Procedure.cpp	(revision 536)
+++ /trunk/ab5.0/abdev/BasicCompiler_Common/src/Procedure.cpp	(revision 537)
@@ -483,5 +483,4 @@
 }
 
-const UserProc *UserProc::pCompilingUserProc = NULL;
 const UserProc *UserProc::pGlobalProc = NULL;
 
Index: /trunk/ab5.0/abdev/compiler_x86/Compile_Func.cpp
===================================================================
--- /trunk/ab5.0/abdev/compiler_x86/Compile_Func.cpp	(revision 536)
+++ /trunk/ab5.0/abdev/compiler_x86/Compile_Func.cpp	(revision 537)
@@ -614,5 +614,5 @@
 	}
 
-	resultType = UserProc::CompilingUserProc().ReturnType();
+	resultType = compiler.GetCompilingUserProc().ReturnType();
 }
 void Opcode_Func_System_Get_Bp()
Index: /trunk/ab5.0/abdev/compiler_x86/Compile_ProcOp.cpp
===================================================================
--- /trunk/ab5.0/abdev/compiler_x86/Compile_ProcOp.cpp	(revision 536)
+++ /trunk/ab5.0/abdev/compiler_x86/Compile_ProcOp.cpp	(revision 537)
@@ -32,6 +32,6 @@
 
 		const UserProc *pBackUserProc;
-		pBackUserProc = &UserProc::CompilingUserProc();
-		UserProc::CompileStartForGlobalArea();
+		pBackUserProc = &compiler.GetCompilingUserProc();
+		compiler.StartGlobalAreaCompile();
 
 		int BackCp;
@@ -57,5 +57,5 @@
 		GetGlobalDataForDll();
 
-		UserProc::CompileStartForUserProc( pBackUserProc );
+		compiler.SetCompilingUserProc( pBackUserProc );
 		cp=BackCp;
 
@@ -89,10 +89,10 @@
 
 		const UserProc *pBackUserProc;
-		pBackUserProc = &UserProc::CompilingUserProc();
-		UserProc::CompileStartForGlobalArea();
+		pBackUserProc = &compiler.GetCompilingUserProc();
+		compiler.StartGlobalAreaCompile();
 
 		compiler.codeGenerator.lexicalScopes.CallDestructorsOfScopeEnd();
 
-		UserProc::CompileStartForUserProc( pBackUserProc );
+		compiler.SetCompilingUserProc( pBackUserProc );
 
 
@@ -225,6 +225,6 @@
 		UserProc::pGlobalProc = &userProc;
 
-		const UserProc *pBackUserProc = &UserProc::CompilingUserProc();
-		UserProc::CompileStartForGlobalArea();
+		const UserProc *pBackUserProc = &compiler.GetCompilingUserProc();
+		compiler.StartGlobalAreaCompile();
 
 		int BackCp = cp;
@@ -250,5 +250,5 @@
 		}
 
-		UserProc::CompileStartForUserProc( pBackUserProc );
+		compiler.SetCompilingUserProc( pBackUserProc );
 		cp=BackCp;
 	}
Index: /trunk/ab5.0/abdev/compiler_x86/Compile_Statement.cpp
===================================================================
--- /trunk/ab5.0/abdev/compiler_x86/Compile_Statement.cpp	(revision 536)
+++ /trunk/ab5.0/abdev/compiler_x86/Compile_Statement.cpp	(revision 537)
@@ -893,5 +893,5 @@
 
 void OpcodeExitSub(void){
-	if( UserProc::IsGlobalAreaCompiling() ){
+	if( compiler.IsGlobalAreaCompiling() ){
 		compiler.errorMessenger.Output(12,"Exit Sub/Function",cp);
 		return;
@@ -1231,5 +1231,5 @@
 }
 void OpcodeReturn(char *Parameter){
-	if( UserProc::IsGlobalAreaCompiling() ){
+	if( compiler.IsGlobalAreaCompiling() ){
 		//Gosub～Returnとして扱う
 
@@ -1240,5 +1240,5 @@
 		//戻り値をセット
 		if(Parameter[0]){
-			const UserProc &proc = UserProc::CompilingUserProc();
+			const UserProc &proc = compiler.GetCompilingUserProc();
 
 			const char *temp = "_System_ReturnValue";
Index: /trunk/ab5.0/abdev/compiler_x86/Compile_Var.cpp
===================================================================
--- /trunk/ab5.0/abdev/compiler_x86/Compile_Var.cpp	(revision 536)
+++ /trunk/ab5.0/abdev/compiler_x86/Compile_Var.cpp	(revision 537)
@@ -388,10 +388,10 @@
 
 
-	if( UserProc::IsLocalAreaCompiling() ){
+	if( compiler.IsLocalAreaCompiling() ){
 		//////////////////
 		// ローカル変数
 		//////////////////
 
-		const Variable *pVar = UserProc::CompilingUserProc().GetLocalVars().BackSearch( LexicalAnalyzer::FullNameToSymbol( VarName ) );
+		const Variable *pVar = compiler.GetCompilingUserProc().GetLocalVars().BackSearch( LexicalAnalyzer::FullNameToSymbol( VarName ) );
 		if( pVar ){
 			//ポインタ変数の場合
@@ -517,5 +517,5 @@
 
 		char temporary[VN_SIZE];
-		if( UserProc::IsLocalAreaCompiling() ){
+		if( compiler.IsLocalAreaCompiling() ){
 			GetNowStaticVarFullName(VarName,temporary);
 
@@ -1092,5 +1092,5 @@
 
 void dim( char *VarName, const Subscripts &subscripts, const Type &type,const char *InitBuf,const char *ConstractParameter,DWORD dwFlags){
-	if( UserProc::IsGlobalAreaCompiling() ){
+	if( compiler.IsGlobalAreaCompiling() ){
 		/////////////////////////
 		// グローバル変数
@@ -1104,5 +1104,5 @@
 		/////////////////
 
-		if( UserProc::CompilingUserProc().GetLocalVars().DuplicateCheck( LexicalAnalyzer::FullNameToSymbol( VarName ) ) ){
+		if( compiler.GetCompilingUserProc().GetLocalVars().DuplicateCheck( LexicalAnalyzer::FullNameToSymbol( VarName ) ) ){
 			//２重定義のエラー
 			compiler.errorMessenger.Output(15,VarName,cp);
@@ -1128,5 +1128,5 @@
 
 		// 変数を追加
-		UserProc::CompilingUserProc().GetLocalVars().push_back( pVar );
+		compiler.GetCompilingUserProc().GetLocalVars().push_back( pVar );
 
 		//アラインメントを考慮
@@ -1145,5 +1145,5 @@
 				// 呼び出し側のオフセットズレを考慮する
 
-				if( 0 == ( UserProc::CompilingUserProc().RealParams().GetMemorySize() + PTR_SIZE /* ret分 */ ) % alignment ){
+				if( 0 == ( compiler.GetCompilingUserProc().RealParams().GetMemorySize() + PTR_SIZE /* ret分 */ ) % alignment ){
 					AllLocalVarSize += PTR_SIZE;
 				}
Index: /trunk/ab5.0/abdev/compiler_x86/MakePeHdr.cpp
===================================================================
--- /trunk/ab5.0/abdev/compiler_x86/MakePeHdr.cpp	(revision 536)
+++ /trunk/ab5.0/abdev/compiler_x86/MakePeHdr.cpp	(revision 537)
@@ -365,5 +365,5 @@
 
 	cp=-1;
-	UserProc::CompileStartForGlobalArea();
+	compiler.StartGlobalAreaCompile();
 
 	if( !compiler.IsDll() ){
