瀏覽代碼

mx2cc cleanups.

Mark Sibly 9 年之前
父節點
當前提交
8211a77101
共有 6 個文件被更改,包括 17 次插入8 次删除
  1. 4 3
      src/mx2new/class.monkey2
  2. 1 1
      src/mx2new/decl.monkey2
  3. 7 1
      src/mx2new/func.monkey2
  4. 2 0
      src/mx2new/mung.monkey2
  5. 1 1
      src/mx2new/mx2.monkey2
  6. 2 2
      src/mx2new/mx2cc.monkey2

+ 4 - 3
src/mx2new/class.monkey2

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

+ 1 - 1
src/mx2new/decl.monkey2

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

+ 7 - 1
src/mx2new/func.monkey2

@@ -398,7 +398,13 @@ Class FuncValue Extends Value
 
 
 		Else
 		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 )
 			scope.transMembers.Push( Self )
 
 

+ 2 - 0
src/mx2new/mung.monkey2

@@ -259,6 +259,8 @@ Function VarName:String( vvar:VarValue )
 		
 		
 	Case "global","const"
 	Case "global","const"
 	
 	
+		If Cast<Block>( vvar.scope ) Return "g_"+sym
+	
 		Return "g_"+ScopeName( vvar.scope )+"_"+sym
 		Return "g_"+ScopeName( vvar.scope )+"_"+sym
 	
 	
 	End
 	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)
 ' 3) edit .sh and .bat files to use new version (common.sh, updatemx2cc.bat, rebuildmx2cc.bat)
 ' 4) ./rebuildall
 ' 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
 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"
 'Const TestArgs:="mx2cc makeapp src/mx2new/test.monkey2"