velocity-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@apache.org
Subject cvs commit: jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node ASTReference.java
Date Mon, 10 Sep 2001 08:56:48 GMT
geirm       01/09/10 01:56:47

  Modified:    src/java/org/apache/velocity/runtime/directive
                        VMProxyArg.java
               src/java/org/apache/velocity/runtime/parser/node
                        ASTReference.java
  Log:
  Should solve bug# 3346, problems with passing formal reference to
  Velocimacro.
  
  Revision  Changes    Path
  1.10      +15 -5     jakarta-velocity/src/java/org/apache/velocity/runtime/directive/VMProxyArg.java
  
  Index: VMProxyArg.java
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/directive/VMProxyArg.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- VMProxyArg.java	2001/08/07 21:57:56	1.9
  +++ VMProxyArg.java	2001/09/10 08:56:47	1.10
  @@ -113,7 +113,7 @@
    *  into a local context.
    *  
    *  @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
  - *  @version $Id: VMProxyArg.java,v 1.9 2001/08/07 21:57:56 geirm Exp $ 
  + *  @version $Id: VMProxyArg.java,v 1.10 2001/09/10 08:56:47 geirm Exp $ 
    */
   public class VMProxyArg
   {
  @@ -187,7 +187,12 @@
           if ( type == ParserTreeConstants.JJTREFERENCE )
           {
               if ( numTreeChildren == 0)
  -                singleLevelRef = callerReference.substring(1,callerReference.length());
  +            {
  +                /*
  +                 * do this properly and use the Reference node
  +                 */
  +                 singleLevelRef = ((ASTReference) nodeTree).getRootString();
  +            }
           }
       }
   
  @@ -286,7 +291,7 @@
               Object retObject = null;
               
               if ( type == ParserTreeConstants.JJTREFERENCE ) 
  -            {
  +            {                
                   /*
                    *  two cases :  scalar reference ($foo) or multi-level ($foo.bar....)
                    */
  @@ -296,7 +301,7 @@
                       /*
                        *  if I am a single-level reference, can I not get get it out of my
context?
                        */
  -                    
  +                
                       retObject = context.get( singleLevelRef );
                   }
                   else
  @@ -515,7 +520,12 @@
           if ( type == ParserTreeConstants.JJTREFERENCE )
           {
               if ( numTreeChildren == 0)
  -                singleLevelRef = callerReference.substring(1,callerReference.length());
  +            {
  +                /*
  +                 *  use the reference node to do this...
  +                 */
  +                singleLevelRef = ((ASTReference) nodeTree).getRootString();
  +            }
           }
       }
     
  
  
  
  1.38      +9 -1      jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java
  
  Index: ASTReference.java
  ===================================================================
  RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- ASTReference.java	2001/09/09 21:49:11	1.37
  +++ ASTReference.java	2001/09/10 08:56:47	1.38
  @@ -85,7 +85,7 @@
    * @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
    * @author <a href="mailto:Christoph.Reck@dlr.de">Christoph Reck</a>
    * @author <a href="mailto:kjohnson@transparent.com>Kent Johnson</a>
  - * @version $Id: ASTReference.java,v 1.37 2001/09/09 21:49:11 geirm Exp $ 
  + * @version $Id: ASTReference.java,v 1.38 2001/09/10 08:56:47 geirm Exp $ 
   */
   public class ASTReference extends SimpleNode
   {
  @@ -164,6 +164,14 @@
           return data;
       }        
       
  +    /**
  +     *  Returns the 'root string', the reference key
  +     */
  +     public String getRootString()
  +     {
  +        return rootString;
  +     }
  +     
       /**
        *   gets an Object that 'is' the value of the reference
        *
  
  
  

Mime
View raw message