Index: BasicCompiler32/OperatorProc.cpp
===================================================================
--- BasicCompiler32/OperatorProc.cpp	(revision 75)
+++ BasicCompiler32/OperatorProc.cpp	(revision 76)
@@ -2,5 +2,5 @@
 #include "Opcode.h"
 
-void FreeTempObject(int reg,CClass *pobj_c){
+void FreeTempObject(int reg,const CClass *pobj_c){
 	if(!IsSafeReg(reg)) SetError(300,NULL,cp);
 
@@ -22,5 +22,5 @@
 }
 
-int CallOperatorProc(int idCalc,Type *pBaseTypeInfo,int *type,LONG_PTR *index_stack,BOOL *bUseHeap,int &sp){
+int CallOperatorProc(int idCalc, const Type &baseType, int *type_stack,LONG_PTR *index_stack,BOOL *bUseHeap,int &sp){
 	//オーバーロードされたオペレータ関数を呼び出す
 	CClass *pobj_c;
@@ -39,22 +39,4 @@
 
 
-	int i;
-	BOOL bReturnTypeIsObject=1;
-	Type ReturnType={DEF_OBJECT,subs[0]->ReturnType().GetIndex()};
-	foreach( UserProc *pUserProc, subs ){
-		if(pUserProc->ReturnType().IsObject())
-			bReturnTypeIsObject=0;
-	}
-
-	if(bReturnTypeIsObject==0){
-		if(pBaseTypeInfo){
-			if(pBaseTypeInfo->type==DEF_OBJECT){
-				ReturnType.u.lpIndex=pBaseTypeInfo->u.lpIndex;
-			}
-		}
-	}
-
-
-
 	/////////////////////////////////////////////
 	// オーバーロード解決用のパラメータを設定
@@ -64,5 +46,5 @@
 
 	if(bTwoTerm){
-		params.push_back( new Parameter( "", Type( type[sp-1], index_stack[sp-1] ) ) );
+		params.push_back( new Parameter( "", Type( type_stack[sp-1], index_stack[sp-1] ) ) );
 	}
 
@@ -71,10 +53,5 @@
 	if(idCalc==CALC_EQUAL) lstrcpy(temporary,"==");
 	else GetCalcName(idCalc,temporary);
-	Type returnType;
-	if( pBaseTypeInfo ){
-		returnType.SetBasicType( pBaseTypeInfo->type );
-		returnType.SetIndex( pBaseTypeInfo->u.lpIndex );
-	}
-	UserProc *pUserProc = OverloadSolution( temporary, subs, params, returnType );
+	UserProc *pUserProc = OverloadSolution( temporary, subs, params, baseType );
 
 	if(!pUserProc){
@@ -94,5 +71,5 @@
 	}
 
-	for(i=0;i<(int)params.size();i++){
+	for(int i=0;i<(int)params.size();i++){
 		CheckDifferentType(
 			pUserProc->Params()[i]->GetBasicType(),
@@ -108,5 +85,5 @@
 	}
 
-	int right_side_size = GetTypeSize(type[sp-1],index_stack[sp-1]);
+	int right_side_size = GetTypeSize(type_stack[sp-1],index_stack[sp-1]);
 
 	if(bTwoTerm){
@@ -224,5 +201,5 @@
 
 	sp--;
-	type[sp-1]=pUserProc->ReturnType().GetBasicType();
+	type_stack[sp-1]=pUserProc->ReturnType().GetBasicType();
 	index_stack[sp-1]=pUserProc->ReturnType().GetIndex();
 
@@ -237,6 +214,6 @@
 }
 
-void CallCastOperatorProc(int &CalcType,LONG_PTR &lpCalcIndex,BOOL bCalcUseHeap,int ToType,LONG_PTR lpToIndex){
-	int type[10];
+void CallCastOperatorProc(Type &calcType,BOOL bCalcUseHeap,const Type &toType){
+	int type_stack[10];
 	LONG_PTR index_stack[10];
 	BOOL array_bUseHeap[10];
@@ -249,19 +226,16 @@
 
 	//左辺
-	type[0]=CalcType;
-	index_stack[0]=lpCalcIndex;
+	type_stack[0]=calcType.GetBasicType();
+	index_stack[0]=calcType.GetIndex();
 	array_bUseHeap[0]=0;
-	type[1]=ToType;
-	index_stack[1]=lpToIndex;
+	type_stack[1]=toType.GetBasicType();
+	index_stack[1]=toType.GetIndex();
 	array_bUseHeap[1]=0;
 
-	Type BaseTypeInfo={ToType,lpToIndex};
-
-	int iRet;
-	iRet=CallOperatorProc(CALC_AS,&BaseTypeInfo,type,index_stack,array_bUseHeap,sp);
+	int iRet = CallOperatorProc(CALC_AS,toType,type_stack,index_stack,array_bUseHeap,sp);
+
 	if(iRet==1){
 		//成功したとき
-		CalcType=type[0];
-		lpCalcIndex=index_stack[0];
+		calcType.SetType( type_stack[0], index_stack[0] );
 		return;
 	}
@@ -274,5 +248,5 @@
 	SetError(-1,"キャスト演算子がオーバーロードされていません。",cp);
 }
-void CallIndexerGetterProc(CClass *pobj_Class,char *ObjectName,char *Parameter,Type &RetTypeInfo){
+void CallIndexerGetterProc(const CClass *pobj_Class,char *ObjectName,char *Parameter,Type &resultType){
 	std::vector<UserProc *> subs;
 	pobj_Class->EnumMethod( CALC_ARRAY_GET, subs );
@@ -282,5 +256,4 @@
 
 	Opcode_CallProc(Parameter,subs[0],0,ObjectName,DEF_OBJECT);
-	RetTypeInfo.type = subs[0]->ReturnType().GetBasicType();
-	RetTypeInfo.u.lpIndex = subs[0]->ReturnType().GetIndex();
-}
+	resultType = subs[0]->ReturnType();
+}
