← 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:
Fixed bug in castable expr when the target type is xs:QName.

Requested reviews:
  Markos Zaharioudakis (markos-za)

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

Fixed bug in castable expr when the target type is xs:QName.
-- 
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/135026
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'ChangeLog'
--- ChangeLog	2012-11-07 11:48:14 +0000
+++ ChangeLog	2012-11-20 01:03:21 +0000
@@ -16,6 +16,7 @@
   * Fixed mustCopyInputNodes() method of no-copy, and jsoniq functions.
   * Fixed bug #868640 (Node lifetime is shorter than expected due to let
     variable inlining)
+  * Fixed bug in castable expr when the target type is xs:QName.
   * Fixed bug #1062093 (bug in var reference iterators with an associated
     position that is negative)
   * Fixed bug #1061222 (bad message for errors in index key type declaration)

=== modified file 'src/compiler/translator/translator.cpp'
--- src/compiler/translator/translator.cpp	2012-11-08 05:38:30 +0000
+++ src/compiler/translator/translator.cpp	2012-11-20 01:03:21 +0000
@@ -8521,9 +8521,9 @@
       assert(castLiteral != NULL || ! isCast);
 
       if (isCast)
-        return theExprManager->create_const_expr(theRootSctx, theUDF, loc, castLiteral);
+        return CREATE(const)(theRootSctx, theUDF, loc, castLiteral);
       else
-        return theExprManager->create_const_expr(theRootSctx, theUDF, loc, castLiteral != NULL);
+        return CREATE(const)(theRootSctx, theUDF, loc, castLiteral != NULL);
     }
     else
     {
@@ -8531,27 +8531,26 @@
                             GENV_TYPESYSTEM.QNAME_TYPE_ONE :
                             GENV_TYPESYSTEM.QNAME_TYPE_QUESTION);
 
-      // when casting to type T, where T is QName or subtype of, and the input
-      // is not a const expr, then the input MUST be of type T or subtype of.
       if (isCast)
-        // This was previously a treat_expr() with TYPE_MATCH. It was changed to
-        // cast_expr() in order to allow dynamically computed strings to be cast
-        // to xs:QName.
-        return theExprManager->
-               create_cast_expr(theRootSctx, theUDF, loc, wrap_in_atomization(node), qnameType);
+        return CREATE(cast)(theRootSctx,
+                            theUDF,
+                            loc,
+                            wrap_in_atomization(node),
+                            qnameType);
       else
-        return theExprManager->
-               create_instanceof_expr(theRootSctx, theUDF, loc, node, qnameType);
+        return CREATE(castable)(theRootSctx,
+                                theUDF,
+                                loc,
+                                wrap_in_atomization(node),
+                                qnameType);
     }
   }
   else
   {
     if (isCast)
-      return theExprManager->
-             create_cast_expr(theRootSctx, theUDF, loc, wrap_in_atomization(node), type);
+      return CREATE(cast)(theRootSctx, theUDF, loc, wrap_in_atomization(node), type);
     else
-      return theExprManager->
-             create_castable_expr(theRootSctx, theUDF, loc, wrap_in_atomization(node), type);
+      return CREATE(castable)(theRootSctx, theUDF, loc, wrap_in_atomization(node), type);
   }
 }
 


Follow ups