Sfoglia il codice sorgente

Added .mx2 dir support to new geninfo.

Mark Sibly 7 anni fa
parent
commit
9b2f55a171
3 ha cambiato i file con 30 aggiunte e 0 eliminazioni
  1. 21 0
      src/mx2cc/.mx2/test.monkey2
  2. 2 0
      src/mx2cc/mx2cc.monkey2
  3. 7 0
      src/mx2cc/parser.monkey2

+ 21 - 0
src/mx2cc/.mx2/test.monkey2

@@ -0,0 +1,21 @@
+#Import "<mojo>"
+
+Using mojo..
+
+Function Test:Int()
+	Return 0
+End
+
+Global g:=Image.Load( "test.png" )'New Image( 256,256 )
+
+Function Main:Void()
+	Local x:Int
+	Local y:Int
+	Local z:int
+	If x<10
+		Local t:=100
+	Else
+		Local t:=20
+	Endif
+End
+

+ 2 - 0
src/mx2cc/mx2cc.monkey2

@@ -25,7 +25,9 @@ Global StartDir:String
 'Const TestArgs:="mx2cc makemods"
  
 'Const TestArgs:="mx2cc makeapp src/mx2cc/test.monkey2"
+
 Const TestArgs:="mx2cc makeapp -semant -geninfo src/mx2cc/test.monkey2"
+'Const TestArgs:="mx2cc makeapp -semant -geninfo modules/mojo3d/mojo3d.monkey2"
 
 'Const TestArgs:="mx2cc makeapp -verbose src/mx2cc/catan/main.monkey2"
 

+ 7 - 0
src/mx2cc/parser.monkey2

@@ -21,6 +21,13 @@ Class Parser
 	End	
 
 	Method ParseFile:FileDecl( ident:String,srcPath:String,ppsyms:StringMap<String> )
+		
+		If Builder.opts.geninfo
+			Local dir:=ExtractDir( srcPath )
+			Local name:=StripExt( StripDir( srcPath ) )
+			local path:=dir+".mx2/"+name+".monkey2"
+			If GetFileType( path )=FileType.File srcPath=path
+		Endif
 	
 		_ppsyms=ppsyms