Index: trunk/ab5.0/abdev/compiler_x64/CodeGenerator.cpp
===================================================================
--- trunk/ab5.0/abdev/compiler_x64/CodeGenerator.cpp	(revision 529)
+++ trunk/ab5.0/abdev/compiler_x64/CodeGenerator.cpp	(revision 584)
@@ -128,5 +128,5 @@
 		}
 
-		pNativeCode->PutEx( disp, scheduleType );
+		this->PutWithSchedule( disp, scheduleType );
 	}
 
@@ -182,5 +182,5 @@
 		pPertialSchedule = pertialSchedules.back();
 	}
-	pNativeCode->PutEx( i32data, scheduleType );
+	this->PutWithSchedule( i32data, scheduleType );
 
 	return pPertialSchedule;
@@ -264,5 +264,5 @@
 			pPertialSchedule = pertialSchedules.back();
 		}
-		pNativeCode->PutEx( offset, scheduleType );
+		this->PutWithSchedule( offset, scheduleType );
 	}
 	else{
@@ -337,5 +337,5 @@
 			pPertialSchedule = pertialSchedules.back();
 		}
-		pNativeCode->PutEx( offset, scheduleType );
+		this->PutWithSchedule( offset, scheduleType );
 	}
 	else{
@@ -662,5 +662,5 @@
 		pPertialSchedule = pertialSchedules.back();
 	}
-	pNativeCode->PutEx( offset, scheduleType );
+	this->PutWithSchedule( offset, scheduleType );
 
 	return pPertialSchedule;
