Răsfoiți Sursa

Gave up on attempting to semant generic classes.

Mark Sibly 8 ani în urmă
părinte
comite
9e693aaaa6

+ 1 - 1
src/mx2cc/builder.monkey2

@@ -323,7 +323,7 @@ Class BuilderInstance
 			Repeat
 			
 				If Not semantMembers.Empty
-				
+					
 					Local ctype:=semantMembers.RemoveFirst()
 					
 					PNode.semanting.Push( ctype.cdecl )

+ 6 - 2
src/mx2cc/class.monkey2

@@ -217,8 +217,12 @@ Class ClassType Extends Type
 		Endif
 		
 		If scope.IsGeneric Or cdecl.IsExtern
-		
-			Builder.semantMembers.AddLast( Self )
+			
+			If Not scope.IsGeneric 
+				
+				Builder.semantMembers.AddLast( Self )
+			
+			endif
 			
 		Else
 		

+ 4 - 1
src/mx2cc/expr.monkey2

@@ -315,7 +315,10 @@ Class NewObjectExpr Extends Expr
 		Local ctype:=TCast<ClassType>( type )
 		If Not ctype Throw New SemantEx( "Type '"+type.Name+"' is not a class type" )
 		
-		If ctype.IsGeneric Return New LiteralValue( ctype,"" )
+		If ctype.IsGeneric 
+			Throw New SemantEx( "Type '"+type.ToString()+"' is generic" )
+'			Return New LiteralValue( ctype,"" )
+		Endif
 		
 		'hmmm...
 '		ctype.SemantMembers()

+ 2 - 2
src/mx2cc/mx2cc.monkey2

@@ -21,9 +21,9 @@ Using mx2..
 
 Global StartDir:String
 
-Const TestArgs:="mx2cc makemods"
+'Const TestArgs:="mx2cc makemods"
 
-'Const TestArgs:="mx2cc makeapp -target=desktop -apptype=console -run src/mx2cc/test.monkey2"
+Const TestArgs:="mx2cc makeapp -target=desktop -apptype=console -run src/mx2cc/test.monkey2"
 
 'Const TestArgs:="mx2cc makedocs mojo3d"
 

+ 1 - 1
src/mx2cc/test.monkey2

@@ -1,7 +1,7 @@
 
 Function Main()
 	
-	Local t:=x+y
+	Local t:=-.1
 	
 	Print t
 

+ 6 - 0
src/mx2cc/var.monkey2

@@ -72,6 +72,12 @@ Class VarValue Extends Value
 	End
 	
 	Method OnSemant:SNode() Override
+		
+		Select vdecl.ident
+		Case "B","D"
+			Print "Semanting "+vdecl.ident
+			Print "scope="+Cast<ClassScope>( scope ).ctype.ToString()
+		End
 	
 		Scope.semanting.Push( scope )