瀏覽代碼

Fixed Variant->Bool explicit cast.

Mark Sibly 8 年之前
父節點
當前提交
3c90be624f
共有 1 個文件被更改,包括 7 次插入1 次删除
  1. 7 1
      src/mx2cc/expr.monkey2

+ 7 - 1
src/mx2cc/expr.monkey2

@@ -591,7 +591,13 @@ Class CastExpr Extends Expr
 		If castOp value=castOp.Invoke( Null )
 
 		'simple upcast?		
-		If value.type.DistanceToType( type )>=0 Return value.UpCast( type )
+		If value.type.DistanceToType( type )>=0
+			'special case variant->bool
+			If value.type.Equals( Type.VariantType ) And type.Equals( Type.BoolType )
+				Return New ExplicitCastValue( type,value )
+			Endif
+			Return value.UpCast( type )
+		Endif
 
 		'nope...		
 		value=value.ToRValue()