Index: BasicCompiler_Common/Class.cpp
===================================================================
--- BasicCompiler_Common/Class.cpp	(revision 31)
+++ BasicCompiler_Common/Class.cpp	(revision 40)
@@ -18,5 +18,5 @@
 
 
-CMember::CMember( CClass *pobj_c, DWORD access, bool isConst, char *buffer, int NowLine ){
+CMember::CMember( CClass *pobj_c, DWORD access, bool isConst, bool isRef, char *buffer, int NowLine ){
 	extern int cp;
 
@@ -25,5 +25,5 @@
 	char init_buf[VN_SIZE];
 	char constract_parameter[VN_SIZE];
-	GetDimentionFormat(buffer,VarName,SubScripts,&TypeInfo,init_buf,constract_parameter);
+	GetDimentionFormat(buffer,isRef,VarName,SubScripts,&TypeInfo,init_buf,constract_parameter);
 
 	//重複チェック
@@ -49,4 +49,7 @@
 	this->isConst = isConst;
 
+	//参照型かどうか
+	this->isRef = isRef;
+
 	//初期データ
 	InitBuf=(char *)HeapAlloc(hHeap,0,lstrlen(init_buf)+1);
@@ -70,4 +73,7 @@
 	//定数扱いかどうか
 	isConst = pobj->isConst;
+
+	//参照型かどうか
+	isRef = pobj->isRef;
 
 	//SubScripts
@@ -91,4 +97,17 @@
 bool CMember::IsConst(){
 	return isConst;
+}
+bool CMember::IsRef(){
+	return isRef;
+}
+
+int CMember::GetSize(){
+	if( IsRef() ){
+		// 参照型
+		return PTR_SIZE;
+	}
+
+	//メンバサイズを取得
+	return GetTypeSize(TypeInfo.type,TypeInfo.u.lpIndex);
 }
 
@@ -264,12 +283,12 @@
 	pobj_InheritsClass = pInheritsClass;
 }
-void CClass::AddMember( DWORD dwAccess, bool isConst, char *buffer ){
+void CClass::AddMember( DWORD dwAccess, bool isConst, bool isRef, char *buffer ){
 	ppobj_Member = (CMember **)HeapReAlloc( hHeap, 0, ppobj_Member, ( iMemberNum + 1 ) * sizeof(CMember *) );
-	ppobj_Member[iMemberNum] = new CMember( this, dwAccess, isConst, buffer );
+	ppobj_Member[iMemberNum] = new CMember( this, dwAccess, isConst, isRef, buffer );
 	iMemberNum++;
 }
-void CClass::AddStaticMember( DWORD dwAccess, bool isConst, char *buffer, int NowLine ){
+void CClass::AddStaticMember( DWORD dwAccess, bool isConst, bool isRef, char *buffer, int NowLine ){
 	ppobj_StaticMember=(CMember **)HeapReAlloc(hHeap,0,ppobj_StaticMember,(iStaticMemberNum+1)*sizeof(CMember *));
-	ppobj_StaticMember[iStaticMemberNum]=new CMember( this, dwAccess, isConst, buffer, NowLine );
+	ppobj_StaticMember[iStaticMemberNum]=new CMember( this, dwAccess, isConst, isRef, buffer, NowLine );
 	iStaticMemberNum++;
 }
@@ -439,5 +458,5 @@
 	//コンポジションの関係にあるメンバも検査する
 	for(int i=0;i < iMemberNum;i++){
-		if(ppobj_Member[i]->TypeInfo.type==DEF_OBJECT){
+		if(ppobj_Member[i]->TypeInfo.type==DEF_OBJECT && ppobj_Member[i]->IsRef() == false){
 			if(ppobj_Member[i]->TypeInfo.u.pobj_Class->IsAbstract())
 				return true;
@@ -809,9 +828,10 @@
 	int i,i2,bRet=1;
 	for(i=0;i<pobj_c->iMemberNum;i++){
-		if(pobj_c->ppobj_Member[i]->TypeInfo.type==DEF_OBJECT){
+		CMember *pMember = pobj_c->ppobj_Member[i];
+		if(pMember->TypeInfo.type==DEF_OBJECT && pMember->IsRef()==false ){
 			//循環参照でないかをチェック
-			if(pobj_LoopRefCheck->check(pobj_c->ppobj_Member[i]->TypeInfo.u.pobj_Class->name)){
+			if(pobj_LoopRefCheck->check(pMember->TypeInfo.u.pobj_Class->name)){
 				extern int cp;
-				SetError(123,pobj_c->ppobj_Member[i]->TypeInfo.u.pobj_Class->name,cp);
+				SetError(124,pMember->TypeInfo.u.pobj_Class->name,cp);
 				return 0;
 			}
@@ -819,5 +839,5 @@
 			pobj_LoopRefCheck->add(pobj_c->name);
 
-			i2=MemberVar_LoopRefCheck(pobj_c->ppobj_Member[i]->TypeInfo.u.pobj_Class);
+			i2=MemberVar_LoopRefCheck(pMember->TypeInfo.u.pobj_Class);
 			if(bRet==1) bRet=i2;
 
@@ -1132,4 +1152,11 @@
 				}
 
+				//Ref修飾子
+				bool isRef = false;
+				if( basbuf[i] == 1 && basbuf[i + 1] == ESC_BYREF ){
+					isRef = true;
+					i += 2;
+				}
+
 				if(basbuf[i]==1&&(
 					basbuf[i+1]==ESC_ABSTRACT||basbuf[i+1]==ESC_VIRTUAL||basbuf[i+1]==ESC_OVERRIDE||
@@ -1209,10 +1236,10 @@
 						//静的メンバを追加
 						cp=i;	//エラー用
-						pobj_c->AddStaticMember( dwAccess, isConst, temporary, i);
+						pobj_c->AddStaticMember( dwAccess, isConst, isRef, temporary, i);
 					}
 					else{
 						//メンバを追加
 						cp=i;	//エラー用
-						pobj_c->AddMember( dwAccess, isConst, temporary );
+						pobj_c->AddMember( dwAccess, isConst, isRef, temporary );
 
 
@@ -1237,4 +1264,9 @@
 				}
 				else{
+					// 文法エラーチェック
+					if( isRef ){
+						SetError(1,NULL,cp);
+					}
+
 					//メソッドを追加
 					cp=i;	//エラー用
