Index: trunk/ab5.0/abdev/BasicCompiler_Common/Compile.cpp
===================================================================
--- trunk/ab5.0/abdev/BasicCompiler_Common/Compile.cpp	(revision 631)
+++ trunk/ab5.0/abdev/BasicCompiler_Common/Compile.cpp	(revision 632)
@@ -758,5 +758,8 @@
 			}
 
-			ChangeOpcode(Command);
+			if( Command[0] )
+			{
+				ChangeOpcode(Command);
+			}
 
 
Index: trunk/ab5.0/abdev/BasicCompiler_Common/NumOpe_GetType.cpp
===================================================================
--- trunk/ab5.0/abdev/BasicCompiler_Common/NumOpe_GetType.cpp	(revision 631)
+++ trunk/ab5.0/abdev/BasicCompiler_Common/NumOpe_GetType.cpp	(revision 632)
@@ -829,11 +829,13 @@
 						isNothing_stack[sp] = true;
 
-						type_stack[sp] = DEF_OBJECT;
 						if( baseType.IsObject() ){
+							type_stack[sp] = DEF_OBJECT;
 							index_stack[sp] = baseType.GetIndex();
 						}
 						else{
-							index_stack[sp] = (LONG_PTR)compiler.GetObjectModule().meta.GetClasses().GetObjectClassPtr();
+							type_stack[sp] = baseType.GetBasicType();
+							index_stack[sp] = baseType.GetIndex();
 						}
+
 						*pIsLiteralCalculation = false;
 						sp++;
Index: trunk/ab5.0/abdev/BasicCompiler_Common/StrOperation.cpp
===================================================================
--- trunk/ab5.0/abdev/BasicCompiler_Common/StrOperation.cpp	(revision 631)
+++ trunk/ab5.0/abdev/BasicCompiler_Common/StrOperation.cpp	(revision 632)
@@ -365,4 +365,7 @@
 			lstrcpy(name,"End Enum");
 			break;
+		case ESC_OPERATOR:
+			lstrcpy( name, "Operator" );
+			break;
 	}
 }
@@ -378,6 +381,7 @@
 		if( temporary[i] == 1 )
 		{
+			int esc = temporary[i+1];
 			char temp2[255];
-			GetDefaultNameFromES( temporary[i+1], temp2 );
+			GetDefaultNameFromES( esc, temp2 );
 			if( i>0 )
 			{
@@ -391,6 +395,19 @@
 			}
 
+			int slide = 2;
+
+			if( esc == ESC_OPERATOR )
+			{
+				extern char *calcNames[256];
+				char calcId = temporary[i+2];
+				if( calcNames[calcId] )
+				{
+					lstrcat( temp2, calcNames[calcId] );
+				}
+				slide = 3;
+			}
+
 			int length = lstrlen( temp2 );
-			SlideString( temporary + i+2, length-2 );
+			SlideString( temporary + i+slide, length-slide );
 			memcpy( temporary + i, temp2, length );
 			maxLength = lstrlen( temporary );
Index: trunk/ab5.0/abdev/BasicCompiler_Common/VariableOpe.cpp
===================================================================
--- trunk/ab5.0/abdev/BasicCompiler_Common/VariableOpe.cpp	(revision 631)
+++ trunk/ab5.0/abdev/BasicCompiler_Common/VariableOpe.cpp	(revision 632)
@@ -633,8 +633,9 @@
 		}
 
-		int typeDefIndex = compiler.GetObjectModule().meta.GetTypeDefs().GetIndex( LexicalAnalyzer::FullNameToSymbol( VarName ) );
-		if( typeDefIndex != -1 ){
+		const TypeDef *pTypeDef = compiler.GetObjectModule().meta.GetTypeDefs().Find( LexicalAnalyzer::FullNameToSymbol( VarName ) );
+		if( pTypeDef )
+		{
 			// TypeDef後の型名だったとき
-			lstrcpy( VarName, compiler.GetObjectModule().meta.GetTypeDefs()[typeDefIndex].GetBaseName().c_str() );
+			lstrcpy( VarName, pTypeDef->GetBaseName().c_str() );
 		}
 
Index: trunk/ab5.0/abdev/BasicCompiler_Common/include/Compiler.h
===================================================================
--- trunk/ab5.0/abdev/BasicCompiler_Common/include/Compiler.h	(revision 631)
+++ trunk/ab5.0/abdev/BasicCompiler_Common/include/Compiler.h	(revision 632)
@@ -184,4 +184,7 @@
 
 
+private:
+	ActiveBasic::Compiler::Error::StringToTypeErrorCode::EnumType StringToGenericTypeEx( const std::string &typeName, Type &type );
+public:
 	ActiveBasic::Compiler::Error::StringToTypeErrorCode::EnumType StringToTypeEx( const std::string &typeName, Type &type, bool isResolveGenerics = false );
 	bool StringToType( const std::string &typeName, Type &type );
Index: trunk/ab5.0/abdev/BasicCompiler_Common/include/LexicalAnalyzer.h
===================================================================
--- trunk/ab5.0/abdev/BasicCompiler_Common/include/LexicalAnalyzer.h	(revision 631)
+++ trunk/ab5.0/abdev/BasicCompiler_Common/include/LexicalAnalyzer.h	(revision 632)
@@ -43,4 +43,8 @@
 	static void CollectClasses( const char *source, Classes &classes );
 
+	// テンプレート展開
+	static void TemplateExpand_ResolveMethod( const CMethod *pBaseMethod, const Types &actualTypes, CClass *pNewClass );
+	static const CClass *TemplateExpand( CClass &_class, const Types &actualTypes );
+
 	// グローバルプロシージャを収集する
 	static bool AnalyzeParameter( Parameters &params, const Jenga::Common::Strings &parameterStrings, int nowLine );
Index: trunk/ab5.0/abdev/BasicCompiler_Common/src/Compiler.cpp
===================================================================
--- trunk/ab5.0/abdev/BasicCompiler_Common/src/Compiler.cpp	(revision 631)
+++ trunk/ab5.0/abdev/BasicCompiler_Common/src/Compiler.cpp	(revision 632)
@@ -14,62 +14,106 @@
 }
 
