Browse Source

Another mx2cc deps fix.

Mark Sibly 8 năm trước cách đây
mục cha
commit
56a769bd64

+ 2 - 19
src/mx2cc/test.monkey2

@@ -1,28 +1,11 @@
 
 
-#Import "<std>"
 #Import "<mojo>"
 #Import "<mojo>"
-#Import "<mojox>"
-#Import "test2"
 
 
-Using std..
 Using mojo..
 Using mojo..
-Using mojox..
 
 
-Class MyWindow Extends Window
-	Method Testing()
-		
-		'Local dummy:=New CheckButton( "" ) ' uncomment this to 'fix' error
-		
-		Local widgets:=New Widgets
-		Local v:View=widgets.checkBox
-		
-	End
+Class C
+	Field image:Image=Null
 End
 End
 
 
 Function Main()
 Function Main()
-
-	New AppInstance
-	New MyWindow
-	App.Run()	
 End
 End
-

+ 10 - 4
src/mx2cc/translator_cpp.monkey2

@@ -326,7 +326,6 @@ Class Translator_CPP Extends Translator
 		EmitBr()	
 		EmitBr()	
 		Emit( "// Class "+ctype.Name )
 		Emit( "// Class "+ctype.Name )
 		
 		
-		
 		BeginDeps()
 		BeginDeps()
 		
 		
 		EmitClassProto( ctype )
 		EmitClassProto( ctype )
@@ -461,7 +460,13 @@ Class Translator_CPP Extends Translator
 					Emit( proto+"{};" )
 					Emit( proto+"{};" )
 					needsInit=True
 					needsInit=True
 				Else
 				Else
-					Emit( proto+"="+Trans( vvar.init )+";" )
+					Local lit:=Cast<LiteralValue>( vvar.init )
+					If Not lit Or lit.value
+'						AssignsTo( vvar.type )
+						Emit( proto+"="+Trans( vvar.init )+";" )
+					Else
+						Emit( proto+"{};" )
+					Endif
 				Endif
 				Endif
 			Else
 			Else
 				Emit( proto+"{};" )
 				Emit( proto+"{};" )
@@ -1612,12 +1617,13 @@ Class Translator_CPP Extends Translator
 
 
 		Local etype:=TCast<EnumType>( type )
 		Local etype:=TCast<EnumType>( type )
 		If etype Return EnumName( etype )+"(0)"
 		If etype Return EnumName( etype )+"(0)"
-
+		
 		If IsCValueType( type )
 		If IsCValueType( type )
 			Uses( type )
 			Uses( type )
 			Return TransType( type )+"{}"
 			Return TransType( type )+"{}"
 		Endif
 		Endif
-		
+
+'		Uses( type )		
 		Return "(("+TransType( type )+")0)"
 		Return "(("+TransType( type )+")0)"
 	End
 	End