Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix foreachelse #531

Closed
wants to merge 2 commits into from
Closed

Fix foreachelse #531

wants to merge 2 commits into from

Commits on Feb 8, 2019

  1. 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.
    volkarts-dev committed Feb 8, 2019
    Copy the full SHA
    cda5bb9 View commit details
    Browse the repository at this point in the history
  2. Fix typo

    volkarts-dev committed Feb 8, 2019
    Copy the full SHA
    fad55ea View commit details
    Browse the repository at this point in the history