-
Notifications
You must be signed in to change notification settings - Fork 715
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix foreachelse with foreach on objects
Try to address issue #506. After this patch the foreach logic always count the total number of elements when the underlying structure can easily be queried. E.g.: arrays and Countables can be queried with count() for the total number of elements. For all iterators we do not know the total element count in advance and calculating it is a wasteful operation. And it can be dangerous, too: forward-iterators cannot be rewinded and the foreach-loop will break. So with this patch the @ToTal property will be simply set to -1 for iterators. This has implications to other properties as well, when foreach is used with iterarors: The @show property is always true (even when there are no elements), and @last is always false. This patch changes a runtime function call. So all templates that uses foreach must be recompiled.
- Loading branch information
1 parent
70fc2fd
commit cda5bb9
Showing
2 changed files
with
14 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters