Index: /BasicCompiler32/Compile_CallProc.cpp
===================================================================
--- /BasicCompiler32/Compile_CallProc.cpp (revision 136)
+++ /BasicCompiler32/Compile_CallProc.cpp (revision 137)
@@ -170,5 +170,4 @@
// アクセスエラーチェック
//////////////////////////////
- DWORD dwAccess = pMethod->dwAccess;
if(ObjectName[0]){
@@ -176,5 +175,5 @@
if(pobj_c==pobj_CompilingClass){
//同一クラスオブジェクトの場合はプライベートアクセスを容認する
- if(dwAccess==ACCESS_NON){
+ if( pMethod->IsNoneAccess() ){
SetError(109,pUserProc->GetName(),cp);
return false;
@@ -182,10 +181,10 @@
}
else{
- if(dwAccess==ACCESS_PRIVATE||
- dwAccess==ACCESS_NON){
+ if( pMethod->IsPrivate()
+ || pMethod->IsNoneAccess() ){
SetError(109,pUserProc->GetName(),cp);
return false;
}
- if(dwAccess==ACCESS_PROTECTED){
+ if( pMethod->IsProtected() ){
SetError(110,pUserProc->GetName(),cp);
return false;
@@ -195,5 +194,5 @@
else{
//クラス内部からの呼び出し(継承によるACCESS_NONのみをエラーとする)
- if(dwAccess==ACCESS_NON){
+ if( pMethod->IsNoneAccess() ){
SetError(109,pUserProc->GetName(),cp);
return false;
Index: /BasicCompiler32/Compile_Var.cpp
===================================================================
--- /BasicCompiler32/Compile_Var.cpp (revision 136)
+++ /BasicCompiler32/Compile_Var.cpp (revision 137)
@@ -190,5 +190,5 @@
if(&objClass==pobj_CompilingClass){
//同一クラスオブジェクトの場合はプライベートアクセスを容認する
- if(pMember->dwAccess==ACCESS_NON){
+ if(pMember->IsNoneAccess()){
if(isErrorEnabled) SetError(107,VarName,cp);
return false;
@@ -196,10 +196,10 @@
}
else{
- if((bPrivateAccess==0&&pMember->dwAccess==ACCESS_PRIVATE)||
- pMember->dwAccess==ACCESS_NON){
+ if((bPrivateAccess==0&&pMember->IsPrivate())||
+ pMember->IsNoneAccess()){
if(isErrorEnabled) SetError(107,VarName,cp);
return false;
}
- else if(bPrivateAccess==0&&pMember->dwAccess==ACCESS_PROTECTED){
+ else if(bPrivateAccess==0&&pMember->IsProtected()){
if(isErrorEnabled) SetError(108,VarName,cp);
return false;
@@ -217,5 +217,5 @@
}
- resultType = *pMember;
+ resultType = pMember->GetType();
//ポインタ変数の場合
@@ -243,5 +243,5 @@
if(array[0]){
//配列オフセット
- if(!GetArrayOffset(pMember->SubScripts,array,*pMember)){
+ if(!GetArrayOffset(pMember->SubScripts,array,pMember->GetType())){
if(isErrorEnabled) SetError(14,member,cp);
}
@@ -323,5 +323,5 @@
isErrorEnabled,
isWriteAccess,
- pMember->GetClass(),
+ pMember->GetType().GetClass(),
NestMember,
pRelativeVar,
@@ -755,5 +755,5 @@
if(!SetInitGlobalData(offset+i3,
- *objClass.ppobj_Member[i2],
+ objClass.ppobj_Member[i2]->GetType(),
objClass.ppobj_Member[i2]->SubScripts,
temporary)) return false;
@@ -891,5 +891,5 @@
if(!InitLocalVar(offset+i3,
- *objClass.ppobj_Member[i2],
+ objClass.ppobj_Member[i2]->GetType(),
objClass.ppobj_Member[i2]->SubScripts,
temporary)) return false;
Index: /BasicCompiler64/BasicCompiler.vcproj
===================================================================
--- /BasicCompiler64/BasicCompiler.vcproj (revision 136)
+++ /BasicCompiler64/BasicCompiler.vcproj (revision 137)
@@ -480,12 +480,4 @@
>
-
-
-
-
@@ -500,8 +492,4 @@
-
-
@@ -515,4 +503,20 @@
>
+
+
+
+
+
+
+
+
dwAccess;
if(ObjectName[0]){
@@ -181,5 +180,5 @@
if(pobj_c==pobj_CompilingClass){
//同一クラスオブジェクトの場合はプライベートアクセスを容認する
- if(dwAccess==ACCESS_NON){
+ if( pMethod->IsNoneAccess() ){
SetError(109,pUserProc->GetName(),cp);
return false;
@@ -187,10 +186,10 @@
}
else{
- if(dwAccess==ACCESS_PRIVATE||
- dwAccess==ACCESS_NON){
+ if( pMethod->IsPrivate()
+ || pMethod->IsNoneAccess() ){
SetError(109,pUserProc->GetName(),cp);
return false;
}
- if(dwAccess==ACCESS_PROTECTED){
+ if( pMethod->IsProtected() ){
SetError(110,pUserProc->GetName(),cp);
return false;
@@ -200,5 +199,5 @@
else{
//クラス内部からの呼び出し(継承によるACCESS_NONのみをエラーとする)
- if(dwAccess==ACCESS_NON){
+ if( pMethod->IsNoneAccess() ){
SetError(109,pUserProc->GetName(),cp);
return false;
Index: /BasicCompiler64/Compile_Var.cpp
===================================================================
--- /BasicCompiler64/Compile_Var.cpp (revision 136)
+++ /BasicCompiler64/Compile_Var.cpp (revision 137)
@@ -219,5 +219,5 @@
if(&objClass==pobj_CompilingClass){
//同一クラスオブジェクトの場合はプライベートアクセスを容認する
- if(pMember->dwAccess==ACCESS_NON){
+ if(pMember->IsNoneAccess()){
if(isErrorEnabled) SetError(107,VarName,cp);
return false;
@@ -225,10 +225,10 @@
}
else{
- if((bPrivateAccess==0&&pMember->dwAccess==ACCESS_PRIVATE)||
- pMember->dwAccess==ACCESS_NON){
+ if((bPrivateAccess==0&&pMember->IsPrivate())||
+ pMember->IsNoneAccess()){
if(isErrorEnabled) SetError(107,VarName,cp);
return false;
}
- else if(bPrivateAccess==0&&pMember->dwAccess==ACCESS_PROTECTED){
+ else if(bPrivateAccess==0&&pMember->IsProtected()){
if(isErrorEnabled) SetError(108,VarName,cp);
return false;
@@ -246,5 +246,5 @@
}
- resultType = *pMember;
+ resultType = pMember->GetType();
//ポインタ変数の場合
@@ -273,5 +273,5 @@
if(array[0]){
//配列オフセット
- if(!GetArrayOffset(pMember->SubScripts,array,*pMember)){
+ if(!GetArrayOffset(pMember->SubScripts,array,pMember->GetType())){
if(isErrorEnabled) SetError(14,member,cp);
}
@@ -352,5 +352,5 @@
isErrorEnabled,
isWriteAccess,
- pMember->GetClass(),
+ pMember->GetType().GetClass(),
NestMember,
pRelativeVar,
@@ -777,5 +777,5 @@
if(!SetInitGlobalData(offset+i3,
- *objClass.ppobj_Member[i2],
+ objClass.ppobj_Member[i2]->GetType(),
objClass.ppobj_Member[i2]->SubScripts,
temporary)) return false;
@@ -913,5 +913,5 @@
if(!InitLocalVar(offset+i3,
- *objClass.ppobj_Member[i2],
+ objClass.ppobj_Member[i2]->GetType(),
objClass.ppobj_Member[i2]->SubScripts,
temporary)) return false;
Index: /BasicCompiler_Common/Class.cpp
===================================================================
--- /BasicCompiler_Common/Class.cpp (revision 136)
+++ /BasicCompiler_Common/Class.cpp (revision 137)
@@ -165,8 +165,11 @@
ppobj_Member[iMemberNum]=new CMember( *inheritsClass.ppobj_Member[i3] );
- //dwAccess
- if(inheritsClass.ppobj_Member[i3]->dwAccess==ACCESS_PRIVATE)
- ppobj_Member[iMemberNum]->dwAccess=ACCESS_NON;
- else ppobj_Member[iMemberNum]->dwAccess=inheritsClass.ppobj_Member[i3]->dwAccess;
+ // アクセシビリティ
+ if( inheritsClass.ppobj_Member[i3]->IsPrivate() ){
+ ppobj_Member[iMemberNum]->SetAccessibility( Prototype::None );
+ }
+ else{
+ ppobj_Member[iMemberNum]->SetAccessibility( inheritsClass.ppobj_Member[i3]->GetAccessibility() );
+ }
iMemberNum++;
@@ -177,8 +180,11 @@
CMethod *pMethod = new DynamicMethod( *pBaseMethod );
- //dwAccess
- if(pBaseMethod->dwAccess==ACCESS_PRIVATE)
- pMethod->dwAccess=ACCESS_NON;
- else pMethod->dwAccess=pBaseMethod->dwAccess;
+ // アクセシビリティ
+ if(pBaseMethod->GetAccessibility() == Prototype::Private){
+ pMethod->SetAccessibility( Prototype::None );
+ }
+ else{
+ pMethod->SetAccessibility( pBaseMethod->GetAccessibility() );
+ }
//pobj_Inherits
@@ -221,8 +227,11 @@
CMethod *pMethod = new DynamicMethod( *pBaseMethod );
- //dwAccess
- if(pBaseMethod->dwAccess==ACCESS_PRIVATE)
- pMethod->dwAccess=ACCESS_NON;
- else pMethod->dwAccess=pBaseMethod->dwAccess;
+ // アクセシビリティ
+ if(pBaseMethod->GetAccessibility() == Prototype::Private){
+ pMethod->SetAccessibility( Prototype::None );
+ }
+ else{
+ pMethod->SetAccessibility( pBaseMethod->GetAccessibility() );
+ }
//pobj_Inherits
@@ -245,11 +254,11 @@
return true;
}
-void CClass::AddMember( DWORD dwAccess, bool isConst, bool isRef, char *buffer ){
+void CClass::AddMember( Prototype::Accessibility accessibility, 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, isRef, buffer );
+ ppobj_Member[iMemberNum] = new CMember( this, accessibility, isConst, isRef, buffer );
iMemberNum++;
}
-void CClass::AddStaticMember( DWORD dwAccess, bool isConst, bool isRef, char *buffer, int nowLine ){
- CMember *member = new CMember( this, dwAccess, isConst, isRef, buffer, nowLine );
+void CClass::AddStaticMember( Prototype::Accessibility accessibility, bool isConst, bool isRef, char *buffer, int nowLine ){
+ CMember *member = new CMember( this, accessibility, isConst, isRef, buffer, nowLine );
staticMembers.push_back( member );
}
@@ -326,11 +335,11 @@
CMember *pMember = ppobj_Member[i];
- i2 = pMember->GetSize();
+ i2 = pMember->GetType().GetSize();
//アラインメントを算出
int member_size;
- if( pMember->IsStruct() ){
+ if( pMember->GetType().IsStruct() ){
//メンバクラスのアラインメントを取得
- member_size=pMember->GetClass().GetAlignment();
+ member_size=pMember->GetType().GetClass().GetAlignment();
}
else{
@@ -393,11 +402,11 @@
CMember *pMember = ppobj_Member[i];
- if(pMember->IsStruct()){
+ if(pMember->GetType().IsStruct()){
//メンバクラスのアラインメントを取得
- member_size=pMember->GetClass().GetAlignment();
+ member_size=pMember->GetType().GetClass().GetAlignment();
}
else{
//メンバサイズを取得
- member_size = pMember->GetSize();
+ member_size = pMember->GetType().GetSize();
}
@@ -837,5 +846,5 @@
-void CDBClass::AddMethod(CClass *pobj_c, DWORD dwAccess, BOOL bStatic, bool isConst, bool isAbstract,
+void CDBClass::AddMethod(CClass *pobj_c, Prototype::Accessibility accessibility, BOOL bStatic, bool isConst, bool isAbstract,
bool isVirtual, bool isOverride, char *buffer, int nowLine){
int i,i2;
@@ -932,5 +941,5 @@
SetError(127,NULL,nowLine);
}
- if(pMethod->dwAccess!=dwAccess){
+ if(pMethod->GetAccessibility() != accessibility ){
SetError(128,NULL,nowLine);
}
@@ -952,8 +961,8 @@
if(bStatic){
- pobj_c->staticMethods.AddStatic(pUserProc,dwAccess);
+ pobj_c->staticMethods.AddStatic( pUserProc, accessibility );
}
else{
- pobj_c->methods.Add(pUserProc, dwAccess, isConst, isAbstract, isVirtual);
+ pobj_c->methods.Add(pUserProc, accessibility, isConst, isAbstract, isVirtual);
}
}
@@ -963,9 +972,9 @@
for(i=0;iIsStruct()){
+ if(pMember->GetType().IsStruct()){
//循環参照でないかをチェック
- if(pobj_LoopRefCheck->check(pMember->GetClass())){
+ if(pobj_LoopRefCheck->check(pMember->GetType().GetClass())){
extern int cp;
- SetError(124,pMember->GetClass().GetName(),cp);
+ SetError(124,pMember->GetType().GetClass().GetName(),cp);
return 0;
}
@@ -973,5 +982,5 @@
pobj_LoopRefCheck->add(objClass.GetName().c_str());
- i2=MemberVar_LoopRefCheck(pMember->GetClass());
+ i2=MemberVar_LoopRefCheck(pMember->GetType().GetClass());
if(bRet==1) bRet=i2;
@@ -986,5 +995,4 @@
extern char *basbuf;
int i,i2,i3,sub_address,top_pos;
- DWORD dwAccess;
char temporary[8192];
@@ -1140,5 +1148,5 @@
//メンバ関数を追加
AddMethod(pobj_c,
- ACCESS_PUBLIC, //Publicアクセス権
+ Prototype::Public, //Publicアクセス権
0, //Static指定なし
false, //Constではない
@@ -1212,6 +1220,11 @@
//アクセス制限の初期値をセット
- if(dwClassType==ESC_CLASS) dwAccess=ACCESS_PRIVATE;
- else dwAccess=ACCESS_PUBLIC;
+ Prototype::Accessibility accessibility;
+ if(dwClassType==ESC_CLASS){
+ accessibility = Prototype::Private;
+ }
+ else{
+ accessibility = Prototype::Public;
+ }
if( pobj_c->GetName() == "Object" || dwClassType == ESC_TYPE ){
@@ -1342,13 +1355,13 @@
//アクセスを変更
if(lstrcmpi(temporary,"Private")==0){
- dwAccess=ACCESS_PRIVATE;
+ accessibility = Prototype::Private;
continue;
}
if(lstrcmpi(temporary,"Public")==0){
- dwAccess=ACCESS_PUBLIC;
+ accessibility = Prototype::Public;
continue;
}
if(lstrcmpi(temporary,"Protected")==0){
- dwAccess=ACCESS_PROTECTED;
+ accessibility = Prototype::Protected;
continue;
}
@@ -1359,26 +1372,26 @@
//静的メンバを追加
cp=i; //エラー用
- pobj_c->AddStaticMember( dwAccess, isConst, false, temporary, i);
+ pobj_c->AddStaticMember( accessibility, isConst, false, temporary, i);
}
else{
//メンバを追加
cp=i; //エラー用
- pobj_c->AddMember( dwAccess, isConst, false, temporary );
-
-
- if(pobj_c->ppobj_Member[pobj_c->iMemberNum-1]->IsStruct()){
- if(pobj_c->ppobj_Member[pobj_c->iMemberNum-1]->GetClass().ppobj_Member==0){
+ pobj_c->AddMember( accessibility, isConst, false, temporary );
+
+
+ if(pobj_c->ppobj_Member[pobj_c->iMemberNum-1]->GetType().IsStruct()){
+ if(pobj_c->ppobj_Member[pobj_c->iMemberNum-1]->GetType().GetClass().ppobj_Member==0){
//参照先が読み取られていないとき
- GetClass_recur(pobj_c->ppobj_Member[pobj_c->iMemberNum-1]->GetClass().GetName().c_str());
+ GetClass_recur(pobj_c->ppobj_Member[pobj_c->iMemberNum-1]->GetType().GetClass().GetName().c_str());
}
}
- if(pobj_c->ppobj_Member[pobj_c->iMemberNum-1]->IsStruct()){
+ if(pobj_c->ppobj_Member[pobj_c->iMemberNum-1]->GetType().IsStruct()){
//循環参照のチェック
pobj_LoopRefCheck->add(pobj_c->GetName().c_str());
- if(!MemberVar_LoopRefCheck(pobj_c->ppobj_Member[pobj_c->iMemberNum-1]->GetClass())){
+ if(!MemberVar_LoopRefCheck(pobj_c->ppobj_Member[pobj_c->iMemberNum-1]->GetType().GetClass())){
//エラー回避
- pobj_c->ppobj_Member[pobj_c->iMemberNum-1]->SetBasicType( DEF_PTR_VOID );
+ pobj_c->ppobj_Member[pobj_c->iMemberNum-1]->GetType().SetBasicType( DEF_PTR_VOID );
}
pobj_LoopRefCheck->del(pobj_c->GetName().c_str());
@@ -1390,5 +1403,5 @@
cp=i; //エラー用
AddMethod(pobj_c,
- dwAccess,
+ accessibility,
bStatic,
isConst,
@@ -1466,5 +1479,5 @@
CMember &member = *objClass.ppobj_Member[i];
- if( member.IsObject() || member.IsPointer() ){
+ if( member.GetType().IsObject() || member.GetType().IsPointer() ){
if( referenceOffsetsBuffer[0] ){
lstrcat( referenceOffsetsBuffer, "," );
Index: /BasicCompiler_Common/Class.h
===================================================================
--- /BasicCompiler_Common/Class.h (revision 136)
+++ /BasicCompiler_Common/Class.h (revision 137)
@@ -8,9 +8,4 @@
#include
#include "Procedure.h"
-
-#define ACCESS_NON 0
-#define ACCESS_PRIVATE 1
-#define ACCESS_PUBLIC 2
-#define ACCESS_PROTECTED 3
class CDBClass;
@@ -88,6 +83,4 @@
int iAlign;
-
-public:
CClass( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const string &name );
~CClass();
@@ -130,6 +123,6 @@
//メンバ、メソッドの追加
- void AddMember( DWORD dwAccess, bool idConst, bool isRef, char *buffer );
- void AddStaticMember( DWORD dwAccess, bool isConst, bool isRef, char *buffer, int nowLine );
+ void AddMember( Prototype::Accessibility accessibility, bool idConst, bool isRef, char *buffer );
+ void AddStaticMember( Prototype::Accessibility accessibility, bool isConst, bool isRef, char *buffer, int nowLine );
//重複チェック
@@ -230,5 +223,5 @@
private:
- void AddMethod(CClass *pobj_c, DWORD dwAccess, BOOL bStatic, bool isConst, bool isAbstract,
+ void AddMethod(CClass *pobj_c, Prototype::Accessibility accessibility, BOOL bStatic, bool isConst, bool isAbstract,
bool isVirtual, bool isOverride, char *buffer, int nowLine);
BOOL MemberVar_LoopRefCheck(const CClass &objClass);
Index: /BasicCompiler_Common/DebugMiddleFile.cpp
===================================================================
--- /BasicCompiler_Common/DebugMiddleFile.cpp (revision 136)
+++ /BasicCompiler_Common/DebugMiddleFile.cpp (revision 137)
@@ -327,19 +327,21 @@
i2+=sizeof(long);
for(i4=0;i4iMemberNum;i4++){
+ // 名前
lstrcpy(buffer+i2,pobj_c->ppobj_Member[i4]->GetName().c_str());
i2+=lstrlen(buffer+i2)+1;
+ // 型
+ *(long *)(buffer+i2)=pobj_c->ppobj_Member[i4]->GetType().GetBasicType();
+ i2+=sizeof(long);
+
+ // 型の拡張情報
+ SetLpIndex_DebugFile(buffer,&i2,pobj_c->ppobj_Member[i4]->GetType());
+
+ // アクセシビリティ
+ *(Prototype::Accessibility *)(buffer+i2)=pobj_c->ppobj_Member[i4]->GetAccessibility();
+ i2+=sizeof(Prototype::Accessibility);
+
memcpy(buffer+i2,pobj_c->ppobj_Member[i4]->SubScripts,sizeof(int)*MAX_ARRAYDIM);
i2+=sizeof(int)*MAX_ARRAYDIM;
-
- //型
- *(long *)(buffer+i2)=pobj_c->ppobj_Member[i4]->GetBasicType();
- i2+=sizeof(long);
-
- //型の拡張情報
- SetLpIndex_DebugFile(buffer,&i2,*pobj_c->ppobj_Member[i4]);
-
- *(long *)(buffer+i2)=pobj_c->ppobj_Member[i4]->dwAccess;
- i2+=sizeof(long);
//バッファが足りない場合は再確保
@@ -354,6 +356,6 @@
i2+=sizeof(long);
foreach( const CMethod *pMethod, pobj_c->methods ){
- *(long *)(buffer+i2)=pMethod->dwAccess;
- i2+=sizeof(long);
+ *(Prototype::Accessibility *)(buffer+i2)=pMethod->GetAccessibility();
+ i2+=sizeof(Prototype::Accessibility);
if( pMethod->GetInheritsClassPtr() ){
lstrcpy(buffer+i2,pMethod->GetInheritsClassPtr()->GetName().c_str());
@@ -372,19 +374,21 @@
i2+=sizeof(long);
foreach( CMember *member, pobj_c->staticMembers ){
+ // 名前
lstrcpy(buffer+i2,member->GetName().c_str());
i2+=lstrlen(buffer+i2)+1;
+ // 型
+ *(long *)(buffer+i2)=member->GetType().GetBasicType();
+ i2+=sizeof(long);
+
+ // 型の拡張情報
+ SetLpIndex_DebugFile(buffer,&i2,member->GetType());
+
+ // アクセシビリティ
+ *(Prototype::Accessibility *)(buffer+i2)=member->GetAccessibility();
+ i2+=sizeof(Prototype::Accessibility);
+
memcpy(buffer+i2,member->SubScripts,sizeof(int)*MAX_ARRAYDIM);
i2+=sizeof(int)*MAX_ARRAYDIM;
-
- //型
- *(long *)(buffer+i2)=member->GetBasicType();
- i2+=sizeof(long);
-
- //型の拡張情報
- SetLpIndex_DebugFile(buffer,&i2,*member);
-
- *(long *)(buffer+i2)=member->dwAccess;
- i2+=sizeof(long);
//バッファが足りない場合は再確保
@@ -707,23 +711,24 @@
(CMember **)HeapAlloc(hHeap,0,pobj_c->iMemberNum*sizeof(CMember *));
for(i4=0;i4iMemberNum;i4++){
- pobj_c->ppobj_Member[i4]=new CMember();
-
- pobj_c->ppobj_Member[i4]->SetName( (char *)(buffer+i2) );
+
+ // 名前
+ string name = (char *)(buffer+i2);
i2+=lstrlen(buffer+i2)+1;
+
+ // 型
+ Type type( *(long *)(buffer+i2) );
+ i2+=sizeof(long);
+
+ // 型の拡張情報
+ GetLpIndex_DebugFile(buffer,&i2,type);
+
+ // アクセシビリティ
+ Prototype::Accessibility accessibility = *(Prototype::Accessibility *)(buffer+i2);
+ i2+=sizeof(Prototype::Accessibility);
+
+ pobj_c->ppobj_Member[i4]=new CMember( accessibility, name, type, false );
memcpy(pobj_c->ppobj_Member[i4]->SubScripts,buffer+i2,sizeof(int)*MAX_ARRAYDIM);
i2+=sizeof(int)*MAX_ARRAYDIM;
-
- //型
- Type type( *(long *)(buffer+i2) );
- i2+=sizeof(long);
-
- //型の拡張情報
- GetLpIndex_DebugFile(buffer,&i2,type);
-
- pobj_c->ppobj_Member[i4]->SetType( type.GetBasicType(), type.GetIndex() );
-
- pobj_c->ppobj_Member[i4]->dwAccess=*(long *)(buffer+i2);
- i2+=sizeof(long);
}
@@ -733,6 +738,6 @@
for( i4=0; i4methods.push_back( pMethod );
@@ -767,23 +772,23 @@
i2+=sizeof(long);
for( i4=0; i4SetName( (char *)(buffer+i2) );
+ // 名前
+ string name = (char *)(buffer+i2);
i2+=lstrlen(buffer+i2)+1;
+
+ // 型
+ Type type( *(long *)(buffer+i2) );
+ i2+=sizeof(long);
+
+ // 型の拡張情報
+ GetLpIndex_DebugFile(buffer,&i2,type);
+
+ // アクセシビリティ
+ Prototype::Accessibility accessibility = *(Prototype::Accessibility *)(buffer+i2);
+ i2+=sizeof(Prototype::Accessibility);
+
+ CMember *member=new CMember( accessibility, name, type, false );
memcpy(member->SubScripts,buffer+i2,sizeof(int)*MAX_ARRAYDIM);
i2+=sizeof(int)*MAX_ARRAYDIM;
-
- //型
- Type type( *(long *)(buffer+i2) );
- i2+=sizeof(long);
-
- //型の拡張情報
- GetLpIndex_DebugFile(buffer,&i2,type);
-
- member->SetType( type.GetBasicType(), type.GetIndex() );
-
- member->dwAccess=*(long *)(buffer+i2);
- i2+=sizeof(long);
pobj_c->staticMembers.push_back( member );
Index: /BasicCompiler_Common/VarList.cpp
===================================================================
--- /BasicCompiler_Common/VarList.cpp (revision 136)
+++ /BasicCompiler_Common/VarList.cpp (revision 137)
@@ -188,5 +188,5 @@
VarList_Array(hVarTree,hParent,
pTopOffset+offset,
- *objClass.ppobj_Member[i],
+ objClass.ppobj_Member[i]->GetType(),
objClass.ppobj_Member[i]->SubScripts);
}
@@ -196,5 +196,5 @@
&tv,
VarName,
- *objClass.ppobj_Member[i],
+ objClass.ppobj_Member[i]->GetType(),
pTopOffset+offset);
}
@@ -437,5 +437,5 @@
VarList_Array(hVarTree_This,hParent,
pThis+offset,
- *pUserProc->GetParentClassPtr()->ppobj_Member[i],
+ pUserProc->GetParentClassPtr()->ppobj_Member[i]->GetType(),
pUserProc->GetParentClassPtr()->ppobj_Member[i]->SubScripts);
}
@@ -443,5 +443,5 @@
VarList_Insert(hVarTree_This,&tv,
pUserProc->GetParentClassPtr()->ppobj_Member[i]->GetName().c_str(),
- *pUserProc->GetParentClassPtr()->ppobj_Member[i],
+ pUserProc->GetParentClassPtr()->ppobj_Member[i]->GetType(),
pThis+offset);
}
Index: /BasicCompiler_Common/VariableOpe.cpp
===================================================================
--- /BasicCompiler_Common/VariableOpe.cpp (revision 136)
+++ /BasicCompiler_Common/VariableOpe.cpp (revision 137)
@@ -571,5 +571,5 @@
if( &objClass == pobj_CompilingClass ){
//同一クラスオブジェクトの場合はプライベートアクセスを容認する
- if(objClass.ppobj_Member[i]->dwAccess==ACCESS_NON){
+ if( objClass.ppobj_Member[i]->IsNoneAccess() ){
if(isErrorEnabled) SetError(107,VarName,cp);
return false;
@@ -577,10 +577,10 @@
}
else{
- if((bPrivateAccess==0&&objClass.ppobj_Member[i]->dwAccess==ACCESS_PRIVATE)||
- objClass.ppobj_Member[i]->dwAccess==ACCESS_NON){
+ if(( bPrivateAccess==0 && objClass.ppobj_Member[i]->IsPrivate() )||
+ objClass.ppobj_Member[i]->IsNoneAccess() ){
if(isErrorEnabled) SetError(107,VarName,cp);
return false;
}
- else if(bPrivateAccess==0&&objClass.ppobj_Member[i]->dwAccess==ACCESS_PROTECTED){
+ else if( bPrivateAccess==0 && objClass.ppobj_Member[i]->IsProtected() ){
if(isErrorEnabled) SetError(108,VarName,cp);
return false;
@@ -588,5 +588,5 @@
}
- resultType = *objClass.ppobj_Member[i];
+ resultType = objClass.ppobj_Member[i]->GetType();
//ポインタ変数の場合
@@ -607,5 +607,5 @@
//入れ子構造の場合
- return GetMemberType( objClass.ppobj_Member[i]->GetClass(),
+ return GetMemberType( objClass.ppobj_Member[i]->GetType().GetClass(),
NestMember,
resultType,
Index: /BasicCompiler_Common/WatchList.cpp
===================================================================
--- /BasicCompiler_Common/WatchList.cpp (revision 136)
+++ /BasicCompiler_Common/WatchList.cpp (revision 137)
@@ -129,12 +129,12 @@
//アクセシビリティをチェック
- if((bPrivateAccess==0&&objClass.ppobj_Member[i]->dwAccess==ACCESS_PRIVATE)||
- objClass.ppobj_Member[i]->dwAccess==ACCESS_NON){
+ if(( bPrivateAccess==0 && objClass.ppobj_Member[i]->IsPrivate() )||
+ objClass.ppobj_Member[i]->IsNoneAccess() ){
return 0;
}
- else if(bPrivateAccess==0&&objClass.ppobj_Member[i]->dwAccess==ACCESS_PROTECTED)
+ else if(bPrivateAccess==0&&objClass.ppobj_Member[i]->IsProtected())
return 0;
- resultType = *objClass.ppobj_Member[i];
+ resultType = objClass.ppobj_Member[i]->GetType();
//ポインタ変数の場合
@@ -209,5 +209,5 @@
}
- i2=Debugging_GetMember(objClass.ppobj_Member[i]->GetClass(),
+ i2=Debugging_GetMember(objClass.ppobj_Member[i]->GetType().GetClass(),
NestMember,
pRelativeVar,
Index: /BasicCompiler_Common/include/Member.h
===================================================================
--- /BasicCompiler_Common/include/Member.h (revision 136)
+++ /BasicCompiler_Common/include/Member.h (revision 137)
@@ -10,12 +10,11 @@
class CClass;
-class CMember : public Type
+class CMember : public MemberPrototype
{
string name;
+ Type type;
bool isConst;
public:
int SubScripts[MAX_ARRAYDIM];
-
- DWORD dwAccess;
char *InitBuf;
@@ -33,4 +32,9 @@
}
+ Type GetType() const
+ {
+ return type;
+ }
+
bool IsConst()
{
@@ -38,8 +42,12 @@
}
- CMember()
+ CMember( Prototype::Accessibility accessibility, const string &name, const Type &type, bool isConst )
+ : MemberPrototype( accessibility )
+ , name( name )
+ , type( type )
+ , isConst( isConst )
{
}
- CMember( CClass *pobj_c, DWORD access, bool idConst, bool isRef, char *buffer, int nowLine=-1 );
+ CMember( CClass *pobj_c, Prototype::Accessibility accessibility, bool idConst, bool isRef, char *buffer, int nowLine=-1 );
CMember( CMember &member );
~CMember();
Index: /BasicCompiler_Common/include/Method.h
===================================================================
--- /BasicCompiler_Common/include/Method.h (revision 136)
+++ /BasicCompiler_Common/include/Method.h (revision 137)
@@ -4,4 +4,5 @@
#include
+#include "../Class.h"
#include
@@ -12,13 +13,12 @@
void SetError();
-class CMethod
+class CMethod : public MemberPrototype
{
public:
UserProc *pUserProc;
- DWORD dwAccess;
- CMethod( UserProc *pUserProc, DWORD dwAccess )
- : pUserProc( pUserProc )
- , dwAccess( dwAccess )
+ CMethod( UserProc *pUserProc, Prototype::Accessibility accessibility )
+ : MemberPrototype( accessibility )
+ , pUserProc( pUserProc )
{
}
@@ -41,6 +41,6 @@
public:
- DynamicMethod( UserProc *pUserProc, DWORD dwAccess, bool isAbstract, bool isVirtual, bool isConst, const CClass *pInheritsClass = NULL )
- : CMethod( pUserProc, dwAccess )
+ DynamicMethod( UserProc *pUserProc, Prototype::Accessibility accessibility, bool isAbstract, bool isVirtual, bool isConst, const CClass *pInheritsClass = NULL )
+ : CMethod( pUserProc, accessibility )
, isAbstract( isAbstract )
, isVirtual( isVirtual )
@@ -50,5 +50,5 @@
}
DynamicMethod( const CMethod &method )
- : CMethod( method.pUserProc, method.dwAccess )
+ : CMethod( method.pUserProc, method.GetAccessibility() )
, isAbstract( method.IsAbstract() )
, isVirtual( method.IsVirtual() )
@@ -90,6 +90,6 @@
{
public:
- StaticMethod( UserProc *pUserProc, DWORD dwAccess )
- : CMethod( pUserProc, dwAccess )
+ StaticMethod( UserProc *pUserProc, Prototype::Accessibility accessibility )
+ : CMethod( pUserProc, accessibility )
{
}
@@ -116,6 +116,6 @@
//メンバ、メソッドの追加
- void Add( UserProc *pUserProc,DWORD dwAccess, bool isConst, bool isAbstract, bool isVirtual );
- void AddStatic(UserProc *pUserProc,DWORD dwAccess);
+ void Add( UserProc *pUserProc, Prototype::Accessibility accessibility, bool isConst, bool isAbstract, bool isVirtual );
+ void AddStatic(UserProc *pUserProc,Prototype::Accessibility accessibility);
const CMethod *GetMethodPtr( UserProc *pUserProc ) const;
Index: /BasicCompiler_Common/include/Prototype.h
===================================================================
--- /BasicCompiler_Common/include/Prototype.h (revision 136)
+++ /BasicCompiler_Common/include/Prototype.h (revision 137)
@@ -13,4 +13,13 @@
class Prototype
{
+public:
+ enum Accessibility{
+ None,
+ Private,
+ Protected,
+ Public,
+ };
+
+private:
// 名前空間
NamespaceScopes namespaceScopes;
@@ -69,2 +78,37 @@
};
+
+class MemberPrototype
+{
+ Prototype::Accessibility accessibility;
+public:
+ MemberPrototype( Prototype::Accessibility accessibility )
+ : accessibility( accessibility )
+ {
+ }
+
+ Prototype::Accessibility GetAccessibility() const
+ {
+ return accessibility;
+ }
+ void SetAccessibility( Prototype::Accessibility accessibility ){
+ this->accessibility = accessibility;
+ }
+
+ bool IsNoneAccess() const
+ {
+ return ( accessibility == Prototype::None );
+ }
+ bool IsPrivate() const
+ {
+ return ( accessibility == Prototype::Private );
+ }
+ bool IsProtected() const
+ {
+ return ( accessibility == Prototype::Protected );
+ }
+ bool IsPublic() const
+ {
+ return ( accessibility == Prototype::Public );
+ }
+};
Index: /BasicCompiler_Common/src/Member.cpp
===================================================================
--- /BasicCompiler_Common/src/Member.cpp (revision 136)
+++ /BasicCompiler_Common/src/Member.cpp (revision 137)
@@ -7,5 +7,7 @@
#include
-CMember::CMember( CClass *pobj_c, DWORD access, bool isConst, bool isRef, char *buffer, int nowLine ){
+CMember::CMember( CClass *pobj_c, Prototype::Accessibility accessibility, bool isConst, bool isRef, char *buffer, int nowLine )
+ : MemberPrototype( accessibility )
+{
extern int cp;
@@ -14,5 +16,5 @@
char init_buf[VN_SIZE];
char constract_parameter[VN_SIZE];
- GetDimentionFormat(buffer,VarName,SubScripts,*this,init_buf,constract_parameter);
+ GetDimentionFormat(buffer,VarName,SubScripts,type,init_buf,constract_parameter);
//重複チェック
@@ -23,7 +25,4 @@
//メンバ名
name = VarName;
-
- //アクセス権
- dwAccess=access;
//定数扱いかどうか
@@ -41,14 +40,10 @@
source_code_address=nowLine;
}
-CMember::CMember(CMember &member):
- Type( member )
+CMember::CMember(CMember &member)
+ : MemberPrototype( member.GetAccessibility() )
+ , name( member.GetName() )
+ , type( member.GetType() )
+ , isConst( member.IsConst() )
{
-
- //name
- name = member.name;
-
- //定数扱いかどうか
- isConst = member.isConst;
-
//SubScripts
memcpy(SubScripts,member.SubScripts,MAX_ARRAYDIM*sizeof(int));
@@ -84,5 +79,5 @@
temporary,
member->SubScripts,
- *member,
+ member->GetType(),
member->InitBuf,
member->ConstractParameter,
Index: /BasicCompiler_Common/src/Method.cpp
===================================================================
--- /BasicCompiler_Common/src/Method.cpp (revision 136)
+++ /BasicCompiler_Common/src/Method.cpp (revision 137)
@@ -14,11 +14,11 @@
}
-void Methods::Add( UserProc *pUserProc,DWORD dwAccess, bool isConst, bool isAbstract, bool isVirtual ){
- CMethod *pMethod = new DynamicMethod( pUserProc, dwAccess, isAbstract, isVirtual, isConst );
+void Methods::Add( UserProc *pUserProc,Prototype::Accessibility accessibility, bool isConst, bool isAbstract, bool isVirtual ){
+ CMethod *pMethod = new DynamicMethod( pUserProc, accessibility, isAbstract, isVirtual, isConst );
this->push_back( pMethod );
pUserProc->SetMethod( pMethod );
}
-void Methods::AddStatic(UserProc *pUserProc,DWORD dwAccess){
- CMethod *pMethod = new StaticMethod( pUserProc, dwAccess );
+void Methods::AddStatic(UserProc *pUserProc, Prototype::Accessibility accessibility ){
+ CMethod *pMethod = new StaticMethod( pUserProc, accessibility );
this->push_back( pMethod );
pUserProc->SetMethod( pMethod );