[ 
https://issues.apache.org/jira/browse/FREEMARKER-12?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15012483#comment-15012483
 ] 

Diogo Kollross commented on FREEMARKER-12:
------------------------------------------

Maybe the documentation can be updated to explain this corner case.

One workaround until 2.4 is to create a function that always returns undefined:

{noformat}
<#function null>
</#function>

<#function inner>
  <#return "inner value">
</#function>

<#function example>
  <#local temp = inner()>
  <#return null()>
</#function>

${example()!"will always return undefined"}
{noformat}

> #return value bubbles through functions
> ---------------------------------------
>
>                 Key: FREEMARKER-12
>                 URL: https://issues.apache.org/jira/browse/FREEMARKER-12
>             Project: Apache Freemarker
>          Issue Type: Bug
>    Affects Versions: 2.3.23
>            Reporter: Diogo Kollross
>
> The documentation says that "if ... there was no 'return returnValue', then 
> the return value of the method is an undefined variable", but the behaviour 
> I'm seeing is that any #return in inner method calls gets returned as if it 
> was the caller's return value.
> In the following example the expected result is an undefined value, but it 
> shows "inner value".
> {noformat}
> <#function inner>
>   <#return "inner value">
> </#function>
> <#function example>
>   <#local temp = inner()>
> </#function>
> ${example()}
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to