Browse Source

Another mx2cc deps fix.

Mark Sibly 9 years ago
parent
commit
e08bb342f5
5 changed files with 50 additions and 4 deletions
  1. 3 1
      README.TXT
  2. BIN
      bin/mx2cc_windows.exe
  3. 1 1
      src/mx2cc/mx2cc.monkey2
  4. 35 0
      src/mx2cc/tests/deps1.monkey2
  5. 11 2
      src/mx2cc/translator_cpp.monkey2

+ 3 - 1
README.TXT

@@ -1,7 +1,9 @@
 
 ***** Welcome to Monkey2! *****
 
-W A R N I N G ! The master branch is super-volatile, and the develop branch is event worse! Grabbing the most recently tagged version is recommended if you just want to give monkey2 a try.
+The master branch is effectively the 'release candidates' branch, so should be relatively stable. All development work is now done on the develop branch.
+
+Grabbing the most recently tagged version is recommended if you just want to give monkey2 a try.
 
 
 ***** Building monkey2 on Windows *****

BIN
bin/mx2cc_windows.exe


+ 1 - 1
src/mx2cc/mx2cc.monkey2

@@ -23,7 +23,7 @@ Global StartDir:String
 
 'Const TestArgs:="mx2cc makemods -target=ios std"' std"
  
-Const TestArgs:="mx2cc makeapp -target=android -product=src/mx2cc/test.products/Android/ src/mx2cc/test.monkey2"
+Const TestArgs:="mx2cc makeapp -target=desktop src/mx2cc/test.monkey2"
 
 'To build with old mx2cc...
 '

+ 35 - 0
src/mx2cc/tests/deps1.monkey2

@@ -0,0 +1,35 @@
+
+#Import "<std>"
+#Import "<mojo>"
+
+Using std..
+Using mojo..
+ 
+Function Main()
+	Local testStack := New TestStack
+	
+	For Local n := 1 To 20
+		Local newItem := New TestItem
+		testStack.Add( newItem, Rnd( 0, 100 ) )
+	Next
+		
+	For Local n := Eachin testStack.items
+		Print( n.depth )
+	Next
+End
+ 
+ 
+Class TestStack
+	Field items := New Stack< TestItem >
+	Method Add( item:TestItem, depth:Float ) 
+		item.depth = depth
+		items.Push( item )
+	End
+End
+ 
+ 
+Struct TestItem				'Change this to a Class and it will compile!
+	Field depth:Int
+	Field img: Image		'Comment out this line and it will compile!
+	Field color: Color
+End

+ 11 - 2
src/mx2cc/translator_cpp.monkey2

@@ -1318,8 +1318,17 @@ Class Translator_CPP Extends Translator
 		Local lhs:=Trans( stmt.lhs )
 		Local rhs:=Trans( stmt.rhs )
 		
-		Uses( stmt.lhs.type )
-
+		Local type:=stmt.lhs.type
+		
+		Uses( type )
+		
+		Local ctype:=TCast<ClassType>( type )
+		If ctype And ctype.IsStruct
+			For Local vvar:=Eachin ctype.fields
+				If IsGCType( vvar.type ) Marks( vvar.type )
+			Next
+		Endif
+		
 		Emit( lhs+op+rhs+";" )
 	End