Uploaded image for project: 'Velocity'
  1. Velocity
  2. VELOCITY-630

Pass by name does not work with #foreach within a macro

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.5, 1.6-beta1
    • Fix Version/s: 1.6
    • Component/s: Engine
    • Labels:
      None

      Description

      GIven the following:

      #macro(test $a $b)
      #foreach($i in $a) $b #end
      #end
      #test( [1, 2, 3] "#if($i == 2) yes #else no #end")

      I would expect the output:

      no yes no

      Instead, I get

      no no no

      The Foreach directive explicitly sets $i in the localscope. This change was made for VELOCITY-285 . Before 285 Velocity correctly gave the results "no yes no" which is svn revision number 471881.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                byronvf Byron Foster
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: