Index: BasicCompiler32/BasicCompiler.vcproj
===================================================================
--- BasicCompiler32/BasicCompiler.vcproj	(revision 78)
+++ BasicCompiler32/BasicCompiler.vcproj	(revision 79)
@@ -147,5 +147,5 @@
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\cpplibs\boost"
+				AdditionalIncludeDirectories="..\cpplibs\boost;..\BasicCompiler_Common\include"
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;JPN"
 				StringPooling="true"
@@ -245,5 +245,5 @@
 				Optimization="2"
 				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="..\cpplibs\boost"
+				AdditionalIncludeDirectories="..\cpplibs\boost;..\BasicCompiler_Common\include"
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;ENG"
 				StringPooling="true"
Index: BasicCompiler32/Compile_Func.cpp
===================================================================
--- BasicCompiler32/Compile_Func.cpp	(revision 78)
+++ BasicCompiler32/Compile_Func.cpp	(revision 79)
@@ -340,19 +340,16 @@
 	pUserProc->Using();
 }
-void Opcode_Func_SizeOf(const char *Parameter){
-	LONG_PTR lpIndex;
-	int type = GetTypeFixed(Parameter,&lpIndex);
-
-	int size;
-	if( type == DEF_OBJECT ){
-		CClass *pClass = (CClass *)lpIndex;
-		size = pClass->GetSize();
-	}
-	else{
-		size=GetTypeSize(type,lpIndex);
-	}
+void Opcode_Func_SizeOf( const string &typeName ){
+	Type tempType;
+	if( !Type::StringToType( typeName, tempType ) ){
+		SetError(3,typeName,cp);
+		return;
+	}
+
+	int typeSize = ( tempType.IsObject() ) ?
+		tempType.GetClass().GetSize() : tempType.GetSize();
 
 	//mov eax,size
-	op_mov_RV( REG_EAX, size );
+	op_mov_RV( REG_EAX, typeSize );
 }
 void Opcode_Func_VarPtr( const char *Parameter, Type &resultType, bool isCallOn ){
Index: BasicCompiler32/Compile_Var.cpp
===================================================================
--- BasicCompiler32/Compile_Var.cpp	(revision 78)
+++ BasicCompiler32/Compile_Var.cpp	(revision 79)
@@ -1079,5 +1079,5 @@
 }
 
-void dim(bool isRef, char *VarName,int *SubScripts,Type &type,char *InitBuf,char *ConstractParameter,DWORD dwFlags){
+void dim( char *VarName,int *SubScripts,Type &type,char *InitBuf,char *ConstractParameter,DWORD dwFlags){
 	if( UserProc::IsGlobalAreaCompiling() ){
 		/////////////////////////
@@ -1085,5 +1085,5 @@
 		/////////////////////////
 
-		AddGlobalVariable(isRef,VarName,SubScripts,type,InitBuf,ConstractParameter,dwFlags);
+		AddGlobalVariable(VarName,SubScripts,type,InitBuf,ConstractParameter,dwFlags);
 	}
 	else{
@@ -1092,5 +1092,5 @@
 		/////////////////
 
-		if( UserProc::CompilingUserProc().localVars.BackSearch( VarName ) ){
+		if( UserProc::CompilingUserProc().localVars.DuplicateCheck( VarName ) ){
 			//２重定義のエラー
 			SetError(15,VarName,cp);
@@ -1100,5 +1100,5 @@
 		bool isConst = ( dwFlags & DIMFLAG_CONST ) ? true:false;
 
-		Variable *pVar = new Variable( VarName, type, isConst, isRef );
+		Variable *pVar = new Variable( VarName, type, isConst );
 
 		if( SubScripts[0] != -1 ){
Index: BasicCompiler32/NumOpe.cpp
===================================================================
--- BasicCompiler32/NumOpe.cpp	(revision 78)
+++ BasicCompiler32/NumOpe.cpp	(revision 79)
@@ -151,4 +151,5 @@
 	int sp;
 	int type_stack[255];
+	bool isNothing_stack[255];
 	LONG_PTR index_stack[255];
 	BOOL bUseHeap[255];
@@ -160,16 +161,24 @@
 		if(idCalc){
 			if(type_stack[sp-2]==DEF_OBJECT){
-				//オーバーロードされたオペレータを呼び出す
-				i2=CallOperatorProc(idCalc,baseType,type_stack,index_stack,bUseHeap,sp);
-				if(i2==0){
-					if(idCalc==CALC_EQUAL) lstrcpy(temp2,"==");
-					else GetCalcName(idCalc,temp2);
-					sprintf(temporary,"Operator %s",temp2);
-					SetError(27,temporary,cp);
-					goto error;
+				if( idCalc == CALC_AS
+					&& type_stack[sp-1] == ( DEF_OBJECT | FLAG_CAST )
+					&& index_stack[sp-1] == index_stack[sp-2]
+					|| isNothing_stack[sp-2] ){
+						// 同一の型、またはNothingに対するAsはAs演算子を呼び出さない
 				}
-				else if(i2==-1) goto error;
-
-				continue;
+				else{
+					//オーバーロードされたオペレータを呼び出す
+					i2=CallOperatorProc(idCalc,baseType,type_stack,index_stack,bUseHeap,sp);
+					if(i2==0){
+						if(idCalc==CALC_EQUAL) lstrcpy(temp2,"==");
+						else GetCalcName(idCalc,temp2);
+						sprintf(temporary,"Operator %s",temp2);
+						SetError(27,temporary,cp);
+						goto error;
+					}
+					else if(i2==-1) goto error;
+
+					continue;
+				}
 			}
 
@@ -181,4 +190,5 @@
 			case 0:
 				index_stack[sp]=-1;
+				isNothing_stack[sp] = false;
 				bUseHeap[sp]=0;
 
@@ -363,4 +373,6 @@
 					// Nothing
 					if( lstrcmp( term, "Nothing" ) == 0 ){
+						isNothing_stack[sp] = true;
+
 						type_stack[sp] = DEF_OBJECT;
 						if( baseType.IsObject() ){
@@ -489,14 +501,11 @@
 					// 型名の場合
 					//////////////
-
-					LONG_PTR lp;
-					i3=GetTypeFixed(term,&lp);
-					if(i3!=-1){
-						type_stack[sp]=i3|FLAG_CAST;
-						index_stack[sp]=lp;
+					Type tempType;
+					if( Type::StringToType( term, tempType ) ){
+						type_stack[sp] = tempType.GetBasicType() | FLAG_CAST;
+						index_stack[sp] = tempType.GetIndex();
 						sp++;
 						break;
 					}
-
 
 
Index: BasicCompiler32/Opcode.h
===================================================================
--- BasicCompiler32/Opcode.h	(revision 78)
+++ BasicCompiler32/Opcode.h	(revision 79)
@@ -190,5 +190,5 @@
 #define DIMFLAG_STATIC					4
 #define DIMFLAG_CONST					8
-void dim(bool isRef, char *VarName,int *SubScripts,Type &type,char *InitBuf,char *ConstractParameter,DWORD dwFlags);
+void dim( char *VarName,int *SubScripts,Type &type,char *InitBuf,char *ConstractParameter,DWORD dwFlags);
 void SetVarPtrToEax(RELATIVE_VAR *pRelativeVar);
 
