|
@@ -67,7 +67,8 @@ Type TForEachinStmt Extends TLoopStmt
|
|
End Method
|
|
End Method
|
|
|
|
|
|
Method OnSemant()
|
|
Method OnSemant()
|
|
-
|
|
|
|
|
|
+ Const NotIterableError:String = "EachIn requires a type that implements IIterable or has a suitable ObjectEnumerator method."
|
|
|
|
+
|
|
expr=expr.Semant()
|
|
expr=expr.Semant()
|
|
|
|
|
|
If TArrayType( expr.exprType ) Or TStringType( expr.exprType )
|
|
If TArrayType( expr.exprType ) Or TStringType( expr.exprType )
|
|
@@ -195,7 +196,7 @@ Type TForEachinStmt Extends TLoopStmt
|
|
Else
|
|
Else
|
|
Local declList:TFuncDeclList = TFuncDeclList(TObjectType(expr.exprType).classDecl.GetDecl("objectenumerator"))
|
|
Local declList:TFuncDeclList = TFuncDeclList(TObjectType(expr.exprType).classDecl.GetDecl("objectenumerator"))
|
|
If Not declList Then
|
|
If Not declList Then
|
|
- Err "Use of EachIn requires enumerable Type with either ObjectEnumerator method or one which implements IIterable interface."
|
|
|
|
|
|
+ Err NotIterableError
|
|
End If
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
|
|
@@ -311,7 +312,7 @@ Type TForEachinStmt Extends TLoopStmt
|
|
End If
|
|
End If
|
|
|
|
|
|
Else
|
|
Else
|
|
- InternalErr "TForEachinStmt.OnSemant"
|
|
|
|
|
|
+ Err NotIterableError
|
|
EndIf
|
|
EndIf
|
|
|
|
|
|
block.Semant
|
|
block.Semant
|