svn commit: r981613 - /ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Parser.jj

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r981613 - /ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Parser.jj

doogie-3
Author: doogie
Date: Mon Aug  2 17:41:39 2010
New Revision: 981613

URL: http://svn.apache.org/viewvc?rev=981613&view=rev
Log:
REFACTOR: Optimize FieldDef, so that the FieldDef object instantiation only
happens in one place.

Modified:
    ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Parser.jj

Modified: ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Parser.jj
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Parser.jj?rev=981613&r1=981612&r2=981613&view=diff
==============================================================================
--- ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Parser.jj (original)
+++ ofbiz/trunk/framework/sql/src/org/ofbiz/sql/Parser.jj Mon Aug  2 17:41:39 2010
@@ -511,13 +511,14 @@ private void FieldDef(Map<String, FieldD
             fieldAlls.add(fieldAll); return;
           }
         | n=NamePart() (
-              <PERIOD> fieldName=NamePart() ( <AS> fieldAlias=NamePart() )? { def = new FieldDef(new FieldValue(n, fieldName), fieldAlias); }
-            | v=FunctionCallRest(n) ( <AS> fieldAlias=NamePart() )? { def = new FieldDef(v, fieldAlias); }
-            | ( <AS> fieldAlias=NamePart() )? { def = new FieldDef(new FieldValue(null, n), fieldAlias); }
+              <PERIOD> fieldName=NamePart() ( <AS> fieldAlias=NamePart() )? { v = new FieldValue(n, fieldName); }
+            | v=FunctionCallRest(n) ( <AS> fieldAlias=NamePart() )?
+            | ( <AS> fieldAlias=NamePart() )? { v = new FieldValue(null, n); }
           )
-        | v=MathValue() ( <AS> fieldAlias=NamePart() )? { def = new FieldDef(v, fieldAlias); }
-        | v=Count() ( <AS> fieldAlias=NamePart() )? { def = new FieldDef(v, fieldAlias); }
+        | v=MathValue() ( <AS> fieldAlias=NamePart() )?
+        | v=Count() ( <AS> fieldAlias=NamePart() )?
     ) {
+        def = new FieldDef(v, fieldAlias);
         if (fieldDefs.containsKey(def.getAlias())) throw new ParseException("duplicate alias(" + def.getAlias() + ")");
         fieldDefs.put(def.getAlias(), def);
     }