Browse Source

mx2cc cleanups.

Mark Sibly 9 years ago
parent
commit
8211a77101

+ 4 - 3
src/mx2new/class.monkey2

@@ -48,8 +48,9 @@ Class ClassType Extends Type
 
 	Field abstractMethods:FuncValue[]
 	
-	Field fields:=New Stack<SNode>
-	Field methods:=New Stack<SNode>
+	Field ctors:=New Stack<FuncValue>
+	Field methods:=New Stack<FuncValue>
+	Field fields:=New Stack<VarValue>
 	
 	Method New( cdecl:ClassDecl,outer:Scope,types:Type[],instanceOf:ClassType )
 	
@@ -67,7 +68,7 @@ Class ClassType Extends Type
 			Local node:=member.ToNode( scope )
 			scope.Insert( member.ident,node )
 			Select member.kind
-			Case "field" fields.Push( node )
+			Case "field" fields.Push( Cast<VarValue>( node ) )
 '			Case "method" methods.Push( node )
 			End
 		Next

+ 1 - 1
src/mx2new/decl.monkey2

@@ -123,8 +123,8 @@ Class FileDecl Extends Decl
 	Field exhfile:String	
 	Field hfile:String
 	Field cfile:String
-	Field classes:=New Stack<ClassType>
 	Field functions:=New Stack<FuncValue>
+	Field classes:=New Stack<ClassType>
 	Field globals:=New Stack<VarValue>
 
 End

+ 7 - 1
src/mx2new/func.monkey2

@@ -398,7 +398,13 @@ Class FuncValue Extends Value
 
 		Else
 		
-			If fdecl.kind="method" cscope.ctype.methods.Push( Self )
+			If fdecl.kind="method"
+'				If fdecl.ident="new"
+'					cscope.ctype.ctors.Push( Self )
+'				Else
+					cscope.ctype.methods.Push( Self )
+'				Endif
+			Endif
 		
 			scope.transMembers.Push( Self )
 

+ 2 - 0
src/mx2new/mung.monkey2

@@ -259,6 +259,8 @@ Function VarName:String( vvar:VarValue )
 		
 	Case "global","const"
 	
+		If Cast<Block>( vvar.scope ) Return "g_"+sym
+	
 		Return "g_"+ScopeName( vvar.scope )+"_"+sym
 	
 	End

+ 1 - 1
src/mx2new/mx2.monkey2

@@ -47,4 +47,4 @@ Using lib.c
 ' 3) edit .sh and .bat files to use new version (common.sh, updatemx2cc.bat, rebuildmx2cc.bat)
 ' 4) ./rebuildall
 '
-Const MX2CC_VERSION:="004"
+Const MX2CC_VERSION:="005"

+ 2 - 2
src/mx2new/mx2cc.monkey2

@@ -19,9 +19,9 @@ Using libc
 
 Global StartDir:String
 
-'Const TestArgs:="mx2cc makemods -clean"
+Const TestArgs:="mx2cc makemods -clean"
 
-Const TestArgs:="mx2cc makeapp src/ted2/ted2.monkey2"
+'Const TestArgs:="mx2cc makeapp src/ted2/ted2.monkey2"
 
 'Const TestArgs:="mx2cc makeapp src/mx2new/test.monkey2"