-ActiveBasic::Compiler::Error::StringToTypeErrorCode::EnumType Compiler::StringToTypeEx( const std::string &typeName, Type &type, bool isResolveGenerics )
-{
-	type.SetIndex( -1 );
-
-
-	/////////////////////////////////////////////////////////
-	// ☆★☆ ジェネリクスサポート ☆★☆
-
-	if( strstr( typeName.c_str(), "<" ) )
-	{
-		// ジェネリッククラスをインスタンス化した型の場合
-		int i = 0;
-		char className[VN_SIZE];
-		GetIdentifierToken( className, typeName.c_str(), i );
-
-		// ジェネリクスクラスを取得
-		const CClass *pGenericClass = this->GetObjectModule().meta.FindClassSupportedTypeDef( 
-			LexicalAnalyzer::FullNameToSymbol( className )
-		);
-
-		if( !pGenericClass )
-		{
-			return ActiveBasic::Compiler::Error::StringToTypeErrorCode::NotfoundGenericClass;
-		}
-
-		if( typeName[i] != '<' )
-		{
-			Jenga::Throw( "StringToType内でジェネリクス構文の解析に失敗" );
-		}
-
-		GenericTypes genericTypes;
-		while( true )
-		{
-			i++;
-
-			char typeParameter[VN_SIZE];
-			GetIdentifierToken( typeParameter, typeName.c_str(), i );
-
-			// 型パラメータの型情報を取得
-			Type baseType;
-			StringToType( typeParameter, baseType );
-
-			genericTypes.push_back( GenericType( "(non support)", baseType ) );
-
-			if( typeName[i] != ',' )
-			{
-				break;
-			}
-		}
-
-		// 基本型をセット
-		type.SetBasicType( DEF_OBJECT );
+ActiveBasic::Compiler::Error::StringToTypeErrorCode::EnumType Compiler::StringToGenericTypeEx( const std::string &typeName, Type &type )
+{
+	// ジェネリッククラスをインスタンス化した型の場合
+	int i = 0;
+	char className[VN_SIZE];
+	GetIdentifierToken( className, typeName.c_str(), i );
+
+	// ジェネリクスクラスを取得
+	const CClass *pGenericClass = this->GetObjectModule().meta.FindClassSupportedTypeDef( 
+		LexicalAnalyzer::FullNameToSymbol( className )
+	);
+
+	if( !pGenericClass )
+	{
+		return ActiveBasic::Compiler::Error::StringToTypeErrorCode::NotfoundGenericClass;
+	}
+
+	if( typeName[i] != '<' )
+	{
+		Jenga::Throw( "StringToType内でジェネリクス構文の解析に失敗" );
+	}
+
+	GenericTypes genericTypes;
+	bool isValueType = false;
+	while( true )
+	{
+		i++;
+
+		char typeParameterStr[VN_SIZE];
+		GetIdentifierToken( typeParameterStr, typeName.c_str(), i );
+
+		// 型パラメータの型情報を取得
+		Type typeParameterType;
+		StringToType( typeParameterStr, typeParameterType );
+
+		genericTypes.push_back( GenericType( "(non support)", typeParameterType ) );
+
+		if( typeParameterType.IsValueType() )
+		{
+			// 値型の場合
+			isValueType = true;
+		}
+
+		if( typeName[i] != ',' )
+		{
+			break;
+		}
+	}
+
+	// 基本型をセット
+	type.SetBasicType( DEF_OBJECT );
+
+	if( isValueType )
+	{
+		// 型パラメータに値型が指定された場合
+
+		// 仮型パラメータを実型パラメータに変換
+		Types actualTypes;
+		BOOST_FOREACH( const GenericType &genericType, genericTypes )
+		{
+			actualTypes.push_back( genericType.GetType() );
+		}
+
+		// テンプレートとしてクラスを展開する
+		const CClass *pExpandedClass = LexicalAnalyzer::TemplateExpand( *const_cast<CClass *>(pGenericClass), actualTypes );
+
+		if( pExpandedClass )
+		{
+			// 拡張情報をセット
+			type.SetClassPtr( pExpandedClass );
+		}
+		else
+		{
+			// TODO: 消す
+			goto Generic;
+		}
+	}
+	else
+	{
+Generic:
+		// 型パラメータにクラス型が指定された場合
+
+		// ジェネリック クラスとして利用する
 
 		// 拡張情報をセット
 		type.SetClassPtr( pGenericClass );
 		type.SetActualGenericTypes( genericTypes );
-
-		return ActiveBasic::Compiler::Error::StringToTypeErrorCode::Successful;
+	}
+
+	return ActiveBasic::Compiler::Error::StringToTypeErrorCode::Successful;
+}
+ActiveBasic::Compiler::Error::StringToTypeErrorCode::EnumType Compiler::StringToTypeEx( const std::string &typeName, Type &type, bool isResolveGenerics )
+{
+	type.SetIndex( -1 );
+
+
+	/////////////////////////////////////////////////////////
+	// ☆★☆ ジェネリクスサポート ☆★☆
+
+	if( strstr( typeName.c_str(), "<" ) )
+	{
+		return StringToGenericTypeEx( typeName, type );
 	}
 
@@ -147,13 +191,24 @@
 	// TypeDefされた型
 	////////////////////
-	int i=this->GetObjectModule().meta.GetTypeDefs().GetIndex( LexicalAnalyzer::FullNameToSymbol( typeName ) );
-	if(i!=-1)
-	{
-		type = this->GetObjectModule().meta.GetTypeDefs()[i].GetBaseType();
+	const TypeDef *pTypeDef = this->GetObjectModule().meta.GetTypeDefs().Find( LexicalAnalyzer::FullNameToSymbol( typeName ) );
+	if( pTypeDef )
+	{
+		type = pTypeDef->GetBaseType();
+
+		if( type.IsObject() )
+		{
+			if( isResolveGenerics && !type.HasActualGenericType() )
+			{
+				// ジェネリッククラスの場合
+				trace( "型解決されていない" );
+				return ActiveBasic::Compiler::Error::StringToTypeErrorCode::FailedResolveGenericType;
+			}
+		}
+
 		return ActiveBasic::Compiler::Error::StringToTypeErrorCode::Successful;
 	}
 
 	//クラス
-	const CClass *pobj_c = this->GetObjectModule().meta.GetClasses().FindEx( LexicalAnalyzer::FullNameToSymbol( typeName ) );
+	const CClass *pobj_c = this->GetObjectModule().meta.FindClassSupportedTypeDef( LexicalAnalyzer::FullNameToSymbol( typeName ) );
 	if(pobj_c)
 	{
Index: trunk/ab5.0/abdev/BasicCompiler_Common/src/LexicalAnalyzer_Class.cpp
===================================================================
--- trunk/ab5.0/abdev/BasicCompiler_Common/src/LexicalAnalyzer_Class.cpp	(revision 631)
+++ trunk/ab5.0/abdev/BasicCompiler_Common/src/LexicalAnalyzer_Class.cpp	(revision 632)
@@ -287,5 +287,8 @@
 	Subscripts subscripts;
 	Type type;
-	GetDimentionFormat(buffer,VarName,subscripts,type,initBuffer,lpszConstructParameter);
+	if( !GetDimentionFormat(buffer,VarName,subscripts,type,initBuffer,lpszConstructParameter) )
+	{
+		return NULL;
+	}
 
 	//重複チェック
@@ -1217,36 +1220,37 @@
 				extern int cp;
 				if(i3==0){
-					if(bStatic){
-						//静的メンバを追加
-						cp=i;	//エラー用
-						pobj_c->AddStaticMember(
-							LexicalAnalyzer::CreateMember( *pobj_c, accessibility, isConst, false, temporary, i )
-						);
-					}
-					else{
-						//メンバを追加
-						cp=i;	//エラー用
-						pobj_c->AddDynamicMember(
-							LexicalAnalyzer::CreateMember( *pobj_c, accessibility, isConst, false, temporary, i )
-						);
-
-
-						if(pobj_c->GetDynamicMembers().back()->GetType().IsStruct()){
-							if( !pobj_c->GetDynamicMembers().back()->GetType().GetClass().IsReady() ){
-								//参照先が読み取られていないとき
-								GetClass_recur( pobj_c->GetDynamicMembers().back()->GetType().GetClass().GetName().c_str(), classes );
+					cp=i;	//エラー用
+					Member *pMember = LexicalAnalyzer::CreateMember( *pobj_c, accessibility, isConst, false, temporary, i );
+					if( pMember )
+					{
+						if(bStatic)
+						{
+							//静的メンバを追加
+							pobj_c->AddStaticMember( pMember );
+						}
+						else
+						{
+							//メンバを追加
+							pobj_c->AddDynamicMember( pMember );
+
+
+							if(pobj_c->GetDynamicMembers().back()->GetType().IsStruct()){
+								if( !pobj_c->GetDynamicMembers().back()->GetType().GetClass().IsReady() ){
+									//参照先が読み取られていないとき
+									GetClass_recur( pobj_c->GetDynamicMembers().back()->GetType().GetClass().GetName().c_str(), classes );
+								}
 							}
-						}
-
-
-						if(pobj_c->GetDynamicMembers().back()->GetType().IsStruct()){
-							//循環参照のチェック
-							pobj_LoopRefCheck->add(pobj_c->GetName().c_str());
-							if(!MemberVar_LoopRefCheck(pobj_c->GetDynamicMembers().back()->GetType().GetClass())){
-								//エラー回避
-								Type &type = const_cast<Type &>(pobj_c->GetDynamicMembers().back()->GetType());
-								type.SetBasicType( DEF_PTR_VOID );
+
+
+							if(pobj_c->GetDynamicMembers().back()->GetType().IsStruct()){
+								//循環参照のチェック
+								pobj_LoopRefCheck->add(pobj_c->GetName().c_str());
+								if(!MemberVar_LoopRefCheck(pobj_c->GetDynamicMembers().back()->GetType().GetClass())){
+									//エラー回避
+									Type &type = const_cast<Type &>(pobj_c->GetDynamicMembers().back()->GetType());
+									type.SetBasicType( DEF_PTR_VOID );
+								}
+								pobj_LoopRefCheck->del(pobj_c->GetName().c_str());
 							}
-							pobj_LoopRefCheck->del(pobj_c->GetName().c_str());
 						}
 					}
@@ -1355,2 +1359,148 @@
 	classes.Iterator_Init();
 }
+
+void LexicalAnalyzer::TemplateExpand_ResolveMethod( const CMethod *pBaseMethod, const Types &actualTypes, CClass *pNewClass )
+{
+	UserProc *pUserProc = new UserProc(
+		pBaseMethod->GetUserProc(),
+		pNewClass
+	);
+	pUserProc->Using();
+	pUserProc->GetParameters().clear();
+	pUserProc->RealParams().clear();
+
+	// パラメータのジェネリック型を解決
+	BOOST_FOREACH( const Parameter *pParam, pBaseMethod->GetUserProc().Params() )
+	{
+		Type type = pParam->IsTypeParameter()
+			? actualTypes[pParam->GetFormalTypeIndex()]
+			: *pParam;
+		type.SetPtrLevel( pParam->PtrLevel() );
+
+		pUserProc->GetParameters().push_back( new Parameter( *pParam, type ) );
+	}
+	BOOST_FOREACH( const Parameter *pParam, pBaseMethod->GetUserProc().RealParams() )
+	{
+		Type type = pParam->IsTypeParameter()
+			? actualTypes[pParam->GetFormalTypeIndex()]
+			: *pParam;
+		type.SetPtrLevel( pParam->PtrLevel() );
+
+		pUserProc->RealParams().push_back( new Parameter( *pParam, type ) );
+	}
+
+	// 戻り値のジェネリック型を解決
+	if( pUserProc->ReturnType().IsTypeParameter() )
+	{
+		Type type = actualTypes[pUserProc->ReturnType().GetFormalTypeIndex()];
+		type.SetPtrLevel( pUserProc->ReturnType().PtrLevel() );
+		pUserProc->SetReturnType( type );
+	}
+
+	compiler.GetObjectModule().meta.GetUserProcs().Put( pUserProc );
+	compiler.GetObjectModule().meta.GetUserProcs().Iterator_Init();
+
+	LexicalAnalyzer::AddMethod(
+		pNewClass,
+		pUserProc,
+		pBaseMethod->GetAccessibility(),
+		pBaseMethod->IsStatic(),
+		pBaseMethod->IsConst(),
+		pBaseMethod->IsAbstract(),
+		pBaseMethod->IsVirtual(),
+		false,
+		"",
+		false,
+		-1
+	);
+}
+
+const CClass *LexicalAnalyzer::TemplateExpand( CClass &_class, const Types &actualTypes )
+{
+	// 展開済みのクラスがあればそれを返す
+	BOOST_FOREACH( const ExpandedTemplateClass *pExpandedTemplateClass, _class.expandedTemplateClasses )
+	{
+		if( pExpandedTemplateClass->GetActualTypes().IsEquals( actualTypes ) )
+		{
+			return &pExpandedTemplateClass->GetClass();
+		}
+	}
+
+
+	/////////////////////////////////////////////////////////////////
+	// 未展開の場合は新たに展開する
+	/////////////////////////////////////////////////////////////////
+
+	// クラスをコピー
+	CClass *pNewClass = new CClass(
+		_class.GetNamespaceScopes(),
+		_class.GetImportedNamespaces(),
+		_class.GetName(),
+		_class.GetClassType(),
+		_class.GetFormalGenericTypes(),
+		actualTypes,
+		_class.GetConstructorMemberSubIndex(),
+		_class.GetDestructorMemberSubIndex(),
+		0,
+		_class.GetFixedAlignment()
+	);
+
+	// 基底クラス
+	pNewClass->SetSuperClass( &_class.GetSuperClass() );
+
+	// インターフェイスのジェネリック型を解決
+	BOOST_FOREACH( const ::Interface *pInterface, _class.GetInterfaces() )
+	{
+		pNewClass->AddInterface( new ::Interface( &pInterface->GetClass(), actualTypes ) );
+	}
+
+	// メンバのジェネリック型を解決
+	BOOST_FOREACH( const Member *pMember, _class.GetDynamicMembers() )
+	{
+		Type type = pMember->GetType();
+		if( type.IsTypeParameter() )
+		{
+			// ジェネリック型だったときは値型に変換
+			type = actualTypes[type.GetFormalTypeIndex()];
+			type.SetPtrLevel( pMember->GetType().PtrLevel() );
+		}
+
+		pNewClass->GetDynamicMembers().push_back(
+			new Member( *pMember, type )
+		);
+	}
+
+	// クラス メソッドのジェネリック型を解決
+	BOOST_FOREACH( const CMethod *pMethod, _class.GetDynamicMethods() )
+	{
+		if( pMethod->GetUserProc().GetParentClassPtr() == &_class )
+		{
+			// ターゲットクラス内で実装されるメソッドの場合
+
+			TemplateExpand_ResolveMethod( pMethod, actualTypes, pNewClass );
+		}
+		else
+		{
+			DynamicMethod *pNewDynamicMethod = new DynamicMethod( *pMethod );
+			pNewClass->GetDynamicMethods().push_back( pNewDynamicMethod );
+		}
+	}
+
+	// インターフェイス メソッドのジェネリック型を解決
+	BOOST_FOREACH( const ::Interface *pInterface, _class.GetInterfaces() )
+	{
+		BOOST_FOREACH( const CMethod *pMethod, pInterface->GetDynamicMethods() )
+		{
+			TemplateExpand_ResolveMethod( pMethod, actualTypes, pNewClass );
+		}
+	}
+
+	pNewClass->SetVtblNum( _class.GetVtblNum() );
+
+	// 展開済みクラスとして登録
+	_class.expandedTemplateClasses.push_back( new ExpandedTemplateClass( pNewClass, actualTypes ) );
+
+	pNewClass->Readed();
+
+	return pNewClass;
+}
Index: trunk/ab5.0/abdev/BasicCompiler_Common/src/LexicalAnalyzer_Procedure.cpp
===================================================================
--- trunk/ab5.0/abdev/BasicCompiler_Common/src/LexicalAnalyzer_Procedure.cpp	(revision 631)
+++ trunk/ab5.0/abdev/BasicCompiler_Common/src/LexicalAnalyzer_Procedure.cpp	(revision 632)
@@ -156,5 +156,5 @@
 
 	//ソースコードの位置
-	userProc.SetCodePos( nowLine );
+	userProc.SetSourceCodePosition( SourceCodePosition( compiler.GetObjectModule().GetName(), nowLine ) );
 
 	//パラメータ
@@ -286,5 +286,5 @@
 
 	//ソースコードの位置
-	pProc->SetCodePos( nowLine );
+	pProc->SetSourceCodePosition( SourceCodePosition( compiler.GetObjectModule().GetName(), nowLine ) );
 
 	//パラメータ
Index: trunk/ab5.0/abdev/BasicCompiler_Common/src/VtblGenerator.cpp
===================================================================
--- trunk/ab5.0/abdev/BasicCompiler_Common/src/VtblGenerator.cpp	(revision 631)
+++ trunk/ab5.0/abdev/BasicCompiler_Common/src/VtblGenerator.cpp	(revision 632)
@@ -96,5 +96,18 @@
 	while( classes.Iterator_HasNext() )
 	{
-		GenerateFullVTables( *classes.Iterator_GetNext() );
+		CClass *pClass = classes.Iterator_GetNext();
+		GenerateFullVTables( *pClass );
+
+		// テンプレート展開されたクラスも
+		BOOST_FOREACH( ActiveBasic::Common::Lexical::ExpandedTemplateClass *pExpandedTemplateClass, pClass->expandedTemplateClasses )
+		{
+			if( !pExpandedTemplateClass->GetClass().expandedTemplateClasses.empty() )
+			{
+				// テンプレート展開後のクラスが更にテンプレート展開されていることはありえない
+				throw;
+			}
+
+			GenerateFullVTables( pExpandedTemplateClass->GetClass() );
+		}
 	}
 }
@@ -167,5 +180,18 @@
 	while( classes.Iterator_HasNext() )
 	{
-		ActionVtblSchedule( *classes.Iterator_GetNext(), ImageBase, MemPos_CodeSection, MemPos_DataSection );
+		CClass *pClass = classes.Iterator_GetNext();
+		ActionVtblSchedule( *pClass, ImageBase, MemPos_CodeSection, MemPos_DataSection );
+
+		// テンプレート展開されたクラスも
+		BOOST_FOREACH( ActiveBasic::Common::Lexical::ExpandedTemplateClass *pExpandedTemplateClass, pClass->expandedTemplateClasses )
+		{
+			if( !pExpandedTemplateClass->GetClass().expandedTemplateClasses.empty() )
+			{
+				// テンプレート展開後のクラスが更にテンプレート展開されていることはありえない
+				throw;
+			}
+
+			ActionVtblSchedule( pExpandedTemplateClass->GetClass(), ImageBase, MemPos_CodeSection, MemPos_DataSection );
+		}
 	}
 }
Index: trunk/ab5.0/abdev/ab_common/ab_common.vcproj
===================================================================
--- trunk/ab5.0/abdev/ab_common/ab_common.vcproj	(revision 631)
+++ trunk/ab5.0/abdev/ab_common/ab_common.vcproj	(revision 632)
@@ -340,4 +340,8 @@
 				<File
 					RelativePath=".\src\Lexical\Interface.cpp"
+					>
+				</File>
+				<File
+					RelativePath=".\src\Lexical\Member.cpp"
 					>
 				</File>
@@ -416,4 +420,8 @@
 				</File>
 				<File
+					RelativePath=".\src\Lexical\Template.cpp"
+					>
+				</File>
+				<File
 					RelativePath=".\src\Lexical\Type.cpp"
 					>
@@ -530,4 +538,8 @@
 				</File>
 				<File
+					RelativePath=".\include\Lexical\Template.h"
+					>
+				</File>
+				<File
 					RelativePath=".\include\Lexical\Type.h"
 					>
Index: trunk/ab5.0/abdev/ab_common/include/Lexical/Class.h
===================================================================
--- trunk/ab5.0/abdev/ab_common/include/Lexical/Class.h	(revision 631)
+++ trunk/ab5.0/abdev/ab_common/include/Lexical/Class.h	(revision 632)
@@ -2,5 +2,7 @@
 
 class UserProc;
+class UserProcs;
 class Delegate;
+class Classes;
 
 class ClassPrototype : public Prototype, public DynamicMethodsPrototype
@@ -78,4 +80,7 @@
 	//アラインメント値
 	int fixedAlignment;
+
+public:
+	ActiveBasic::Common::Lexical::ExpandedTemplateClasses expandedTemplateClasses;
 
 	// XMLシリアライズ用
@@ -101,4 +106,5 @@
 		ar & BOOST_SERIALIZATION_NVP( staticMethods );
 		ar & BOOST_SERIALIZATION_NVP( fixedAlignment );
+		ar & BOOST_SERIALIZATION_NVP( expandedTemplateClasses );
 	}
 
@@ -106,60 +112,16 @@
 public:
 
-	CClass( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const std::string &name )
-		: ClassPrototype( namespaceScopes, name )
-		, importedNamespaces( importedNamespaces )
-		, classType( Class )
-		, pSuperClass( NULL )
-		, blittableType( Type() )
-		, isReady( false )
-		, fixedAlignment( 0 )
-		, ConstructorMemberSubIndex( -1 )
-		, DestructorMemberSubIndex( -1 )
-		, vtblNum( 0 )
-		, vtbl_offset( -1 )
-		, comVtblOffset( 0 )
-		, isCompilingConstructor( false )
-		, isCompilingDestructor( false )
-		, cacheSize( 0 )
-	{
-	}
-	CClass()
-		: ClassPrototype()
-		, importedNamespaces()
-		, classType()
-		, pSuperClass( NULL )
-		, blittableType( Type() )
-		, isReady( false )
-		, fixedAlignment( 0 )
-		, ConstructorMemberSubIndex( -1 )
-		, DestructorMemberSubIndex( -1 )
-		, vtblNum( 0 )
-		, vtbl_offset( -1 )
-		, comVtblOffset( 0 )
-		, isCompilingConstructor( false )
-		, isCompilingDestructor( false )
-		, cacheSize( 0 )
-	{
-	}
-	~CClass()
-	{
-		// 動的メンバ
-		BOOST_FOREACH( Member *member, dynamicMembers )
-		{
-			delete member;
-		}
-
-		// 静的メンバ
-		BOOST_FOREACH( Member *member, staticMembers )
-		{
-			delete member;
-		}
-
-		// インターフェイス
-		BOOST_FOREACH( ::Interface *pInterface, interfaces )
-		{
-			delete pInterface;
-		}
-	}
+	CClass( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const std::string &name );
+	CClass( const NamespaceScopes &namespaceScopes,
+		const NamespaceScopesCollection &importedNamespaces,
+		const std::string &name, ClassType classType,
+		const GenericTypes &formalGenericTypes,
+		const Types &superClassActualTypeParameters,
+		int ConstructorMemberSubIndex,
+		int DestructorMemberSubIndex,
+		int vtblNum,
+		int fixedAlignment );
+	CClass();
+	~CClass();
 
 	virtual const std::string &GetKeyName() const
@@ -273,4 +235,8 @@
 		this->classType = classType;
 	}
+	ClassType GetClassType() const
+	{
+		return classType;
+	}
 
 
@@ -314,4 +280,8 @@
 		return interfaces;
 	}
+	Interfaces &GetInterfaces()
+	{
+		return interfaces;
+	}
 	bool IsInheritsInterface( const CClass *pInterfaceClass ) const;
 
@@ -372,4 +342,8 @@
 		this->ConstructorMemberSubIndex = constructorMemberSubIndex;
 	}
+	int GetConstructorMemberSubIndex() const
+	{
+		return ConstructorMemberSubIndex;
+	}
 
 	//デストラクタ メソッドを取得
@@ -382,4 +356,8 @@
 	{
 		this->DestructorMemberSubIndex = destructorMemberSubIndex;
+	}
+	int GetDestructorMemberSubIndex() const
+	{
+		return DestructorMemberSubIndex;
 	}
 
Index: trunk/ab5.0/abdev/ab_common/include/Lexical/Member.h
===================================================================
--- trunk/ab5.0/abdev/ab_common/include/Lexical/Member.h	(revision 631)
+++ trunk/ab5.0/abdev/ab_common/include/Lexical/Member.h	(revision 632)
@@ -33,4 +33,10 @@
 
 	int source_code_address;
+
+	Member( Prototype::Accessibility accessibility, const std::string &name, const Type &newType, bool isConst, const Subscripts &subscripts, const std::string &initializeExpression, const std::string &constructParameter );
+	Member( const Member &member, const Type &actualType );
+	Member( const Member &member );
+	Member();
+	~Member();
 
 	const std::string &GetName() const
@@ -70,31 +76,4 @@
 		return constructParameter;
 	}
-
-	Member( Prototype::Accessibility accessibility, const std::string &name, const Type &newType, bool isConst, const Subscripts &subscripts, const std::string &initializeExpression, const std::string &constructParameter )
-		: MemberPrototype( accessibility )
-		, name( name )
-		, type( newType )
-		, isConst( isConst )
-		, subscripts( subscripts )
-		, initializeExpression( initializeExpression )
-		, constructParameter( constructParameter )
-	{
-	}
-	Member::Member(Member &member)
-		: MemberPrototype( member.GetAccessibility() )
-		, name( member.GetName() )
-		, type( member.GetType() )
-		, isConst( member.IsConst() )
-		, subscripts( member.GetSubscripts() )
-	{
-		//ソースコードの位置
-		source_code_address=member.source_code_address;
-	}
-	Member()
-	{
-	}
-	~Member()
-	{
-	}
 };
 typedef std::vector<Member *> Members;
Index: trunk/ab5.0/abdev/ab_common/include/Lexical/ObjectModule.h
===================================================================
--- trunk/ab5.0/abdev/ab_common/include/Lexical/ObjectModule.h	(revision 631)
+++ trunk/ab5.0/abdev/ab_common/include/Lexical/ObjectModule.h	(revision 632)
@@ -4,4 +4,7 @@
 {
 public:
+	// オブジェクトモジュール名
+	std::string name;
+
 	// メタ情報
 	Meta meta;
@@ -29,4 +32,5 @@
 		trace_for_serialize( "serializing - objectModule" );
 
+		ar & BOOST_SERIALIZATION_NVP( name );
 		ar & BOOST_SERIALIZATION_NVP( meta );
 		ar & BOOST_SERIALIZATION_NVP( globalNativeCode );
@@ -39,4 +43,12 @@
 	void StaticLink( ObjectModule &objectModule );
 
+	const std::string &GetName() const
+	{
+		return name;
+	}
+	void SetName( const std::string &name )
+	{
+		this->name = name;
+	}
 	int GetCurrentSourceIndex() const
 	{
Index: trunk/ab5.0/abdev/ab_common/include/Lexical/Parameter.h
===================================================================
--- trunk/ab5.0/abdev/ab_common/include/Lexical/Parameter.h	(revision 631)
+++ trunk/ab5.0/abdev/ab_common/include/Lexical/Parameter.h	(revision 632)
@@ -26,25 +26,9 @@
 
 public:
-	Parameter( const std::string &varName, const Type &type, bool isRef = false, const std::string initValue = "" ):
-		Type( type ),
-		varName( varName ),
-		isRef( isRef ),
-		isArray( false ),
-		initValue( initValue )
-	{
-	}
-	Parameter( const Parameter &param ):
-		Type( param ),
-		varName( param.varName ),
-		isRef( param.isRef ),
-		isArray( param.isArray ),
-		subscripts( param.subscripts ),
-		initValue( param.initValue )
-	{
-	}
-	Parameter()
-	{
-	}
-	~Parameter(){}
+	Parameter( const std::string &varName, const Type &type, bool isRef = false, const std::string initValue = "" );
+	Parameter( const Parameter &param, const Type &type );
+	Parameter( const Parameter &param );
+	Parameter();
+	~Parameter();
 
 	void SetArray( const Subscripts &subscripts ){
Index: trunk/ab5.0/abdev/ab_common/include/Lexical/Procedure.h
===================================================================
--- trunk/ab5.0/abdev/ab_common/include/Lexical/Procedure.h	(revision 631)
+++ trunk/ab5.0/abdev/ab_common/include/Lexical/Procedure.h	(revision 632)
@@ -24,6 +24,7 @@
 	Type returnType;
 
+private:
 	// ソースコードの位置
-	int codePos;
+	SourceCodePosition sourceCodePosition;
 
 	// XMLシリアライズ用
@@ -40,5 +41,5 @@
 		ar & BOOST_SERIALIZATION_NVP( params );
 		ar & BOOST_SERIALIZATION_NVP( returnType );
-		ar & BOOST_SERIALIZATION_NVP( codePos );
+		ar & BOOST_SERIALIZATION_NVP( sourceCodePosition );
 	}
 
@@ -49,5 +50,4 @@
 		, isCdecl( isCdecl )
 		, isUsing( false )
-		, codePos( -1 )
 	{
 	}
@@ -83,11 +83,11 @@
 	}
 
-	int GetCodePos() const
-	{
-		return codePos;
-	}
-	void SetCodePos( int codePos )
-	{
-		this->codePos = codePos;
+	const SourceCodePosition &GetSourceCodePosition() const
+	{
+		return sourceCodePosition;
+	}
+	void SetSourceCodePosition( const SourceCodePosition &sourceCodePosition )
+	{
+		this->sourceCodePosition = sourceCodePosition;
 	}
 
@@ -178,32 +178,8 @@
 public:
 
-	UserProc( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const std::string &name, Kind kind, bool isMacro, bool isCdecl, bool isExport )
-		: Procedure( namespaceScopes, name, kind, isCdecl )
-		, importedNamespaces( importedNamespaces )
-		, pParentClass( NULL )
-		, pInterface( NULL )
-		, pMethod( NULL )
-		, isMacro( isMacro )
-		, secondParmNum( 0 )
-		, realSecondParmNum( 1 )
-		, isExport( isExport )
-		, isSystem( false )
-		, isAutoGeneration( false )
-		, isCompiled( false )
-		, beginOpAddress( 0 )
-		, endOpAddress( 0 )
-	{
-		static int id_base=0;
-		id = ( id_base ++ );
-	}
-	UserProc()
-	{
-	}
-	~UserProc()
-	{
-		BOOST_FOREACH( Parameter *pParam, realParams ){
-			delete pParam;
-		}
-	}
+	UserProc( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const std::string &name, Kind kind, bool isMacro, bool isCdecl, bool isExport );
+	UserProc( const UserProc &userProc, const CClass *pParentClass );
+	UserProc();
+	~UserProc();
 
 	void SetReturnType( const Type &newReturnType )
Index: trunk/ab5.0/abdev/ab_common/include/Lexical/Source.h
===================================================================
--- trunk/ab5.0/abdev/ab_common/include/Lexical/Source.h	(revision 631)
+++ trunk/ab5.0/abdev/ab_common/include/Lexical/Source.h	(revision 632)
@@ -253,2 +253,39 @@
 };
 typedef std::vector<BasicSource> BasicSources;
+
+class SourceCodePosition
+{
+	std::string objectModuleName;
+	int pos;
+
+	// XMLシリアライズ用
+private:
+	friend class boost::serialization::access;
+	template<class Archive> void serialize(Archive& ar, const unsigned int version)
+	{
+		trace_for_serialize( "serializing - IncludedFilesRelation" );
+
+		ar & BOOST_SERIALIZATION_NVP( objectModuleName );
+		ar & BOOST_SERIALIZATION_NVP( pos );
+	}
+
+public:
+	SourceCodePosition( const std::string &objectModuleName, int pos )
+		: objectModuleName( objectModuleName )
+		, pos( pos )
+	{
+	}
+	SourceCodePosition()
+		: pos( -1 )
+	{
+	}
+
+	const std::string &GetObjectModuleName() const
+	{
+		return objectModuleName;
+	}
+	int GetPos() const
+	{
+		return pos;
+	}
+};
Index: trunk/ab5.0/abdev/ab_common/include/Lexical/Template.h
===================================================================
--- trunk/ab5.0/abdev/ab_common/include/Lexical/Template.h	(revision 632)
+++ trunk/ab5.0/abdev/ab_common/include/Lexical/Template.h	(revision 632)
@@ -0,0 +1,53 @@
+#pragma once
+
+class CClass;
+
+namespace ActiveBasic{ namespace Common{ namespace Lexical{
+
+
+class ExpandedTemplateClass
+{
+	CClass *pClass;
+	Types actualTypes;
+
+	// XMLシリアライズ用
+private:
+	friend class boost::serialization::access;
+	template<class Archive> void serialize(Archive& ar, const unsigned int version)
+	{
+		ar & BOOST_SERIALIZATION_NVP( pClass );
+		ar & BOOST_SERIALIZATION_NVP( actualTypes );
+	}
+
+
+public:
+	ExpandedTemplateClass( CClass *pClass, const Types &actualTypes )
+		: pClass( pClass )
+		, actualTypes( actualTypes )
+	{
+	}
+	ExpandedTemplateClass()
+		: pClass( NULL )
+	{
+	}
+	~ExpandedTemplateClass();
+
+	const CClass &GetClass() const
+	{
+		return *pClass;
+	}
+	CClass &GetClass()
+	{
+		return *pClass;
+	}
+
+	const Types &GetActualTypes() const
+	{
+		return actualTypes;
+	}
+};
+
+typedef std::vector<ExpandedTemplateClass *> ExpandedTemplateClasses;
+
+
+}}}
Index: trunk/ab5.0/abdev/ab_common/include/Lexical/Type.h
===================================================================
--- trunk/ab5.0/abdev/ab_common/include/Lexical/Type.h	(revision 631)
+++ trunk/ab5.0/abdev/ab_common/include/Lexical/Type.h	(revision 632)
@@ -136,4 +136,8 @@
 	void PtrLevelDown(){
 		PTR_LEVEL_DOWN( basicType );
+	}
+	void SetPtrLevel( int level )
+	{
+		basicType = MAKE_PTR_TYPE( NATURAL_TYPE( basicType ), level );
 	}
 
@@ -166,4 +170,5 @@
 	bool IsReal() const;
 	bool Is64() const;
+	bool IsValueType() const;
 	bool IsProcPtr() const;
 	bool IsStruct() const;
@@ -233,5 +238,19 @@
 	static int GetBasicTypeFromSimpleName( const char *variable );
 };
-typedef std::vector<Type> Types;
+
+class Types
+	: public std::vector<Type>
+{
+	// XMLシリアライズ用
+private:
+	friend class boost::serialization::access;
+	template<class Archive> void serialize(Archive& ar, const unsigned int version)
+	{
+		ar & boost::serialization::make_nvp("vector_Type", boost::serialization::base_object<vector<Type>>(*this));
+	}
+
+public:
+	bool IsEquals( const Types &Types ) const;
+};
 
 /*!
Index: trunk/ab5.0/abdev/ab_common/include/Lexical/TypeDef.h
===================================================================
--- trunk/ab5.0/abdev/ab_common/include/Lexical/TypeDef.h	(revision 631)
+++ trunk/ab5.0/abdev/ab_common/include/Lexical/TypeDef.h	(revision 632)
@@ -59,4 +59,4 @@
 
 	void Add( const NamespaceScopes &namespaceScopes, const std::string &name, const std::string &baseName, int nowLine );
-	int GetIndex( const Symbol &symbol ) const;
+	const TypeDef *Find( const Symbol &symbol ) const;
 };
Index: trunk/ab5.0/abdev/ab_common/include/ab_common.h
===================================================================
--- trunk/ab5.0/abdev/ab_common/include/ab_common.h	(revision 631)
+++ trunk/ab5.0/abdev/ab_common/include/ab_common.h	(revision 632)
@@ -19,4 +19,5 @@
 #include "Lexical/Interface.h"
 #include "Lexical/Member.h"
+#include "Lexical/Template.h"
 #include "Lexical/Class.h"
 #include "Lexical/Parameter.h"
Index: trunk/ab5.0/abdev/ab_common/src/Lexical/Class.cpp
===================================================================
--- trunk/ab5.0/abdev/ab_common/src/Lexical/Class.cpp	(revision 631)
+++ trunk/ab5.0/abdev/ab_common/src/Lexical/Class.cpp	(revision 632)
@@ -1,3 +1,99 @@
 #include "stdafx.h"
+
+
+CClass::CClass( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const std::string &name )
+	: ClassPrototype( namespaceScopes, name )
+	, importedNamespaces( importedNamespaces )
+	, classType( Class )
+	, pSuperClass( NULL )
+	, blittableType( Type() )
+	, isReady( false )
+	, fixedAlignment( 0 )
+	, ConstructorMemberSubIndex( -1 )
+	, DestructorMemberSubIndex( -1 )
+	, vtblNum( 0 )
+	, vtbl_offset( -1 )
+	, comVtblOffset( 0 )
+	, isCompilingConstructor( false )
+	, isCompilingDestructor( false )
+	, cacheSize( 0 )
+{
+}
+
+CClass::CClass( const NamespaceScopes &namespaceScopes,
+	const NamespaceScopesCollection &importedNamespaces,
+	const std::string &name,
+	ClassType classType,
+	const GenericTypes &formalGenericTypes,
+	const Types &superClassActualTypeParameters,
+	int ConstructorMemberSubIndex,
+	int DestructorMemberSubIndex,
+	int vtblNum,
+	int fixedAlignment )
+	: ClassPrototype( namespaceScopes, name )
+	, importedNamespaces( importedNamespaces )
+	, classType( classType )
+	, formalGenericTypes( formalGenericTypes )
+	, pSuperClass( NULL )
+	, superClassActualTypeParameters( superClassActualTypeParameters )
+	, blittableType( Type() )
+	, isReady( false )
+	, ConstructorMemberSubIndex( ConstructorMemberSubIndex )
+	, DestructorMemberSubIndex( DestructorMemberSubIndex )
+	, vtblNum( vtblNum )
+	, fixedAlignment( fixedAlignment )
+	, vtbl_offset( -1 )
+	, comVtblOffset( 0 )
+	, isCompilingConstructor( false )
+	, isCompilingDestructor( false )
+	, cacheSize( 0 )
+{
+}
+
+CClass::CClass()
+	: ClassPrototype()
+	, importedNamespaces()
+	, classType()
+	, pSuperClass( NULL )
+	, blittableType( Type() )
+	, isReady( false )
+	, fixedAlignment( 0 )
+	, ConstructorMemberSubIndex( -1 )
+	, DestructorMemberSubIndex( -1 )
+	, vtblNum( 0 )
+	, vtbl_offset( -1 )
+	, comVtblOffset( 0 )
+	, isCompilingConstructor( false )
+	, isCompilingDestructor( false )
+	, cacheSize( 0 )
+{
+}
+
+CClass::~CClass()
+{
+	// 動的メンバ
+	BOOST_FOREACH( Member *member, dynamicMembers )
+	{
+		delete member;
+	}
+
+	// 静的メンバ
+	BOOST_FOREACH( Member *member, staticMembers )
+	{
+		delete member;
+	}
+
+	// インターフェイス
+	BOOST_FOREACH( ::Interface *pInterface, interfaces )
+	{
+		delete pInterface;
+	}
+
+	// テンプレート展開済みのクラス
+	BOOST_FOREACH( ExpandedTemplateClass *pExpandedTemplateClass, expandedTemplateClasses )
+	{
+		delete pExpandedTemplateClass;
+	}
+}
 
 void CClass::Using() const
Index: trunk/ab5.0/abdev/ab_common/src/Lexical/Member.cpp
===================================================================
--- trunk/ab5.0/abdev/ab_common/src/Lexical/Member.cpp	(revision 632)
+++ trunk/ab5.0/abdev/ab_common/src/Lexical/Member.cpp	(revision 632)
@@ -0,0 +1,41 @@
+#include "stdafx.h"
+
+
+Member::Member( Prototype::Accessibility accessibility, const std::string &name, const Type &newType, bool isConst, const Subscripts &subscripts, const std::string &initializeExpression, const std::string &constructParameter )
+	: MemberPrototype( accessibility )
+	, name( name )
+	, type( newType )
+	, isConst( isConst )
+	, subscripts( subscripts )
+	, initializeExpression( initializeExpression )
+	, constructParameter( constructParameter )
+{
+}
+
+Member::Member( const Member &member )
+	: MemberPrototype( member.GetAccessibility() )
+	, name( member.GetName() )
+	, type( member.GetType() )
+	, isConst( member.IsConst() )
+	, subscripts( member.GetSubscripts() )
+	, source_code_address( member.source_code_address )
+{
+}
+
+Member::Member( const Member &member, const Type &actualType )
+	: MemberPrototype( member.GetAccessibility() )
+	, name( member.GetName() )
+	, type( actualType )
+	, isConst( member.IsConst() )
+	, subscripts( member.GetSubscripts() )
+	, source_code_address( member.source_code_address )
+{
+}
+
+Member::Member()
+{
+}
+
+Member::~Member()
+{
+}
Index: trunk/ab5.0/abdev/ab_common/src/Lexical/Meta.cpp
===================================================================
--- trunk/ab5.0/abdev/ab_common/src/Lexical/Meta.cpp	(revision 631)
+++ trunk/ab5.0/abdev/ab_common/src/Lexical/Meta.cpp	(revision 632)
@@ -186,8 +186,10 @@
 
 	// TypeDefも見る
-	int index = this->GetTypeDefs().GetIndex( symbol );
-	if( index != -1 ){
-		Type type = this->GetTypeDefs()[index].GetBaseType();
-		if( type.IsObject() ){
+	const TypeDef *pTypeDef = this->GetTypeDefs().Find( symbol );
+	if( pTypeDef )
+	{
+		Type type = pTypeDef->GetBaseType();
+		if( type.IsObject() )
+		{
 			return &type.GetClass();
 		}
Index: trunk/ab5.0/abdev/ab_common/src/Lexical/Parameter.cpp
===================================================================
--- trunk/ab5.0/abdev/ab_common/src/Lexical/Parameter.cpp	(revision 631)
+++ trunk/ab5.0/abdev/ab_common/src/Lexical/Parameter.cpp	(revision 632)
@@ -1,3 +1,40 @@
 #include "stdafx.h"
+
+Parameter::Parameter( const std::string &varName, const Type &type, bool isRef, const std::string initValue )
+	: Type( type )
+	, varName( varName )
+	, isRef( isRef )
+	, isArray( false )
+	, initValue( initValue )
+{
+}
+
+Parameter::Parameter( const Parameter &param, const Type &type )
+	: Type( type )
+	, varName( param.varName )
+	, isRef( param.isRef )
+	, isArray( param.isArray )
+	, subscripts( param.subscripts )
+	, initValue( param.initValue )
+{
+}
+
+Parameter::Parameter( const Parameter &param )
+	: Type( param )
+	, varName( param.varName )
+	, isRef( param.isRef )
+	, isArray( param.isArray )
+	, subscripts( param.subscripts )
+	, initValue( param.initValue )
+{
+}
+
+Parameter::Parameter()
+{
+}
+
+Parameter::~Parameter()
+{
+}
 
 bool Parameter::Equals( const Parameter &param, bool isContravariant ) const
Index: trunk/ab5.0/abdev/ab_common/src/Lexical/Procedure.cpp
===================================================================
--- trunk/ab5.0/abdev/ab_common/src/Lexical/Procedure.cpp	(revision 631)
+++ trunk/ab5.0/abdev/ab_common/src/Lexical/Procedure.cpp	(revision 632)
@@ -1,3 +1,58 @@
 #include "stdafx.h"
+
+int id_base = 0;
+
+UserProc::UserProc( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const std::string &name, Kind kind, bool isMacro, bool isCdecl, bool isExport )
+	: Procedure( namespaceScopes, name, kind, isCdecl )
+	, importedNamespaces( importedNamespaces )
+	, pParentClass( NULL )
+	, pInterface( NULL )
+	, pMethod( NULL )
+	, isMacro( isMacro )
+	, secondParmNum( 0 )
+	, realSecondParmNum( 1 )
+	, isExport( isExport )
+	, isSystem( false )
+	, isAutoGeneration( false )
+	, isCompiled( false )
+	, beginOpAddress( 0 )
+	, endOpAddress( 0 )
+	, id( id_base ++ )
+{
+}
+
+UserProc::UserProc( const UserProc &userProc, const CClass *pParentClass )
+	: Procedure( userProc )
+	, _paramStr( userProc._paramStr )
+	, importedNamespaces( userProc.importedNamespaces )
+	, pParentClass( pParentClass )
+	, pInterface( NULL )
+	, pMethod( NULL )
+	, isMacro( userProc.isMacro )
+	, secondParmNum( userProc.secondParmNum )
+	, realParams( userProc.realParams )
+	, realSecondParmNum( userProc.realSecondParmNum )
+	, isExport( userProc.isExport )
+	, isSystem( userProc.isSystem )
+	, isAutoGeneration( userProc.isAutoGeneration )
+	, isCompiled( false )
+	, beginOpAddress( 0 )
+	, endOpAddress( 0 )
+	, localVars( Variables() )
+	, id( id_base ++ )
+	, nativeCode( NativeCode() )
+{
+}
+
+UserProc::UserProc()
+{
+}
+
+UserProc::~UserProc()
+{
+	BOOST_FOREACH( Parameter *pParam, realParams ){
+		delete pParam;
+	}
+}
 
 bool UserProc::IsEqualForOverride( const Types &actualTypeParametersForThisProc, const UserProc *pUserProc ) const
@@ -54,5 +109,6 @@
 const NamespaceScopes &UserProc::GetNamespaceScopes() const
 {
-	if( HasParentClass() ){
+	if( HasParentClass() )
+	{
 		return GetParentClassPtr()->GetNamespaceScopes();
 	}
Index: trunk/ab5.0/abdev/ab_common/src/Lexical/Symbol.cpp
===================================================================
--- trunk/ab5.0/abdev/ab_common/src/Lexical/Symbol.cpp	(revision 631)
+++ trunk/ab5.0/abdev/ab_common/src/Lexical/Symbol.cpp	(revision 632)
@@ -5,5 +5,5 @@
 const NamespaceSupporter *Symbol::namespaceSupporter = NULL;
 
-char *calcNames[255] = {
+char *calcNames[256] = {
 	"xor",
 };
Index: trunk/ab5.0/abdev/ab_common/src/Lexical/Template.cpp
===================================================================
--- trunk/ab5.0/abdev/ab_common/src/Lexical/Template.cpp	(revision 632)
+++ trunk/ab5.0/abdev/ab_common/src/Lexical/Template.cpp	(revision 632)
@@ -0,0 +1,9 @@
+#include "stdafx.h"
+
+ExpandedTemplateClass::~ExpandedTemplateClass()
+{
+	if( pClass )
+	{
+		delete pClass;
+	}
+}
Index: trunk/ab5.0/abdev/ab_common/src/Lexical/Type.cpp
===================================================================
--- trunk/ab5.0/abdev/ab_common/src/Lexical/Type.cpp	(revision 631)
+++ trunk/ab5.0/abdev/ab_common/src/Lexical/Type.cpp	(revision 632)
@@ -384,4 +384,10 @@
 	return false;
 }
+
+bool Type::IsValueType() const
+{
+	return ( IsWhole() || IsReal() );
+}
+
 bool Type::IsProcPtr() const
 {
@@ -550,4 +556,23 @@
 }
 
+bool Types::IsEquals( const Types &types ) const
+{
+	if( this->size() != types.size() )
+	{
+		// アイテム数が違う
+		return false;
+	}
+
+	const Types &thisTypes = *this;
+	for( int i=0; i<static_cast<int>(this->size()); i++ )
+	{
+		if( !thisTypes[i].Equals( types[i] ) )
+		{
+			return false;
+		}
+	}
+
+	return true;
+}
 
 void ResolveFormalGenericTypeParameter( Type &typeParameter, const Type &classType, const UserProc *pUserProc )
Index: trunk/ab5.0/abdev/ab_common/src/Lexical/TypeDef.cpp
===================================================================
--- trunk/ab5.0/abdev/ab_common/src/Lexical/TypeDef.cpp	(revision 631)
+++ trunk/ab5.0/abdev/ab_common/src/Lexical/TypeDef.cpp	(revision 632)
@@ -17,11 +17,14 @@
 }
 
-int TypeDefCollection::GetIndex( const Symbol &symbol ) const{
-	int max = (int)(*this).size();
-	for( int i=0; i<max; i++ ){
-		if( (*this)[i].IsEqualSymbol( symbol ) ){
-			return i;
+const TypeDef *TypeDefCollection::Find( const Symbol &symbol ) const
+{
+	const TypeDefCollection &typeDefs = *this;
+	BOOST_FOREACH( const TypeDef &typeDef, typeDefs )
+	{
+		if( typeDef.IsEqualSymbol( symbol ) )
+		{
+			return &typeDef;
 		}
 	}
-	return -1;
+	return NULL;
 }
Index: trunk/ab5.0/abdev/abdev/src/WindowComponents/PartialManager/TextEditPartialManager.cpp
===================================================================
--- trunk/ab5.0/abdev/abdev/src/WindowComponents/PartialManager/TextEditPartialManager.cpp	(revision 632)
+++ trunk/ab5.0/abdev/abdev/src/WindowComponents/PartialManager/TextEditPartialManager.cpp	(revision 632)
@@ -0,0 +1,22 @@
+#include "stdafx.h"
+
+using namespace ActiveBasic::IDE;
+/*
+bool TextEditPartialManager::CanUndo() const
+{
+}
+bool TextEditPartialManager::CanRedo() const
+{
+}
+
+void TextEditPartialManager::Undo()
+{
+}
+void TextEditPartialManager::Redo()
+{
+}
+
+void TextEditPartialManager::NoticeChangeset()
+{
+}
+*/
Index: trunk/ab5.0/abdev/compiler_x86/Compile_ProcOp.cpp
===================================================================
--- trunk/ab5.0/abdev/compiler_x86/Compile_ProcOp.cpp	(revision 631)
+++ trunk/ab5.0/abdev/compiler_x86/Compile_ProcOp.cpp	(revision 632)
@@ -289,5 +289,5 @@
 	}
 
