← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/markos-scratch into lp:zorba

 

Markos Zaharioudakis has proposed merging lp:~zorba-coders/zorba/markos-scratch into lp:zorba.

Commit message:
disabled throwing of error XPST0005 for path exprs (also fixes bug #1090514)

Requested reviews:
  Markos Zaharioudakis (markos-za)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/166132

disabled throwing of error XPST0005 for path exprs (also fixes bug #1090514)
-- 
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/166132
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/compiler/expression/expr_type.cpp'
--- src/compiler/expression/expr_type.cpp	2013-05-24 16:34:11 +0000
+++ src/compiler/expression/expr_type.cpp	2013-05-28 19:59:31 +0000
@@ -42,6 +42,8 @@
 #include "types/root_typemanager.h"
 #include "types/typeops.h"
 
+//#define THROW_XPST0005
+
 namespace zorba
 {
 
@@ -842,20 +844,16 @@
   RootTypeManager& RTM = GENV_TYPESYSTEM;
   TypeManager* tm = sctx->get_typemanager();
 
-  const QueryLoc& loc = axisStep->get_loc();
-
   axis_kind_t axisKind = axisStep->getAxis();
   match_expr* nodeTest = axisStep->getTest();
 
   match_test_t testKind =  nodeTest->getTestKind();
   store::StoreConsts::NodeKind testNodeKind = nodeTest->getNodeKind();
-  store::Item* testSchemaType = nodeTest->getTypeName();
   store::Item* testNodeName = nodeTest->getQName();
   match_wild_t wildKind = nodeTest->getWildKind();
 
   TypeConstants::quantifier_t inQuant = inputType->get_quantifier();
   store::StoreConsts::NodeKind inNodeKind = inputType->get_node_kind();
-  store::Item* inNodeName = inputType->get_node_name();
   xqtref_t inContentType = inputType->get_content_type();
 
   TypeConstants::quantifier_t star = TypeConstants::QUANT_STAR;
@@ -877,6 +875,11 @@
     }
   }
 
+#ifdef THROW_XPST0005
+  const QueryLoc& loc = axisStep->get_loc();
+  store::Item* testSchemaType = nodeTest->getTypeName();
+  store::Item* inNodeName = inputType->get_node_name();
+
   if (inUntyped &&
       (axisKind == axis_kind_self ||
        axisKind == axis_kind_descendant_or_self ||
@@ -897,11 +900,13 @@
       throw XQUERY_EXCEPTION(err::XPST0005, ERROR_LOC(loc));
     }
   }
+#endif
 
   switch (axisKind)
   {
   case axis_kind_parent:
   {
+#ifdef THROW_XPST0005
     // Doc nodes do not have parent
     if (inNodeKind == store::StoreConsts::documentNode)
     {
@@ -922,6 +927,7 @@
     {
       throw XQUERY_EXCEPTION(err::XPST0005, ERROR_LOC(loc));
     }
+#endif
 
     return create_axis_step_type(tm, testNodeKind, testNodeName, inQuant, false);
 
@@ -930,6 +936,7 @@
 
   case axis_kind_ancestor:
   {
+#ifdef THROW_XPST0005
     // Doc nodes do not have ancestors
     if (inNodeKind == store::StoreConsts::documentNode)
     {
@@ -943,6 +950,7 @@
     {
       throw XQUERY_EXCEPTION(err::XPST0005, ERROR_LOC(loc));
     }
+#endif
 
     if (testNodeKind == store::StoreConsts::elementNode)
     {
@@ -988,6 +996,7 @@
   case axis_kind_self:
   {
 self:
+#ifdef THROW_XPST0005
     // The node kind of the self node must be compatible with the NodeTest.
     if (testNodeKind != store::StoreConsts::anyNode &&
         inNodeKind != store::StoreConsts::anyNode &&
@@ -1003,6 +1012,7 @@
     {
       throw XQUERY_EXCEPTION(err::XPST0005, ERROR_LOC(loc));
     }
+#endif
 
     switch (inNodeKind)
     {
@@ -1095,6 +1105,7 @@
   case axis_kind_descendant:
   case axis_kind_child:
   {
+#ifdef THROW_XPST0005
     if (inNodeKind == store::StoreConsts::attributeNode ||
         inNodeKind == store::StoreConsts::textNode ||
         inNodeKind == store::StoreConsts::piNode ||
@@ -1108,6 +1119,7 @@
     {
       throw XQUERY_EXCEPTION(err::XPST0005, ERROR_LOC(loc));
     }
+#endif
 
     switch (testNodeKind)
     {
@@ -1135,6 +1147,7 @@
 
   case axis_kind_attribute:
   {
+#ifdef THROW_XPST0005
     // only element nodes have attributes.
     if (inNodeKind != store::StoreConsts::elementNode &&
         inNodeKind != store::StoreConsts::anyNode)
@@ -1150,6 +1163,7 @@
     {
       throw XQUERY_EXCEPTION(err::XPST0005, ERROR_LOC(loc));
     }
+#endif
 
     if ((testKind == match_name_test && wildKind == match_no_wild) ||
         testKind == match_xs_attr_test)
@@ -1177,11 +1191,13 @@
   case axis_kind_following:
   case axis_kind_preceding:
   {
+#ifdef THROW_XPST0005
     if (inNodeKind == store::StoreConsts::documentNode ||
         testNodeKind == store::StoreConsts::documentNode)
     {
       throw XQUERY_EXCEPTION(err::XPST0005, ERROR_LOC(loc));
     }
+#endif
 
     if ((axisKind == axis_kind_following_sibling ||
          axisKind == axis_kind_preceding_sibling) &&

=== modified file 'test/fots/CMakeLists.txt'
--- test/fots/CMakeLists.txt	2013-05-27 08:39:12 +0000
+++ test/fots/CMakeLists.txt	2013-05-28 19:59:31 +0000
@@ -184,8 +184,6 @@
 EXPECTED_FOTS_FAILURE (fn-format-number numberformat83 1167643)
 EXPECTED_FOTS_FAILURE (fn-format-number numberformat87 1167641)
 EXPECTED_FOTS_FAILURE (fn-format-number numberformat88 1167641)
-EXPECTED_FOTS_FAILURE (fn-generate-id generate-id-015 1090514)
-EXPECTED_FOTS_FAILURE (fn-generate-id generate-id-017 1090514)
 EXPECTED_FOTS_FAILURE (fn-matches cbcl-matches-038 1131304)
 EXPECTED_FOTS_FAILURE (fn-normalize-space fn-normalize-space-23 0)
 EXPECTED_FOTS_FAILURE (fn-normalize-space fn-normalize-space-25 0)


Follow ups