Index: /trunk/abdev/BasicCompiler64/Compile_Calc.cpp
===================================================================
--- /trunk/abdev/BasicCompiler64/Compile_Calc.cpp	(revision 415)
+++ /trunk/abdev/BasicCompiler64/Compile_Calc.cpp	(revision 416)
@@ -177,5 +177,5 @@
 
 	//型を識別
-	if( !GetVarType(variable,varType,false) ){
+	if( !GetTermTypeOnlyVariable(variable,varType) ){
 
 		// プロパティ用のメソッドを呼び出す
@@ -205,9 +205,9 @@
 
 	//変数アドレスを取得
-	RELATIVE_VAR VarRelativeVar;
-	bool result = GetVarOffsetReadWrite(
-		variable,
-		&VarRelativeVar,
-		varType);
+	if( !TermOpeOnlyVariable( variable, varType, VarRelativeVar, true ) )
+	{
+		SetError();
+		return;
+	}
 
 	//レジスタのブロッキングを解除
Index: /trunk/abdev/BasicCompiler64/Compile_CallProc.cpp
===================================================================
--- /trunk/abdev/BasicCompiler64/Compile_CallProc.cpp	(revision 415)
+++ /trunk/abdev/BasicCompiler64/Compile_CallProc.cpp	(revision 416)
@@ -128,11 +128,14 @@
 				//"->"によってオブジェクトを指定する通常のメンバ関数呼び出し
 				Type varType;
-				GetVarType( ObjectName, varType, false );
-				if( NATURAL_TYPE( varType.GetBasicType() ) == DEF_OBJECT )
+				if( GetTermType( ObjectName, varType ) )
 				{
-					pobj_c = &varType.GetClass();
-					leftType = varType;
+					if( varType.IsObject() )
+					{
+						pobj_c = &varType.GetClass();
+						leftType = varType;
+					}
 				}
-				else
+
+				if( !pobj_c )
 				{
 					pobj_c=compiler.GetObjectModule().meta.GetClasses().Find(ObjectName);
@@ -319,23 +322,12 @@
 			if(lstrcmpi(ObjectName,"Super")==0) goto InClassMember;
 			else{
-				RELATIVE_VAR RelativeVar;
-				if( pMethod->IsConst() ){
-					//Constアクセスが可能なメソッドの場合
-					if( !GetVarOffsetReadOnly( ObjectName, &RelativeVar, Type() ) ){
-						return false;
-					}
+				bool isLiteral;
+				if( !TermOpe( ObjectName, Type(), Type(), isLiteral, NULL, NULL, false, !pMethod->IsConst() ) )
+				{
+					return false;
 				}
-				else{
-					//Constアクセスが不可能なメソッドの場合
-					if( !GetVarOffsetReadWrite( ObjectName, &RelativeVar, Type() ) ){
-						return false;
-					}
-				}
-
-				SetVarPtrToReg(REG_RCX,&RelativeVar);
-
-				// 参照を実体ポインタにする
-				//mov rcx,qword ptr[rcx]
-				compiler.codeGenerator.op_mov_RM(sizeof(_int64),REG_RCX,REG_RCX,0,MOD_BASE);
+
+				// 実態ポインタをraxにコピー
+				compiler.codeGenerator.op_mov_RR( REG_RCX, REG_RAX );
 			}
 		}
Index: /trunk/abdev/BasicCompiler64/Compile_Statement.cpp
===================================================================
--- /trunk/abdev/BasicCompiler64/Compile_Statement.cpp	(revision 415)
+++ /trunk/abdev/BasicCompiler64/Compile_Statement.cpp	(revision 416)
@@ -97,5 +97,5 @@
 	bool isLiteral;
 	BOOL bUseHeap;
-	bool result = TermOpe( leftTerm, Type(), resultType, isLiteral, &bUseHeap, false, NULL, true );
+	bool result = TermOpe( leftTerm, Type(), resultType, isLiteral, &bUseHeap, NULL, true );
 
 	delete pobj_reg;
Index: /trunk/abdev/BasicCompiler64/MakePeHdr.cpp
===================================================================
--- /trunk/abdev/BasicCompiler64/MakePeHdr.cpp	(revision 415)
+++ /trunk/abdev/BasicCompiler64/MakePeHdr.cpp	(revision 416)
@@ -1647,6 +1647,3 @@
 	//リロケーション情報を解放
 	delete pobj_Reloc;
-
-	//クラスに関するメモリを解放
-	compiler.GetObjectModule().meta.GetClasses().Clear();
 }
Index: /trunk/abdev/BasicCompiler64/NumOpe.cpp
===================================================================
--- /trunk/abdev/BasicCompiler64/NumOpe.cpp	(revision 415)
+++ /trunk/abdev/BasicCompiler64/NumOpe.cpp	(revision 416)
@@ -130,5 +130,5 @@
 	return true;
 }
-bool TermMemberOpe( const Type &leftType, const Type &baseType, Type &resultType, const char *termFull, const char *termLeft, const char *member )
+bool TermMemberOpe( const Type &leftType, const Type &baseType, Type &resultType, const char *termFull, const char *termLeft, const char *member, bool &isVariable, RELATIVE_VAR &relativeVar )
 {
 	const CClass &objClass = leftType.GetClass();
@@ -166,6 +166,6 @@
 				compiler.codeGenerator.op_mov_RR( REG_R11, useReg );
 
-				RELATIVE_VAR relativeVar;
-				relativeVar.dwKind=VAR_DIRECTMEM;
+				RELATIVE_VAR tempRelativeVar;
+				tempRelativeVar.dwKind=VAR_DIRECTMEM;
 
 				if( !_member_offset(
@@ -173,11 +173,10 @@
 					false,	//読み込み専用
 					leftType,
-					VarName,&relativeVar,classType,0))
-				{
-					return false;
+					VarName,&tempRelativeVar,classType,0)){
+						return false;
 				}
 
 				// オブジェクトメンバのポインタをraxにコピー
-				if( !VarToReg( relativeVar, baseType, resultType ) ){
+				if( !VarToReg( tempRelativeVar, baseType, resultType ) ){
 					SetError(11,termFull,cp);
 				}
@@ -222,5 +221,4 @@
 		compiler.codeGenerator.op_mov_RR( REG_R11, useReg );
 
-		RELATIVE_VAR relativeVar;
 		relativeVar.dwKind=VAR_DIRECTMEM;
 
@@ -233,7 +231,6 @@
 		}
 
-		if( !VarToReg( relativeVar, baseType, resultType ) ){
-			SetError(11,termFull,cp);
-		}
+		// 変数として扱う
+		isVariable = true;
 
 		return true;
@@ -268,5 +265,7 @@
 
 				// まずはプロパティ値を取得
-				TermMemberOpe( leftType, baseType, resultType, termFull, termLeft, methodName );
+				bool dummyIsVariable;
+				RELATIVE_VAR dummyRelativeVar;
+				TermMemberOpe( leftType, baseType, resultType, termFull, termLeft, methodName, dummyIsVariable, dummyRelativeVar );
 
 				// 戻り値のオブジェクトインスタンスのインデクサを呼び出す
@@ -275,5 +274,5 @@
 				sprintf( temp2, "%s.%s", termLeft, methodName );
 				Type classType = resultType;
-				return TermMemberOpe( classType, baseType, resultType, termFull, temp2, temporary );
+				return TermMemberOpe( classType, baseType, resultType, termFull, temp2, temporary, isVariable, relativeVar );
 			}
 
