Prechádzať zdrojové kódy

Fixed select with var. Resolved #583

Brucey 4 rokov pred
rodič
commit
db3a5a81d5
3 zmenil súbory, kde vykonal 7 pridanie a 3 odobranie
  1. 5 1
      decl.bmx
  2. 1 1
      expr.bmx
  3. 1 1
      parser.bmx

+ 5 - 1
decl.bmx

@@ -31,6 +31,7 @@ Const DECL_STATIC:Long=      $20000000
 Const DECL_OVERRIDE:Long=    $40000000
 Const DECL_INLINE:Long=      $80000000
 Const DECL_THREADED:Long=   $100000000:Long
+Const DECL_NO_VAR:Long=     $200000000:Long
 
 Const DECL_SEMANTED:Long=      $100000
 Const DECL_SEMANTING:Long=     $200000
@@ -562,7 +563,10 @@ Type TValDecl Extends TDecl
 			End If
 		Else If declInit
 			init=declInit.Copy().Semant()
-			ty=init.exprType
+			ty=init.exprType.Copy()
+			If attrs & DECL_NO_VAR And ty._flags & TType.T_VAR Then 
+				ty._flags :~ TType.T_VAR ' remove var for variable 
+			End If 
 		End If
 		
 		If init Then

+ 1 - 1
expr.bmx

@@ -654,7 +654,7 @@ Type TVarExpr Extends TExpr
 	Method Semant:TExpr(options:Int = 0)
 		If exprType Return Self
 		If Not decl.IsSemanted() InternalErr "TVarExpr.Semant"
-		exprType=decl.ty
+		exprType=decl.ty.Copy()
 		Return Self
 	End Method
 

+ 1 - 1
parser.bmx

@@ -2297,7 +2297,7 @@ End Rem
 		Local tmpVar:TLocalDecl
 		Local selectExpr:TExpr = ParseExpr()
 		If Not TNullType(selectExpr.exprType)
-			tmpVar = New TLocalDecl.Create("", Null, selectExpr, , True)
+			tmpVar = New TLocalDecl.Create("", Null, selectExpr, DECL_NO_VAR, True)
 			block.AddStmt New TDeclStmt.Create(tmpVar)
 		End If