You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by Will Glass-Husain <wg...@gmail.com> on 2008/07/14 22:19:23 UTC

Re: svn commit: r676716 - /velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/NodeUtils.java

Really?  that's a better style?  not that I feel strongly about it,
but I always thought it was better to return in one place.  easier to
debug.  seems cleaner flow of execution, too.

WILL

On Mon, Jul 14, 2008 at 1:09 PM,  <nb...@apache.org> wrote:
> Author: nbubna
> Date: Mon Jul 14 13:09:09 2008
> New Revision: 676716
>
> URL: http://svn.apache.org/viewvc?rev=676716&view=rev
> Log:
> style nitpicks
>
> Modified:
>    velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/NodeUtils.java
>
> Modified: velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/NodeUtils.java
> URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/NodeUtils.java?rev=676716&r1=676715&r2=676716&view=diff
> ==============================================================================
> --- velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/NodeUtils.java (original)
> +++ velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/NodeUtils.java Mon Jul 14 13:09:09 2008
> @@ -149,18 +149,15 @@
>      */
>     public static String tokenLiteral( Token t )
>     {
> -      String result;
> -
> -      // Look at kind of token and return "" when it's a multiline comment
> -      if (t.kind == ParserConstants.MULTI_LINE_COMMENT)
> -      {
> -        result = "";
> -      }
> -      else
> -      {
> -        result = specialText( t ) + t.image;
> -      }
> -      return result;
> +        // Look at kind of token and return "" when it's a multiline comment
> +        if (t.kind == ParserConstants.MULTI_LINE_COMMENT)
> +        {
> +            return "";
> +        }
> +        else
> +        {
> +            return specialText( t ) + t.image;
> +        }
>     }
>
>     /**
>
>
>



-- 
Forio Business Simulations

Will Glass-Husain
wglass@forio.com
www.forio.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org


Re: svn commit: r676716 - /velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/NodeUtils.java

Posted by Nathan Bubna <nb...@gmail.com>.
On Mon, Jul 14, 2008 at 1:19 PM, Will Glass-Husain
<wg...@gmail.com> wrote:
> Really?  that's a better style?  not that I feel strongly about it,
> but I always thought it was better to return in one place.  easier to
> debug.  seems cleaner flow of execution, too.

heh.  i suppose it's different concerns.  i consider it more visually
and mentally complex to track variable assignments than to track
multiple method exit points, but that might just be my brain. :)
really, the main reason i bothered with style cleanup was that our
convention is 4 spaces per tab, as i do feel strongly about consistent
spacing.  i just thought i'd "simplify" the other part too.  i, too,
don't feel strongly about single vs multiple return points.

> WILL
>
> On Mon, Jul 14, 2008 at 1:09 PM,  <nb...@apache.org> wrote:
>> Author: nbubna
>> Date: Mon Jul 14 13:09:09 2008
>> New Revision: 676716
>>
>> URL: http://svn.apache.org/viewvc?rev=676716&view=rev
>> Log:
>> style nitpicks
>>
>> Modified:
>>    velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/NodeUtils.java
>>
>> Modified: velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/NodeUtils.java
>> URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/NodeUtils.java?rev=676716&r1=676715&r2=676716&view=diff
>> ==============================================================================
>> --- velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/NodeUtils.java (original)
>> +++ velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/NodeUtils.java Mon Jul 14 13:09:09 2008
>> @@ -149,18 +149,15 @@
>>      */
>>     public static String tokenLiteral( Token t )
>>     {
>> -      String result;
>> -
>> -      // Look at kind of token and return "" when it's a multiline comment
>> -      if (t.kind == ParserConstants.MULTI_LINE_COMMENT)
>> -      {
>> -        result = "";
>> -      }
>> -      else
>> -      {
>> -        result = specialText( t ) + t.image;
>> -      }
>> -      return result;
>> +        // Look at kind of token and return "" when it's a multiline comment
>> +        if (t.kind == ParserConstants.MULTI_LINE_COMMENT)
>> +        {
>> +            return "";
>> +        }
>> +        else
>> +        {
>> +            return specialText( t ) + t.image;
>> +        }
>>     }
>>
>>     /**
>>
>>
>>
>
>
>
> --
> Forio Business Simulations
>
> Will Glass-Husain
> wglass@forio.com
> www.forio.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
> For additional commands, e-mail: dev-help@velocity.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org