@@ -333,5 +332,6 @@
 	return false;
 }
-bool TermOpe( const char *term, const Type &baseType, Type &resultType, bool &isLiteral, BOOL *pbUseHeap, bool isWantObject, bool *pIsClassName, bool isProcedureCallOnly ){
+bool _TermOpe( const char *term, const Type &baseType, Type &resultType, bool &isLiteral, BOOL *pbUseHeap, bool *pIsClassName, bool isProcedureCallOnly, bool &isVariable, RELATIVE_VAR &relativeVar, bool isWriteAccess )
+{
 	char parameter[VN_SIZE];
 
@@ -373,5 +373,5 @@
 		}
 
-		if( !TermOpe( termLeft, baseType, leftType, isLiteral, pbUseHeap, true, &isClassName ) ){
+		if( !TermOpe( termLeft, baseType, leftType, isLiteral, pbUseHeap, &isClassName ) ){
 			goto globalArea;
 		}
@@ -391,5 +391,5 @@
 		}
 
-		return TermMemberOpe( leftType, baseType, resultType, termFull, termLeft, member );
+		return TermMemberOpe( leftType, baseType, resultType, termFull, termLeft, member, isVariable, relativeVar );
 	}
 globalArea:
@@ -554,8 +554,7 @@
 	////////////////////////////////
 
-	RELATIVE_VAR relativeVar;
 	if(GetVarOffset(
 		false,	//エラー表示なし
-		false,	//読み込み専用
+		isWriteAccess,
 		termFull,
 		&relativeVar,resultType)){
@@ -564,7 +563,6 @@
 		//////////
 
-		if( !VarToReg( relativeVar, baseType, resultType ) ){
-			SetError(11,termFull,cp);
-		}
+		// 変数として扱う
+		isVariable = true;
 
 		isLiteral = false;
@@ -637,4 +635,34 @@
 	return false;
 }
+
+bool TermOpe( const char *term, const Type &baseType, Type &resultType, bool &isLiteral, BOOL *pbUseHeap, bool *pIsClassName, bool isProcedureCallOnly, bool isWriteAccess )
+{
+	RELATIVE_VAR relativeVar;
+	bool isVariable = false;
+	bool result = _TermOpe( term, baseType, resultType, isLiteral, pbUseHeap, pIsClassName, isProcedureCallOnly, isVariable, relativeVar, isWriteAccess );
+
+	if( isVariable )
+	{
+		// 変数の場合はeaxに変数ポインタを格納する
+		if( !VarToReg( relativeVar, baseType, resultType ) ){
+			SetError(11,term,cp);
+		}
+	}
+
+	return result;
+}
+bool TermOpeOnlyVariable( const char *term, Type &resultType, RELATIVE_VAR &relativeVar, bool isWriteAccess )
+{
+	bool isLiteral, isVariable = false;
+	bool result = _TermOpe( term, Type(), resultType, isLiteral, NULL, NULL, false, isVariable, relativeVar, isWriteAccess );
+
+	if( !isVariable )
+	{
+		SetError();
+	}
+
+	return result;
+}
+
 
 bool _numope( int *pReg,
Index: /trunk/abdev/BasicCompiler64/Opcode.h
===================================================================
--- /trunk/abdev/BasicCompiler64/Opcode.h	(revision 415)
+++ /trunk/abdev/BasicCompiler64/Opcode.h	(revision 416)
@@ -185,4 +185,5 @@
 
 //NumOpe.cpp
+bool TermOpeOnlyVariable( const char *term, Type &resultType, RELATIVE_VAR &relativeVar, bool isWriteAccess );
 bool TermOpe(
 			 const char *term,
@@ -191,7 +192,7 @@
 			 bool &isLiteral,
 			 BOOL *pbUseHeap,
-			 bool isWantObject = false,
 			 bool *pIsClassName = NULL,
-			 bool isProcedureCallOnly = false );
+			 bool isProcedureCallOnly = false,
+			 bool isWriteAccess = false );
 bool NumOpe( int *pReg,
 		   const char *Command,