Index: trunk/ab5.0/abdev/compiler_x64/Compile_Calc.cpp
===================================================================
--- trunk/ab5.0/abdev/compiler_x64/Compile_Calc.cpp	(revision 529)
+++ trunk/ab5.0/abdev/compiler_x64/Compile_Calc.cpp	(revision 584)
@@ -93,6 +93,6 @@
 			}
 			else{
-				if( compiler.GetObjectModule().meta.GetGlobalConsts().IsExist(variable)
-					|| compiler.GetObjectModule().meta.GetGlobalConstMacros().IsExist(variable) )
+				if( compiler.GetObjectModule().meta.GetGlobalConsts().IsExistDuplicationKeyName(variable)
+					|| compiler.GetObjectModule().meta.GetGlobalConstMacros().IsExistDuplicationKeyName(variable) )
 				{
 					//定数リストに該当したとき
Index: trunk/ab5.0/abdev/compiler_x64/Compile_CallProc.cpp
===================================================================
--- trunk/ab5.0/abdev/compiler_x64/Compile_CallProc.cpp	(revision 529)
+++ trunk/ab5.0/abdev/compiler_x64/Compile_CallProc.cpp	(revision 584)
@@ -121,5 +121,5 @@
 			{
 				//クラスメンバ関数内から基底クラスの呼び出し
-				pobj_c=&compiler.pCompilingClass->GetSuperClass();
+				pobj_c=&compiler.GetCompilingClass().GetSuperClass();
 
 				isFixedClass = true;
@@ -140,5 +140,5 @@
 				if( !pobj_c )
 				{
-					pobj_c=compiler.GetObjectModule().meta.GetClasses().Find(ObjectName);
+					pobj_c = compiler.GetObjectModule().meta.FindClassSupportedTypeDef( ObjectName );
 					if( pobj_c ){
 						isStatic = true;
@@ -155,9 +155,9 @@
 
 				//New演算子によるコンストラクタ呼び出し
-				pobj_c=pUserProc->GetParentClassPtr();
+				pobj_c = pUserProc->GetParentClassPtr();
 			}
 			else{
 				//クラスメンバ関数内から同一クラスのメンバ関数の呼び出し
-				pobj_c=compiler.pCompilingClass;
+				pobj_c = &compiler.GetCompilingClass();
 			}
 		}
@@ -188,18 +188,23 @@
 		if(ObjectName[0]){
 			//外部からの呼び出し
-			if(pobj_c==compiler.pCompilingClass){
+			if( compiler.IsCompilingClass() && pobj_c == &compiler.GetCompilingClass() )
+			{
 				//同一クラスオブジェクトの場合はプライベートアクセスを容認する
-				if( pMethod->IsNoneAccess() ){
+				if( pMethod->IsNoneAccess() )
+				{
 					compiler.errorMessenger.Output(109,pUserProc->GetName(),cp);
 					return false;
 				}
 			}
-			else{
+			else
+			{
 				if( pMethod->IsPrivate()
-					|| pMethod->IsNoneAccess() ){
+					|| pMethod->IsNoneAccess() )
+				{
 					compiler.errorMessenger.Output(109,pUserProc->GetName(),cp);
 					return false;
 				}
-				if( !pMethod->GetUserProc().GetParentClass().IsEqualsOrSubClass( pobj_c ) && pMethod->IsProtected() ){
+				if( !pMethod->GetUserProc().GetParentClass().IsEqualsOrSubClass( pobj_c ) && pMethod->IsProtected() )
+				{
 					compiler.errorMessenger.Output(110,pUserProc->GetName(),cp);
 					return false;
Index: trunk/ab5.0/abdev/compiler_x64/Compile_Func.cpp
===================================================================
--- trunk/ab5.0/abdev/compiler_x64/Compile_Func.cpp	(revision 529)
+++ trunk/ab5.0/abdev/compiler_x64/Compile_Func.cpp	(revision 584)
@@ -120,5 +120,5 @@
 			SetThisPtrToReg(REG_RCX);
 
-			pobj_c=compiler.pCompilingClass;
+			pobj_c = &compiler.GetCompilingClass();
 		}
 
@@ -295,5 +295,5 @@
 	{
 		// 左辺でデリゲートを要求されているとき
-		const Delegate *pTempDelegate = &baseType.GetClass().GetDelegate();
+		const Delegate *pTempDelegate = &compiler.GetObjectModule().meta.ToDelegate( baseType.GetClass() );
 		pBaseParams = &pTempDelegate->Params();
 		pBaseReturnType = &pTempDelegate->ReturnType();
@@ -474,8 +474,8 @@
 		}
 
-		Opcode_CallDelegate( compiler.pCompilingClass->GetDelegate(), methodPtrParamStr, objPtrValueStr, paramsStr + i );
-	}
-
-	resultType = UserProc::CompilingUserProc().ReturnType();
+		Opcode_CallDelegate( compiler.GetObjectModule().meta.ToDelegate( compiler.GetCompilingClass() ), methodPtrParamStr, objPtrValueStr, paramsStr + i );
+	}
+
+	resultType = compiler.GetCompilingUserProc().ReturnType();
 }
 
Index: trunk/ab5.0/abdev/compiler_x64/Compile_ProcOp.cpp
===================================================================
--- trunk/ab5.0/abdev/compiler_x64/Compile_ProcOp.cpp	(revision 529)
+++ trunk/ab5.0/abdev/compiler_x64/Compile_ProcOp.cpp	(revision 584)
@@ -27,6 +27,7 @@
 		}
 
-		const UserProc *pBackUserProc = &UserProc::CompilingUserProc();
-		UserProc::CompileStartForGlobalArea();
+		const UserProc *pBackUserProc;
+		pBackUserProc = &compiler.GetCompilingUserProc();
+		compiler.StartGlobalAreaCompile();
 
 		int BackCp;
@@ -51,5 +52,7 @@
 
 		//クラスに属する静的メンバを定義
-		compiler.GetObjectModule().meta.GetClasses().InitStaticMember();
+		ActiveBasic::Compiler::ProcedureGenerator::Generate_InitStaticMember(
+			compiler.GetObjectModule().meta.GetClasses()
+		);
 
 		GetGlobalDataForDll();
@@ -61,5 +64,5 @@
 		compiler.codeGenerator.opfix( pStackFramePertialSchedule, pobj_sf->GetFrameSize(0) );
 
-		UserProc::CompileStartForUserProc( pBackUserProc );
+		compiler.SetCompilingUserProc( pBackUserProc );
 		cp=BackCp;
 
@@ -103,11 +106,11 @@
 		compiler.codeGenerator.op_sub_rsp(0x8);
 
-
-		const UserProc *pBackUserProc = &UserProc::CompilingUserProc();
-		UserProc::CompileStartForGlobalArea();
+		const UserProc *pBackUserProc;
+		pBackUserProc = &compiler.GetCompilingUserProc();
+		compiler.StartGlobalAreaCompile();
 
 		compiler.codeGenerator.lexicalScopes.CallDestructorsOfScopeEnd();
 
-		UserProc::CompileStartForUserProc( pBackUserProc );
+		compiler.SetCompilingUserProc( pBackUserProc );
 
 
@@ -127,5 +130,7 @@
 		&& userProc.GetParentClass().GetName() == "_System_TypeBase" )
 	{
-		compiler.GetObjectModule().meta.GetClasses().Compile_System_InitializeUserTypes();
+		ActiveBasic::Compiler::ProcedureGenerator::Generate_System_InitializeUserTypes(
+			compiler.GetObjectModule().meta.GetClasses()
+		);
 	}
 	else if( userProc.GetName() == "InitializeUserTypesForBaseType"
@@ -133,5 +138,7 @@
 		&& userProc.GetParentClass().GetName() == "_System_TypeBase" )
 	{
-		compiler.GetObjectModule().meta.GetClasses().Compile_System_InitializeUserTypesForBaseType();
+		ActiveBasic::Compiler::ProcedureGenerator::Generate_System_InitializeUserTypesForBaseType(
+			compiler.GetObjectModule().meta.GetClasses()
+		);
 	}
 	else if( userProc.GetName() == "RegisterGlobalRoots"
@@ -148,6 +155,6 @@
 		UserProc::pGlobalProc = &userProc;
 
-		const UserProc *pBackUserProc = &UserProc::CompilingUserProc();
-		UserProc::CompileStartForGlobalArea();
+		const UserProc *pBackUserProc = &compiler.GetCompilingUserProc();
+		compiler.StartGlobalAreaCompile();
 
 		int BackCp = cp;
@@ -155,5 +162,7 @@
 
 		//クラスに属する静的メンバを定義
-		compiler.GetObjectModule().meta.GetClasses().InitStaticMember();
+		ActiveBasic::Compiler::ProcedureGenerator::Generate_InitStaticMember(
+			compiler.GetObjectModule().meta.GetClasses()
+		);
 
 		//グローバル実行領域をコンパイル開始
@@ -173,5 +182,5 @@
 		}
 
-		UserProc::CompileStartForUserProc( pBackUserProc );
+		compiler.SetCompilingUserProc( pBackUserProc );
 		cp=BackCp;
 	}
@@ -227,21 +236,5 @@
 	else bDebugSupportProc=0;
 
-	//コンパイル中の関数が属するクラス
-	compiler.pCompilingClass=pUserProc->GetParentClassPtr();
-
-	//コンパイルスタートをクラス管理クラスに追加
-	compiler.GetObjectModule().meta.GetClasses().StartCompile( pUserProc );
-
-	//コンパイル中の関数
-	UserProc::CompileStartForUserProc( pUserProc );
-
-	// コンパイル中の関数が属する名前空間
-	compiler.GetNamespaceSupporter().SetLivingNamespaceScopes( pUserProc->GetNamespaceScopes() );
-
-	// コンパイル中の関数でImportsされている名前空間
-	compiler.GetNamespaceSupporter().SetImportedNamespaces( pUserProc->GetImportedNamespaces() );
-
-	// コード生成対象を選択
-	compiler.codeGenerator.Select( (const_cast<UserProc *>(pUserProc))->GetNativeCode() );
+	compiler.StartProcedureCompile( pUserProc );
 
 	if(pUserProc->IsSystem()){
@@ -290,10 +283,4 @@
 	WithInfo.num=0;
 
-	//重複エラー情報管理のメモリを確保
-	extern char **SynonymErrorWords;
-	extern int SynonymErrorNum;
-	SynonymErrorNum=0;
-	SynonymErrorWords=(char **)HeapAlloc(hHeap,0,1);
-
 	//Continueアドレスを初期化
 	compiler.codeGenerator.ClearContinueArea();
@@ -315,5 +302,12 @@
 		Parameter &param = *pUserProc->RealParams()[i3];
 
-		Variable *pVar = new Variable( param.GetVarName(), param, false, param.IsRef(), "", false );
+		Variable *pVar = new Variable(
+			ActiveBasic::Compiler::LexicalAnalyzer::FullNameToSymbol( param.GetVarName().c_str() ),
+			param,
+			false,
+			param.IsRef(),
+			"",
+			false
+		);
 
 		if( param.IsArray() ){
@@ -463,6 +457,6 @@
 	}
 
-	if(compiler.pCompilingClass){
-		if( pUserProc->GetName() == compiler.pCompilingClass->GetName() ){
+	if( compiler.IsCompilingClass() ){
+		if( pUserProc->GetName() == compiler.GetCompilingClass().GetName() ){
 			////////////////////////////////////
 			// コンストラクタをコンパイルするとき
@@ -470,11 +464,11 @@
 
 			//コンストラクタのコンパイル開始を通知
-			compiler.pCompilingClass->NotifyStartConstructorCompile();
+			compiler.GetCompilingClass().NotifyStartConstructorCompile();
 
 			//基底クラスかどうかの識別
 			//（継承元がインターフェイスの場合も基底クラスと見なす）
 			BOOL bThisIsSuperClass;
-			if( !compiler.pCompilingClass->HasSuperClass() ) bThisIsSuperClass=1;
-			else if( compiler.pCompilingClass->GetSuperClass().GetConstructorMethod() == NULL ){
+			if( !compiler.GetCompilingClass().HasSuperClass() ) bThisIsSuperClass=1;
+			else if( compiler.GetCompilingClass().GetSuperClass().GetConstructorMethod() == NULL ){
 				//インターフェイスを継承したときはコンストラクタを持たない
 				bThisIsSuperClass=1;
@@ -495,5 +489,5 @@
 					temporary[i4]=basbuf[i3];
 				}
-				if( compiler.pCompilingClass->GetSuperClass().GetName() == temporary ){
+				if( compiler.GetCompilingClass().GetSuperClass().GetName() == temporary ){
 					//基底クラスのコンストラクタを呼び出す
 					cp=i3;
@@ -512,6 +506,6 @@
 					Type dummyType;
 					CallProc( PROC_DEFAULT
-						, &compiler.pCompilingClass->GetSuperClass().GetConstructorMethod()->GetUserProc()
-						, compiler.pCompilingClass->GetSuperClass().GetConstructorMethod()->GetUserProc().GetName().c_str()
+						, &compiler.GetCompilingClass().GetSuperClass().GetConstructorMethod()->GetUserProc()
+						, compiler.GetCompilingClass().GetSuperClass().GetConstructorMethod()->GetUserProc().GetName().c_str()
 						, temporary
 						, Type()		// baseTypeはなし
@@ -522,5 +516,5 @@
 					//基底クラスのコンストラクタを暗黙的に呼び出す
 					Opcode_CallProc("",
-						&compiler.pCompilingClass->GetSuperClass().GetConstructorMethod()->GetUserProc(),
+						&compiler.GetCompilingClass().GetSuperClass().GetConstructorMethod()->GetUserProc(),
 						0,
 						"");
@@ -532,5 +526,5 @@
 
 			//デストラクタのコンパイル開始を通知
-			compiler.pCompilingClass->NotifyStartDestructorCompile();
+			compiler.GetCompilingClass().NotifyStartDestructorCompile();
 		}
 	}
@@ -558,11 +552,11 @@
 	//////////////////////////////////////////
 
-	if( compiler.pCompilingClass ){
-
-		if( compiler.pCompilingClass->IsCompilingConstructor() ){
+	if( compiler.IsCompilingClass() ){
+
+		if( compiler.GetCompilingClass().IsCompilingConstructor() ){
 			// コンストラクタをコンパイルしていたとき
 
 			// コンストラクタのコンパイルが完了したことを通知
-			compiler.pCompilingClass->NotifyFinishConstructorCompile();
+			compiler.GetCompilingClass().NotifyFinishConstructorCompile();
 		}
 		else if( pUserProc->IsDestructor() ){
@@ -572,11 +566,11 @@
 
 			// デストラクタのコンパイルが完了したことを通知
-			compiler.pCompilingClass->NotifyFinishDestructorCompile();
-
-			if( compiler.pCompilingClass->HasSuperClass() ){
+			compiler.GetCompilingClass().NotifyFinishDestructorCompile();
+
+			if( compiler.GetCompilingClass().HasSuperClass() ){
 				/* サブクラスのデストラクタをコンパイルしているときは、
 					基底クラスのデストラクタを呼び出す */
 
-				const CMethod *method = compiler.pCompilingClass->GetSuperClass().GetDestructorMethod();
+				const CMethod *method = compiler.GetCompilingClass().GetSuperClass().GetDestructorMethod();
 				if( method ){
 					Opcode_CallProc("",
@@ -705,6 +699,7 @@
 
 
-	//重複エラー情報管理のメモリを解放
-	for(i3=0;i3<SynonymErrorNum;i3++) HeapDefaultFree(SynonymErrorWords[i3]);
-	HeapDefaultFree(SynonymErrorWords);
+	compiler.FinishProcedureCompile();
+
+
+	//ローカル変数のネーム情報は後に解放する
 }
Index: trunk/ab5.0/abdev/compiler_x64/Compile_Statement.cpp
===================================================================
--- trunk/ab5.0/abdev/compiler_x64/Compile_Statement.cpp	(revision 529)
+++ trunk/ab5.0/abdev/compiler_x64/Compile_Statement.cpp	(revision 584)
@@ -640,5 +640,5 @@
 
 void OpcodeExitSub(void){
-	if( UserProc::IsGlobalAreaCompiling() ){
+	if( compiler.IsGlobalAreaCompiling() ){
 		compiler.errorMessenger.Output(12,"Exit Sub/Function",cp);
 		return;
@@ -917,5 +917,5 @@
 }
 void OpcodeReturn(char *Parameter){
-	if( UserProc::IsGlobalAreaCompiling() ){
+	if( compiler.IsGlobalAreaCompiling() ){
 		compiler.errorMessenger.Output(62,NULL,cp);
 	}
@@ -923,5 +923,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_x64/Compile_Var.cpp
===================================================================
--- trunk/ab5.0/abdev/compiler_x64/Compile_Var.cpp	(revision 529)
+++ trunk/ab5.0/abdev/compiler_x64/Compile_Var.cpp	(revision 584)
@@ -209,5 +209,5 @@
 	////////////////////////////
 
-	const CMember *pMember = objClass.FindDynamicMember( VarName );
+	const Member *pMember = objClass.FindDynamicMember( VarName );
 	if( !pMember )
 	{
@@ -220,5 +220,5 @@
 
 	//アクセシビリティをチェック
-	if(&objClass==compiler.pCompilingClass){
+	if( compiler.IsCompilingClass() && &objClass == &compiler.GetCompilingClass() ){
 		//同一クラスオブジェクトの場合はプライベートアクセスを容認する
 		if(pMember->IsNoneAccess()){
@@ -412,10 +412,13 @@
 
 
-	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 ),
+			compiler.codeGenerator.lexicalScopes.GetNowLevel()
+		);
 		if( pVar ){
 			//ポインタ変数の場合
@@ -470,6 +473,5 @@
 	}
 
-
-	if(compiler.pCompilingClass){
+	if( compiler.IsCompilingClass() ){
 		//////////////////////
 		// クラスメンバの参照
@@ -482,5 +484,5 @@
 			pRelativeVar->dwKind=VAR_DIRECTMEM;
 
-			resultType.SetType( DEF_OBJECT, compiler.pCompilingClass );
+			resultType.SetType( DEF_OBJECT, &compiler.GetCompilingClass() );
 			return true;
 		}
@@ -494,5 +496,5 @@
 			//クラス内の動的メンバを参照するとき（通常）
 
-			if( !compiler.pCompilingClass->HasDynamicMember( VarName ) )
+			if( !compiler.GetCompilingClass().HasDynamicMember( VarName ) )
 			{
 				goto NonClassMember;
@@ -502,9 +504,9 @@
 		//Const修飾子のメソッド内でメンバ書き込みアクセスが発生したとき
 		//（コンストラクタ、デストラクタ内を除く）
-		const CMethod *pMethod = compiler.GetObjectModule().meta.GetClasses().GetNowCompilingMethodInfo();
+		const CMethod *pMethod = &compiler.GetCompilingUserProc().GetMethod();
 		if( isWriteAccess &&
 			pMethod->IsConst() &&
-			compiler.pCompilingClass->IsCompilingConstructor() == false &&
-			compiler.pCompilingClass->IsCompilingDestructor() == false
+			compiler.GetCompilingClass().IsCompilingConstructor() == false &&
+			compiler.GetCompilingClass().IsCompilingDestructor() == false
 			){
 				compiler.errorMessenger.Output(131, NULL, cp );
@@ -518,5 +520,5 @@
 			isErrorEnabled,
 			isWriteAccess,
-			Type( DEF_OBJECT, *compiler.pCompilingClass ),
+			Type( DEF_OBJECT, compiler.GetCompilingClass() ),
 			variable,
 			pRelativeVar,
@@ -536,5 +538,5 @@
 
 		char temporary[VN_SIZE];
-		if( UserProc::IsLocalAreaCompiling() ){
+		if( compiler.IsLocalAreaCompiling() ){
 			GetNowStaticVarFullName(VarName,temporary);
 
@@ -578,8 +580,8 @@
 		}
 
-		if(compiler.pCompilingClass){
+		if( compiler.IsCompilingClass() ){
 			//自身のクラスから静的メンバを参照する場合
 			char temp2[VN_SIZE];
-			sprintf(temp2,"%s.%s",compiler.pCompilingClass->GetName().c_str(),VarName);
+			sprintf(temp2,"%s.%s",compiler.GetCompilingClass().GetName().c_str(),VarName);
 			pVar = compiler.GetObjectModule().meta.GetGlobalVars().Find( LexicalAnalyzer::FullNameToSymbol( temp2 ) );
 			if( pVar ){
@@ -592,5 +594,8 @@
 		/////////////////////
 
-		pVar = compiler.GetObjectModule().meta.GetGlobalVars().BackSearch( LexicalAnalyzer::FullNameToSymbol( VarName ) );
+		pVar = compiler.GetObjectModule().meta.GetGlobalVars().BackSearch(
+			LexicalAnalyzer::FullNameToSymbol( VarName ),
+			compiler.codeGenerator.lexicalScopes.GetNowLevel()
+		);
 		if( pVar ){
 			goto GlobalOk;
@@ -806,5 +811,5 @@
 
 			int i = 0;
-			BOOST_FOREACH( CMember *pMember, objClass.GetDynamicMembers() ){
+			BOOST_FOREACH( Member *pMember, objClass.GetDynamicMembers() ){
 				if(InitBuf[i]=='\0'){
 					compiler.errorMessenger.Output(41,0,cp);
@@ -968,5 +973,5 @@
 
 			int i = 0;
-			BOOST_FOREACH( CMember *pMember, objClass.GetDynamicMembers() ){
+			BOOST_FOREACH( Member *pMember, objClass.GetDynamicMembers() ){
 				if(InitBuf[i]=='\0'){
 					compiler.errorMessenger.Output(41,0,cp);
@@ -1100,5 +1105,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() ){
 		/////////////////////////
 		// グローバル変数
@@ -1112,5 +1117,5 @@
 		/////////////////
 
-		if( UserProc::CompilingUserProc().GetLocalVars().DuplicateCheck( LexicalAnalyzer::FullNameToSymbol( VarName ) ) ){
+		if( compiler.GetCompilingUserProc().GetLocalVars().DuplicateCheck( LexicalAnalyzer::FullNameToSymbol( VarName ), compiler.codeGenerator.lexicalScopes.GetNowLevel() ) ){
 			//２重定義のエラー
 			compiler.errorMessenger.Output(15,VarName,cp);
@@ -1120,5 +1125,12 @@
 		bool isConst = ( dwFlags & DIMFLAG_CONST ) ? true:false;
 
-		Variable *pVar = new Variable( VarName, type, isConst, false, ConstractParameter, false );
+		Variable *pVar = new Variable(
+			ActiveBasic::Compiler::LexicalAnalyzer::FullNameToSymbol( VarName ),
+			type,
+			isConst,
+			false,
+			ConstractParameter,
+			false
+		);
 
 		if( subscripts.size() > 0 ){
@@ -1136,5 +1148,5 @@
 
 		// 変数を追加
-		UserProc::CompilingUserProc().GetLocalVars().push_back( pVar );
+		compiler.GetCompilingUserProc().GetLocalVars().push_back( pVar );
 
 		//アラインメントを考慮
@@ -1153,5 +1165,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_x64/MakePeHdr.cpp
===================================================================
--- trunk/ab5.0/abdev/compiler_x64/MakePeHdr.cpp	(revision 529)
+++ trunk/ab5.0/abdev/compiler_x64/MakePeHdr.cpp	(revision 584)
@@ -119,22 +119,28 @@
 
 
+	//"メタ情報を解析中..."
+	compiler.messenger.Output( STRING_ANALYZING_META_INFO );
+
+
 	//////////////////////
 	// コード生成前の準備
 	//////////////////////
 
-	//重複エラー情報管理のメモリを確保（グローバル領域コンパイル用）
-	extern char **SynonymErrorWords;
-	extern int SynonymErrorNum;
-	SynonymErrorNum=0;
-	SynonymErrorWords=(char **)HeapAlloc(hHeap,0,1);
+	// 重複エラー情報をクリア
+	compiler.errorMessenger.ClearSynonymKeyWords();
 
 	//列挙体に関する情報を収集
-	compiler.enumInfoCollection.InitEnum();
-
-	//列挙体からクラスコードを生成
-	char *temp;
-	temp = compiler.enumInfoCollection.GenerateSourceCode();
-	AddSourceCode(temp);
-	HeapDefaultFree(temp);
+	{
+		ActiveBasic::Compiler::LexicalAnalyzer::CollectEnums(
+			compiler.GetObjectModule().GetCurrentSource().GetBuffer(),
+			compiler.enumInfoCollection
+		);
+
+		// デリゲートからクラスコードを生成
+		std::string tempSource = ActiveBasic::Compiler::LexicalAnalyzer::GenerateEnumsSourceCode(
+			compiler.enumInfoCollection
+		);
+		AddSourceCode( tempSource.c_str() );
+	}
 
 	// 名前空間情報を取得
@@ -147,5 +153,5 @@
 	{
 		ActiveBasic::Compiler::LexicalAnalyzer::CollectDelegates(
-			compiler.GetObjectModule().GetCurrentSource(),
+			compiler.GetObjectModule().GetCurrentSource().GetBuffer(),
 			compiler.GetObjectModule().meta.GetDelegates()
 		);
@@ -167,6 +173,9 @@
 	);
 
-	//TypeDef情報を初期化
-	compiler.GetObjectModule().meta.GetTypeDefs().CollectTypeDefs();
+	//TypeDef情報を収集
+	ActiveBasic::Compiler::LexicalAnalyzer::CollectTypeDefs(
+		compiler.GetObjectModule().GetCurrentSource().GetBuffer(),
+		compiler.GetObjectModule().meta.GetTypeDefs()
+	);
 
 	/*
@@ -180,10 +189,14 @@
 
 	//定数情報を取得
-	GetConstInfo();
+	ActiveBasic::Compiler::LexicalAnalyzer::CollectConsts(
+		compiler.GetObjectModule().GetCurrentSource().GetBuffer(),
+		compiler.GetObjectModule().meta.GetGlobalConsts(),
+		compiler.GetObjectModule().meta.GetGlobalConstMacros()
+	);
 
 	//サブルーチン（ユーザー定義、DLL関数）の識別子、アドレスを取得
-	compiler.pCompilingClass = NULL;
+	compiler.SetCompilingClass( NULL );
 	ActiveBasic::Compiler::LexicalAnalyzer::CollectProcedures(
-		compiler.GetObjectModule().GetCurrentSource(),
+		compiler.GetObjectModule().GetCurrentSource().GetBuffer(),
 		compiler.GetObjectModule().meta.GetUserProcs(),
 		compiler.GetObjectModule().meta.GetDllProcs()
@@ -320,4 +333,8 @@
 
 
+	//"コンパイル中..."
+	compiler.messenger.Output(STRING_COMPILE_COMPILING);
+
+
 	//////////////////////
 	// グローバル実行領域
@@ -325,5 +342,5 @@
 
 	cp=-1;
-	UserProc::CompileStartForGlobalArea();
+	compiler.StartGlobalAreaCompile();
 
 	if( !compiler.IsDll() ){
@@ -434,8 +451,4 @@
 	}
 
-	//重複エラー情報管理のメモリを解放（グローバル領域用）
-	for(i=0;i<SynonymErrorNum;i++) HeapDefaultFree(SynonymErrorWords[i]);
-	HeapDefaultFree(SynonymErrorWords);
-
 
 	StepCompileProgress();
@@ -499,5 +512,7 @@
 	/////////////////////////////////////////////////////////////////
 
-	compiler.GetObjectModule().meta.GetClasses().GenerateVTables();
+	ActiveBasic::Compiler::VtblGenerator::GenerateVTablesForAllClasses(
+		compiler.GetObjectModule().meta.GetClasses()
+	);
 
 
@@ -1077,5 +1092,10 @@
 	////////////////////////////////////////
 	//仮想関数データテーブルスケジュール
-	compiler.GetObjectModule().meta.GetClasses().ActionVtblSchedule( ImageBase, MemPos_CodeSection, MemPos_DataSection );
+	ActiveBasic::Compiler::VtblGenerator::ActionVtblScheduleForAllClasses(
+		compiler.GetObjectModule().meta.GetClasses(),
+		ImageBase,
+		MemPos_CodeSection,
+		MemPos_DataSection
+	);
 
 
Index: trunk/ab5.0/abdev/compiler_x64/NumOpe.cpp
===================================================================
--- trunk/ab5.0/abdev/compiler_x64/NumOpe.cpp	(revision 529)
+++ trunk/ab5.0/abdev/compiler_x64/NumOpe.cpp	(revision 584)
@@ -426,5 +426,5 @@
 
 	if( pIsClassName ){
-		if( compiler.GetObjectModule().meta.GetClasses().Find( termFull ) ){
+		if( compiler.GetObjectModule().meta.FindClassSupportedTypeDef( termFull ) ){
 			*pIsClassName = true;
 			return true;
@@ -442,5 +442,5 @@
 
 	if(lstrcmpi(termFull,"This")==0 && isProcedureCallOnly == false ){
-		if( compiler.pCompilingClass == NULL )
+		if( !compiler.IsCompilingClass() )
 		{
 			compiler.errorMessenger.Output(142,NULL,cp);
@@ -449,5 +449,5 @@
 
 		//Thisオブジェクト
-		resultType.SetType( DEF_OBJECT, compiler.pCompilingClass );
+		resultType.SetType( DEF_OBJECT, &compiler.GetCompilingClass() );
 
 		SetThisPtrToReg( UseReg );
@@ -527,8 +527,10 @@
 		}
 
-		ConstMacro *pConstMacro = compiler.GetObjectModule().meta.GetGlobalConstMacros().Find( procName );
+		ConstMacro *pConstMacro = compiler.GetObjectModule().meta.GetGlobalConstMacros().Find(
+			ActiveBasic::Compiler::LexicalAnalyzer::FullNameToSymbol( procName )
+		);
 		if( pConstMacro )
 		{
-			if( pConstMacro->GetCalcBuffer( parameter, temporary ) )
+			if( ActiveBasic::Compiler::LexicalAnalyzer::ConstMacroToExpression( *pConstMacro, parameter, temporary ) )
 			{
 				/////////////////////////
@@ -1143,7 +1145,9 @@
 					//////////////
 
-					i3 = compiler.GetObjectModule().meta.GetGlobalConsts().GetBasicType(term);
+					i3 = compiler.GetObjectModule().meta.GetGlobalConsts().GetBasicType(
+						ActiveBasic::Compiler::LexicalAnalyzer::FullNameToSymbol( term )
+					);
 					if(i3){
-						if( compiler.GetObjectModule().meta.GetGlobalConsts().IsStringPtr( term ) ){
+						if( compiler.GetObjectModule().meta.GetGlobalConsts().IsStringPtr( ActiveBasic::Compiler::LexicalAnalyzer::FullNameToSymbol( term ) ) ){
 							//リテラル文字列
 
@@ -1166,5 +1170,7 @@
 							}
 
-							double dbl = compiler.GetObjectModule().meta.GetGlobalConsts().GetDoubleData(term);
+							double dbl = compiler.GetObjectModule().meta.GetGlobalConsts().GetDoubleData(
+								ActiveBasic::Compiler::LexicalAnalyzer::FullNameToSymbol( term )
+							);
 							memcpy(&i64data,&dbl,sizeof(double));
 
@@ -1180,5 +1186,7 @@
 						if(IsRealNumberType(i3)){
 							//実数
-							double dbl = compiler.GetObjectModule().meta.GetGlobalConsts().GetDoubleData(term);
+							double dbl = compiler.GetObjectModule().meta.GetGlobalConsts().GetDoubleData(
+								ActiveBasic::Compiler::LexicalAnalyzer::FullNameToSymbol( term )
+							);
 							memcpy(&i64data,&dbl,sizeof(double));
 							goto Literal;
@@ -1186,5 +1194,7 @@
 						else if(IsWholeNumberType(i3)){
 							//整数
-							i64data = compiler.GetObjectModule().meta.GetGlobalConsts().GetWholeData(term);
+							i64data = compiler.GetObjectModule().meta.GetGlobalConsts().GetWholeData(
+								ActiveBasic::Compiler::LexicalAnalyzer::FullNameToSymbol( term )
+							);
 							goto Literal;
 						}
Index: trunk/ab5.0/abdev/compiler_x64/compiler_x64.vcproj
===================================================================
--- trunk/ab5.0/abdev/compiler_x64/compiler_x64.vcproj	(revision 529)
+++ trunk/ab5.0/abdev/compiler_x64/compiler_x64.vcproj	(revision 584)
@@ -337,4 +337,12 @@
 					>
 				</File>
+				<File
+					RelativePath="..\BasicCompiler_Common\include\ProcedureGenerator.h"
+					>
+				</File>
+				<File
+					RelativePath="..\BasicCompiler_Common\include\VtblGenerator.h"
+					>
+				</File>
 				<Filter
 					Name="Language Classes"
@@ -1224,8 +1232,24 @@
 				</File>
 				<File
+					RelativePath="..\BasicCompiler_Common\src\LexicalAnalyzer_Const.cpp"
+					>
+				</File>
+				<File
 					RelativePath="..\BasicCompiler_Common\src\LexicalAnalyzer_Delegate.cpp"
 					>
 				</File>
 				<File
+					RelativePath="..\BasicCompiler_Common\src\LexicalAnalyzer_Enum.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\BasicCompiler_Common\src\LexicalAnalyzer_Procedure.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\BasicCompiler_Common\src\LexicalAnalyzer_TypeDef.cpp"
+					>
+				</File>
+				<File
 					RelativePath="..\BasicCompiler_Common\src\Linker.cpp"
 					>
@@ -1233,4 +1257,12 @@
 				<File
 					RelativePath="..\BasicCompiler_Common\src\Messenger.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\BasicCompiler_Common\src\ProcedureGenerator.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\BasicCompiler_Common\src\VtblGenerator.cpp"
 					>
 				</File>
Index: trunk/ab5.0/abdev/compiler_x64/stdafx.h
===================================================================
--- trunk/ab5.0/abdev/compiler_x64/stdafx.h	(revision 529)
+++ trunk/ab5.0/abdev/compiler_x64/stdafx.h	(revision 584)
@@ -56,13 +56,13 @@
 #include <Const.h>
 #include <Delegate.h>
-#include <Enum.h>
-#include <DataTable.h>
 #include <Exception.h>
 #include <Meta.h>
 
+#include <Enum.h>
 #include <logger.h>
 #include <Configuration.h>
 #include <CodeGenerator.h>
 #include <Messenger.h>
+#include <DataTable.h>
 #include <ObjectModule.h>
 #include <Linker.h>
@@ -71,2 +71,4 @@
 #include <Program.h>
 #include <LexicalAnalyzer.h>
+#include <VtblGenerator.h>
+#include <ProcedureGenerator.h>
