ソースを参照

Fixes use of hidden fields and functions..

Brucey 4 年 前
コミット
8fdde60956
4 ファイル変更31 行追加6 行削除
  1. 9 5
      ctranslator.bmx
  2. 18 0
      decl.bmx
  3. 3 0
      iparser.bmx
  4. 1 1
      options.bmx

+ 9 - 5
ctranslator.bmx

@@ -5349,8 +5349,6 @@ End Rem
 
 	Method EmitIfcClassFuncDecl(funcDecl:TFuncDecl)
 
-		If funcDecl.IsPrivate() Return
-
 		funcDecl.Semant
 
 		Local func:String
@@ -5542,8 +5540,6 @@ End Rem
 
 	Method EmitIfcFieldDecl(fieldDecl:TFieldDecl)
 	
-		If fieldDecl.IsPrivate() Return
-	
 		Local f:String
 		If fieldDecl.IsReadOnly() Then
 			f :+ "@"
@@ -5662,6 +5658,10 @@ End Rem
 				flags :+ "S"
 			End If
 			
+			If classDecl.IsPrivate() Then
+				flags :+ "P"
+			End If
+			
 			If classDecl.templateSource Then
 				flags :+ "G"
 			End If
@@ -6749,9 +6749,13 @@ End If
 
 		' classes
 		For Local decl:TDecl=EachIn app.Semanted()
-			If decl.IsPrivate() Continue
 
 			Local cdecl:TClassDecl=TClassDecl( decl )
+			
+			If cdecl And cdecl.IsPrivate() And (Not cdecl.IsStruct() Or (cdecl.IsStruct() And Not cdecl.exposed)) Then
+				Continue
+			End If
+			
 			If cdecl And Not cdecl.declImported
 				EmitIfcClassDecl(cdecl)
 			EndIf

+ 18 - 0
decl.bmx

@@ -874,6 +874,14 @@ Type TFieldDecl Extends TVarDecl
 		End If
 		Return True
 	End Method
+	
+	Method OnSemant()
+		Super.OnSemant()
+		
+		If TObjectType(ty) And TObjectType(ty).classDecl.IsStruct() Then
+			TObjectType(ty).classDecl.exposed = True
+		End If
+	End Method
 
 End Type
 
@@ -2112,10 +2120,18 @@ Type TFuncDecl Extends TBlockDecl
 '			Err "Return type cannot be an array of generic objects."
 		EndIf
 
+		If ClassScope() And TObjectType(retType) And TObjectType(retType).classDecl.IsStruct() And TObjectType(retType).classDecl.IsPrivate() Then
+			TObjectType(retType).classDecl.exposed = True
+		End If
+
 		'semant args
 		For Local arg:TArgDecl=EachIn argDecls
 			InsertDecl arg
 			arg.Semant
+
+			If ClassScope() And TObjectType(arg.ty) And TObjectType(arg.ty).classDecl.IsStruct() And TObjectType(arg.ty).classDecl.IsPrivate() Then
+				TObjectType(arg.ty).classDecl.exposed = True
+			End If
 		Next
 
 		' if we are a function pointer declaration, we just want to semant the args here.
@@ -2444,6 +2460,8 @@ Type TClassDecl Extends TScopeDecl
 	Field objectType:TObjectType '"canned" objectType
 	Field globInit:Int
 	Field templateSource:TTemplateRecord
+	
+	Field exposed:Int
 
 	'Global nullObjectClass:TClassDecl=New TNullDecl.Create( "{NULL}",Null,Null,Null,DECL_ABSTRACT|DECL_EXTERN )
 	

+ 3 - 0
iparser.bmx

@@ -293,6 +293,9 @@ Type TIParser
 								Case Asc("G")
 									class.attrs :| CLASS_GENERIC
 									parsed = True
+								Case Asc("P")
+									class.attrs :| DECL_PRIVATE
+									parsed = True
 							End Select
 						Next
 

+ 1 - 1
options.bmx

@@ -25,7 +25,7 @@ SuperStrict
 
 Import "base.configmap.bmx"
 
-Const version:String = "0.128"
+Const version:String = "0.129"
 
 Const BUILDTYPE_APP:Int = 0
 Const BUILDTYPE_MODULE:Int = 1