-	trace_for_sourcecodestep( "★★★ " << pUserProc->GetFullName() << "のコンパイルを開始" );
+	trace_for_sourcecodestep( "★★★ " << FormatEscapeSequenceStringToDefaultString( pUserProc->GetFullName() ) << "のコンパイルを開始" );
 
 	pUserProc->CompleteCompile();
@@ -330,5 +330,5 @@
 	if( !pUserProc->IsAutoGeneration() )
 	{
-		cp=pUserProc->GetCodePos();
+		cp=pUserProc->GetSourceCodePosition().GetPos();
 		for(;;cp++){
 			if(IsCommandDelimitation(basbuf[cp])) break;
Index: trunk/ab5.0/abdev/compiler_x86/Compile_Var.cpp
===================================================================
--- trunk/ab5.0/abdev/compiler_x86/Compile_Var.cpp	(revision 631)
+++ trunk/ab5.0/abdev/compiler_x86/Compile_Var.cpp	(revision 632)
@@ -540,10 +540,11 @@
 			}
 
-			int typeDefIndex = compiler.GetObjectModule().meta.GetTypeDefs().GetIndex(
+			const TypeDef *pTypeDef = compiler.GetObjectModule().meta.GetTypeDefs().Find(
 				LexicalAnalyzer::FullNameToSymbol( VarName )
 			);
-			if( typeDefIndex != -1 ){
+			if( pTypeDef )
+			{
 				// TypeDef後の型名だったとき
-				lstrcpy( VarName, compiler.GetObjectModule().meta.GetTypeDefs()[typeDefIndex].GetBaseName().c_str() );
+				lstrcpy( VarName, pTypeDef->GetBaseName().c_str() );
 			}
 
Index: trunk/ab5.0/abdev/compiler_x86/MakePeHdr.cpp
===================================================================
--- trunk/ab5.0/abdev/compiler_x86/MakePeHdr.cpp	(revision 631)
+++ trunk/ab5.0/abdev/compiler_x86/MakePeHdr.cpp	(revision 632)
@@ -576,5 +576,5 @@
 
 			if(!hLib){
-				compiler.errorMessenger.Output(-106,pDllProc->GetDllFileName().c_str(),pDllProc->GetCodePos());
+				compiler.errorMessenger.Output(-106,pDllProc->GetDllFileName().c_str(),pDllProc->GetSourceCodePosition().GetPos());
 			}
 		}
@@ -583,5 +583,5 @@
 			if(!GetProcAddress(hLib,pDllProc->GetAlias().c_str())){
 				FreeLibrary(hLib);
-				compiler.errorMessenger.Output(-107,pDllProc->GetAlias(),pDllProc->GetCodePos());
+				compiler.errorMessenger.Output(-107,pDllProc->GetAlias(),pDllProc->GetSourceCodePosition().GetPos());
 			}
 			FreeLibrary(hLib);
Index: trunk/ab5.0/abdev/compiler_x86/NumOpe.cpp
===================================================================
--- trunk/ab5.0/abdev/compiler_x86/NumOpe.cpp	(revision 631)
+++ trunk/ab5.0/abdev/compiler_x86/NumOpe.cpp	(revision 632)
@@ -1032,10 +1032,11 @@
 						isNothing_stack[sp] = true;
 
-						type_stack[sp] = DEF_OBJECT;
 						if( baseType.IsObject() ){
+							type_stack[sp] = DEF_OBJECT;
 							index_stack[sp] = baseType.GetIndex();
 						}
 						else{
-							index_stack[sp] = (LONG_PTR)compiler.GetObjectModule().meta.GetClasses().GetObjectClassPtr();
+							type_stack[sp] = baseType.GetBasicType();
+							index_stack[sp] = baseType.GetIndex();
 						}
 
