[ http://jira.andromda.org/browse/TEMPENG-1?page=comments#action_11761 ]
     
Chad Brandon commented on TEMPENG-1:
------------------------------------

Where did you set the property?

> Fix scope of velocity macros
> ----------------------------
>
>          Key: TEMPENG-1
>          URL: http://jira.andromda.org/browse/TEMPENG-1
>      Project: Template Engines
>         Type: Bug
>   Components: Velocity
>     Reporter: Chad Brandon
>     Assignee: Chad Brandon

>
> Shouldn't we set velocimacro.context.localscope = true? The docs say that 
> this property controls whether reference access (set/get) within a 
> Velocimacro will change the context, or be of local scope in that Velocimacro.
> Test this VTL code snippet here:
>   #macro (MyMacro $argument)
>   argument before: $argument
>   #if ($argument < 5)
>   #set ($x = $argument+1)
>   #MyMacro($x)
>   #end
>   argument after: $argument
>   #end
> Invoke it with "#MyMacro(1)". You will get this output:
>   argument before: 1
>   argument before: 2
>   argument before: 3
>   argument before: 4
>   argument before: 5
>   argument after: 5
>   argument after: 5
>   argument after: 5
>   argument after: 5
>   argument after: 1
> I would have expected:
>   argument before: 1
>   argument before: 2
>   argument before: 3
>   argument before: 4
>   argument before: 5
>   argument after: 5
>   argument after: 4
>   argument after: 3
>   argument after: 2
>   argument after: 1
> The reason is that $argument is a global variable, not a variable that
> is local to the macro.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.andromda.org/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Andromda-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/andromda-devel

Reply via email to