Просмотр исходного кода

Improved variable scope lookup for loop statement. Fixes #401.

woollybah 6 лет назад
Родитель
Сommit
389a02d4f7
1 измененных файлов с 4 добавлено и 0 удалено
  1. 4 0
      stmt.bmx

+ 4 - 0
stmt.bmx

@@ -635,7 +635,11 @@ Type TForStmt Extends TLoopStmt
 		Local updateCastTypes:Int
 		If TAssignStmt(init) And TIdentExpr(TAssignStmt(init).lhs) Then
 			updateCastTypes = True
+		Else
+			' semant right-hand side first, in case the loop variable is shadowing one from rhs
+			TBinaryCompareExpr(expr).rhs = TBinaryCompareExpr(expr).rhs.Semant()
 		End If
+
 		init.Semant
 
 		If updateCastTypes Then