2
0
Mark Sibly 9 жил өмнө
parent
commit
3d16412283

+ 4 - 1
src/mx2new/var.monkey2

@@ -79,9 +79,12 @@ Class VarValue Extends Value
 		If vdecl.type
 			type=vdecl.type.Semant( scope )
 			If vdecl.init init=vdecl.init.SemantRValue( scope,type )
-		Else
+		Else If vdecl.init
 			init=vdecl.init.SemantRValue( scope )
+			If TCast<VoidType>( init.type ) Throw New SemantEx( "Variables cannot have 'Void' type" )
 			type=init.type
+		Else 
+			SemantError( "VarValue.OnSemant()" )
 		Endif
 		
 		If Not type.IsGeneric And Not vdecl.IsExtern And Not Cast<Block>( scope )