瀏覽代碼

Fix for void vars.

Mark Sibly 9 年之前
父節點
當前提交
3d16412283
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4 1
      src/mx2new/var.monkey2

+ 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 )