Update of /cvsroot/monetdb/pathfinder/compiler/core
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv26662/core

Modified Files:
        coreopt.brg 
Log Message:
-- Refine typing and core optimization for path steps.


Index: coreopt.brg
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/core/coreopt.brg,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -d -r1.62 -r1.63
--- coreopt.brg 19 Mar 2008 13:23:08 -0000      1.62
+++ coreopt.brg 20 Mar 2008 12:49:32 -0000      1.63
@@ -1368,10 +1368,25 @@
         case 29:
             /* remove bogus steps starting from attribute nodes */
             assert (p->kind == c_locsteps);
-            if (L(p)->kind != c_parent &&
-                L(p)->kind != c_ancestor &&
-                L(p)->kind != c_ancestor_or_self &&
-                PFty_subtype (TY(R(p)), PFty_star (PFty_xs_anyAttribute ()))) {
+            if (/* the typing infers that the result
+                   does not provide any results */
+                PFty_subtype (TY(p), PFty_empty ()) ||
+                /* the axis provides no result for attribute inputs */
+                ((L(p)->kind == c_attribute ||
+                  L(p)->kind == c_child ||
+                  L(p)->kind == c_descendant ||
+                  L(p)->kind == c_following ||
+                  L(p)->kind == c_following_sibling ||
+                  L(p)->kind == c_preceding ||
+                  L(p)->kind == c_preceding_sibling) &&
+                 PFty_subtype (TY(R(p)),
+                               PFty_star (PFty_xs_anyAttribute ()))) ||
+                /* the kind test does not match the attribute input */
+                ((L(p)->kind == c_self ||
+                  L(p)->kind == c_descendant_or_self) &&
+                 PFty_subtype (TY(R(p)),
+                               PFty_star (PFty_xs_anyAttribute ())) &&
+                 !PFty_subtype (TY(R(p)), PFty_star(TY(L(p)))))) {
                 *p = *empty ();
                 TY(p) = PFty_empty ();
                 rewritten = true;


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to