Explorar el Código

Improved error message for Eachin use. Fixes #356.

woollybah hace 6 años
padre
commit
b8ec703996
Se han modificado 1 ficheros con 5 adiciones y 0 borrados
  1. 5 0
      parser.bmx

+ 5 - 0
parser.bmx

@@ -183,6 +183,11 @@ Type TForEachinStmt Extends TLoopStmt
 			
 			If TObjectType(expr.exprType).classDecl.ImplementsInterface("iiterable") Then
 				iterable = True
+			Else
+				Local declList:TFuncDeclList = TFuncDeclList(TObjectType(expr.exprType).classDecl.GetDecl("objectenumerator"))
+				If Not declList Then
+					Err "Use of EachIn requires enumerable Type with either ObjectEnumerator method or one which implements IIterable interface."
+				End If
 			End If
 
 			If TInvokeExpr(expr) Or TInvokeMemberExpr(expr) Then