2
0
Эх сурвалжийг харах

Don't null object test struct variables.
Fixed struct init with object fields.

woollybah 8 жил өмнө
parent
commit
e34d2404f3
1 өөрчлөгдсөн 2 нэмэгдсэн , 3 устгасан
  1. 2 3
      ctranslator.bmx

+ 2 - 3
ctranslator.bmx

@@ -1508,7 +1508,7 @@ t:+"NULLNULLNULL"
 			If expr.instanceExpr Then
 				t = "_" + ctorMunged + "_ObjectNew" + TransArgs( expr.args,expr.ctor, Bra(expr.instanceExpr.Trans()) + "->clas" )
 			Else
-				If ClassHasObjectField(expr.classDecl) Then
+				If ClassHasObjectField(expr.classDecl) And Not expr.classDecl.IsStruct() Then
 					t = "_" + ctorMunged + "_ObjectNew" + TransArgs( expr.args,expr.ctor, "&" + expr.classDecl.actual.munged )
 				Else
 					If expr.classDecl.IsStruct() Then
@@ -2467,8 +2467,7 @@ t:+"NULLNULLNULL"
 	End Method
 	
 	Method TransDebugNullObjectError:String(variable:String, cdecl:TClassDecl)
-	
-		If cdecl.ident = "String" Or cdecl.ident = "___Array" Then
+		If cdecl.IsStruct() Or cdecl.ident = "String" Or cdecl.ident = "___Array" Then
 			'Return cdecl.munged + "NullObjectTest(" + variable + ")"
 			Return variable
 		Else