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

Proposed by Markos Zaharioudakis
Status: Merged
Approved by: Markos Zaharioudakis
Approved revision: 11005
Merged at revision: 11165
Proposed branch: lp:~zorba-coders/zorba/markos-scratch
Merge into: lp:zorba
Diff against target: 1979 lines (+372/-342)
36 files modified
ChangeLog (+1/-0)
include/zorba/pregenerated/diagnostic_list.h (+1/-1)
modules/xqxq/xqxq.xq.src/xqxq.cpp (+1/-1)
src/api/dynamiccontextimpl.cpp (+5/-4)
src/api/xqueryimpl.cpp (+2/-3)
src/compiler/parsetree/parsenodes.cpp (+35/-9)
src/compiler/parsetree/parsenodes.h (+4/-3)
src/compiler/rewriter/rules/fold_rules.cpp (+1/-1)
src/compiler/translator/prolog_graph.cpp (+1/-1)
src/compiler/translator/translator.cpp (+120/-133)
src/context/dynamic_context.cpp (+5/-5)
src/context/namespace_context.cpp (+1/-1)
src/context/root_static_context.cpp (+1/-1)
src/context/static_context.cpp (+35/-24)
src/context/static_context.h (+3/-4)
src/diagnostics/diagnostic_en.xml (+29/-25)
src/diagnostics/pregenerated/diagnostic_list.cpp (+1/-1)
src/diagnostics/pregenerated/dict_en.cpp (+10/-9)
src/diagnostics/pregenerated/dict_zed_keys.h (+6/-5)
src/runtime/core/var_iterators.cpp (+4/-4)
src/runtime/eval/eval.cpp (+1/-1)
src/runtime/introspection/sctx_impl.cpp (+1/-1)
src/runtime/numerics/numerics_impl.cpp (+13/-6)
src/store/naive/node_items.cpp (+6/-2)
src/store/naive/node_items.h (+4/-1)
src/store/naive/pul_primitives.cpp (+19/-16)
src/store/naive/simple_pul.cpp (+15/-16)
src/types/casting.cpp (+2/-2)
src/types/schema/revalidateUtils.cpp (+2/-1)
src/types/schema/schema.cpp (+8/-20)
src/types/typeimpl.cpp (+1/-1)
src/types/typemanager.h (+2/-2)
src/types/typemanagerimpl.cpp (+25/-33)
src/types/typemanagerimpl.h (+2/-2)
src/types/typeops.cpp (+3/-3)
test/rbkt/Queries/zorba/modules/mainModule16.xq (+2/-0)
To merge this branch: bzr merge lp:~zorba-coders/zorba/markos-scratch
Reviewer Review Type Date Requested Status
Markos Zaharioudakis Approve
Review via email: mp+142262@code.launchpad.net

Commit message

Fixed bug #1043294 (XQST0036 not used in XQuery 3.0).
Partial fixes for bug #867008.

Description of the change

Fixed bug #1043294 (XQST0036 not used in XQuery 3.0).
Partial fixes for bug #867008

To post a comment you must log in.
Revision history for this message
Markos Zaharioudakis (markos-za) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Attempt to merge into lp:zorba failed due to conflicts:

text conflict in ChangeLog

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/markos-scratch into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:275 (message):
  Validation queue job markos-scratch-2013-01-08T09-08-51.485Z is finished.
  The final status was:

  1 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

11005. By Markos Zaharioudakis

Fixed bug #1043294 (XQST0036 not used in XQuery 3.0). Partial fixes for bug #867008.

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job markos-scratch-2013-01-08T11-46-54.981Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ChangeLog'
--- ChangeLog 2013-01-08 02:37:32 +0000
+++ ChangeLog 2013-01-08 11:10:56 +0000
@@ -46,6 +46,7 @@
46 * Fixed bug #1070551 (zerr:ZOSE0003 stream read failure)46 * Fixed bug #1070551 (zerr:ZOSE0003 stream read failure)
47 * Fixed bug #992304 (Compiling library modules could load data from wrong47 * Fixed bug #992304 (Compiling library modules could load data from wrong
48 source)48 source)
49 * Fixed bug #1043294 (XQST0036 not used in XQuery 3.0).
49 * Fixed bugs related to casting to user-defined types.50 * Fixed bugs related to casting to user-defined types.
5051
5152
5253
=== modified file 'include/zorba/pregenerated/diagnostic_list.h'
--- include/zorba/pregenerated/diagnostic_list.h 2012-12-21 22:05:39 +0000
+++ include/zorba/pregenerated/diagnostic_list.h 2013-01-08 11:10:56 +0000
@@ -492,7 +492,7 @@
492492
493extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZAPI0009_XQUERY_NOT_COMPILED_IN_DEBUG_MODE;493extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZAPI0009_XQUERY_NOT_COMPILED_IN_DEBUG_MODE;
494494
495extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZAPI0011_ELEMENT_NOT_DECLARED;495extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZAPI0011_VARIABLE_NOT_DECLARED;
496496
497extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZAPI0014_INVALID_ARGUMENT;497extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZAPI0014_INVALID_ARGUMENT;
498498
499499
=== modified file 'modules/xqxq/xqxq.xq.src/xqxq.cpp'
--- modules/xqxq/xqxq.xq.src/xqxq.cpp 2012-11-20 04:43:01 +0000
+++ modules/xqxq/xqxq.xq.src/xqxq.cpp 2013-01-08 11:10:56 +0000
@@ -609,7 +609,7 @@
609 }609 }
610 catch (ZorbaException& ze)610 catch (ZorbaException& ze)
611 {611 {
612 if (ze.diagnostic() == zerr::ZAPI0011_ELEMENT_NOT_DECLARED)612 if (ze.diagnostic() == zerr::ZAPI0011_VARIABLE_NOT_DECLARED)
613 XQXQFunction::throwError("UndeclaredVariable", ze.what()); 613 XQXQFunction::throwError("UndeclaredVariable", ze.what());
614 throw; // should not happen614 throw; // should not happen
615 }615 }
616616
=== modified file 'src/api/dynamiccontextimpl.cpp'
--- src/api/dynamiccontextimpl.cpp 2012-12-21 05:13:20 +0000
+++ src/api/dynamiccontextimpl.cpp 2013-01-08 11:10:56 +0000
@@ -129,11 +129,11 @@
129 if (!var)129 if (!var)
130 {130 {
131 throw XQUERY_EXCEPTION(err::XPST0008,131 throw XQUERY_EXCEPTION(err::XPST0008,
132 ERROR_PARAMS(BUILD_STRING('{',132 ERROR_PARAMS(ZED(XPST0008_VariableName_2),
133 BUILD_STRING('{',
133 qnameItem->getNamespace(),134 qnameItem->getNamespace(),
134 '}',135 '}',
135 qnameItem->getLocalName()),136 qnameItem->getLocalName())));
136 ZED(Variable)));
137 }137 }
138138
139 return var;139 return var;
@@ -177,7 +177,8 @@
177 if (!var)177 if (!var)
178 {178 {
179 throw XQUERY_EXCEPTION(err::XPST0008,179 throw XQUERY_EXCEPTION(err::XPST0008,
180 ERROR_PARAMS(BUILD_STRING('{', inVarUri, '}', inVarLocalName ), ZED(Variable)));180 ERROR_PARAMS(ZED(XPST0008_VariableName_2),
181 BUILD_STRING('{', inVarUri, '}', inVarLocalName )));
181 }182 }
182183
183 return var;184 return var;
184185
=== modified file 'src/api/xqueryimpl.cpp'
--- src/api/xqueryimpl.cpp 2012-10-08 12:09:36 +0000
+++ src/api/xqueryimpl.cpp 2013-01-08 11:10:56 +0000
@@ -848,12 +848,11 @@
848 848
849 if (!var)849 if (!var)
850 {850 {
851 throw XQUERY_EXCEPTION(zerr::ZAPI0011_ELEMENT_NOT_DECLARED,851 throw XQUERY_EXCEPTION(zerr::ZAPI0011_VARIABLE_NOT_DECLARED,
852 ERROR_PARAMS(BUILD_STRING('{',852 ERROR_PARAMS(BUILD_STRING('{',
853 qname->getNamespace(),853 qname->getNamespace(),
854 '}',854 '}',
855 qname->getLocalName()),855 qname->getLocalName())));
856 ZED(Variable)));
857 }856 }
858857
859 if (var->hasInitializer())858 if (var->hasInitializer())
860859
=== modified file 'src/compiler/parsetree/parsenodes.cpp'
--- src/compiler/parsetree/parsenodes.cpp 2012-12-18 15:57:51 +0000
+++ src/compiler/parsetree/parsenodes.cpp 2013-01-08 11:10:56 +0000
@@ -17,6 +17,7 @@
1717
18#include "util/stl_util.h"18#include "util/stl_util.h"
19#include "diagnostics/assert.h"19#include "diagnostics/assert.h"
20#include "diagnostics/util_macros.h"
20#include "diagnostics/xquery_diagnostics.h"21#include "diagnostics/xquery_diagnostics.h"
2122
22#include "types/typemanager.h"23#include "types/typemanager.h"
@@ -3644,20 +3645,23 @@
3644 dir_content_hv.rbegin();3645 dir_content_hv.rbegin();
36453646
3646 const DirElemContent* lPrev = 0;3647 const DirElemContent* lPrev = 0;
3647 // To find out if a DirElemContent is boundary whitespace, the current item cannot be accepted till3648 // To find out if a DirElemContent is boundary whitespace, the current item
3648 // the next item (relative to the current item) is passed to check_boundary_whitespace.3649 // cannot be accepted till the next item (relative to the current item) is
3650 // passed to check_boundary_whitespace.
3649 v.begin_check_boundary_whitespace();3651 v.begin_check_boundary_whitespace();
3650 for (; it!=dir_content_hv.rend(); ++it)3652 for (; it != dir_content_hv.rend(); ++it)
3651 {3653 {
3652 const DirElemContent* e_p = &**it;3654 const DirElemContent* e_p = &**it;
3653 v.check_boundary_whitespace (*e_p);3655 v.check_boundary_whitespace (*e_p);
3654 if (lPrev != 0) {3656 if (lPrev != 0)
3657 {
3655 ACCEPT_CHK(lPrev);3658 ACCEPT_CHK(lPrev);
3656 }3659 }
3657 lPrev = e_p;3660 lPrev = e_p;
3658 }3661 }
3659 v.end_check_boundary_whitespace();3662 v.end_check_boundary_whitespace();
3660 if (lPrev != 0) {3663 if (lPrev != 0)
3664 {
3661 ACCEPT_CHK(lPrev);3665 ACCEPT_CHK(lPrev);
3662 }3666 }
3663 END_VISITOR();3667 END_VISITOR();
@@ -3666,11 +3670,33 @@
36663670
3667// [97] DirAttributeList3671// [97] DirAttributeList
36683672
3669DirAttributeList::DirAttributeList(3673DirAttributeList::DirAttributeList(const QueryLoc& loc)
3670 const QueryLoc& loc)3674 :
3671:
3672 parsenode(loc)3675 parsenode(loc)
3673{}3676{
3677}
3678
3679
3680void DirAttributeList::push_back(rchandle<DirAttr> attr)
3681{
3682 const QName* qname = attr->get_name();
3683
3684 if (qname->get_qname() == "xmlns" || qname->get_prefix() == "xmlns")
3685 {
3686 std::vector<rchandle<DirAttr> >::const_iterator ite = theAttributes.begin();
3687 std::vector<rchandle<DirAttr> >::const_iterator end = theAttributes.end();
3688 for (; ite != end; ++ite)
3689 {
3690 if (*((*ite)->get_name()) == *(qname))
3691 {
3692 RAISE_ERROR(err::XQST0071, attr->get_location(),
3693 ERROR_PARAMS(attr->get_name()->get_qname()));
3694 }
3695 }
3696 }
3697
3698 theAttributes.push_back(attr);
3699}
36743700
36753701
3676void DirAttributeList::accept( parsenode_visitor &v ) const3702void DirAttributeList::accept( parsenode_visitor &v ) const
36773703
=== modified file 'src/compiler/parsetree/parsenodes.h'
--- src/compiler/parsetree/parsenodes.h 2012-12-21 22:05:39 +0000
+++ src/compiler/parsetree/parsenodes.h 2013-01-08 11:10:56 +0000
@@ -4358,13 +4358,13 @@
4358public:4358public:
4359 DirAttributeList(const QueryLoc&);4359 DirAttributeList(const QueryLoc&);
43604360
4361 void push_back(rchandle<DirAttr> attr) { theAttributes.push_back(attr); }4361 void push_back(rchandle<DirAttr> attr);
43624362
4363 rchandle<DirAttr> operator[](int i) { return theAttributes[i]; }4363 rchandle<DirAttr> operator[](int i) { return theAttributes[i]; }
43644364
4365 const DirAttr *operator[] (int i) const { return theAttributes[i]; }4365 const DirAttr* operator[](int i) const { return theAttributes[i]; }
43664366
4367 ulong size () const { return (ulong)theAttributes.size (); }4367 csize size() const { return theAttributes.size(); }
43684368
4369 void accept(parsenode_visitor&) const;4369 void accept(parsenode_visitor&) const;
4370};4370};
@@ -4388,6 +4388,7 @@
43884388
4389public:4389public:
4390 rchandle<QName> get_name() const { return theName; }4390 rchandle<QName> get_name() const { return theName; }
4391
4391 rchandle<DirAttributeValue> get_value() const { return theValue; }4392 rchandle<DirAttributeValue> get_value() const { return theValue; }
43924393
4393public:4394public:
43944395
=== modified file 'src/compiler/rewriter/rules/fold_rules.cpp'
--- src/compiler/rewriter/rules/fold_rules.cpp 2012-11-12 17:12:41 +0000
+++ src/compiler/rewriter/rules/fold_rules.cpp 2013-01-08 11:10:56 +0000
@@ -894,7 +894,7 @@
894 *tm->create_named_type(val->getType(),894 *tm->create_named_type(val->getType(),
895 TypeConstants::QUANT_ONE,895 TypeConstants::QUANT_ONE,
896 fo.get_loc(),896 fo.get_loc(),
897 err::XPTY0004),897 true),
898 *rtm.INTEGER_TYPE_ONE,898 *rtm.INTEGER_TYPE_ONE,
899 fo.get_loc()))899 fo.get_loc()))
900 {900 {
901901
=== modified file 'src/compiler/translator/prolog_graph.cpp'
--- src/compiler/translator/prolog_graph.cpp 2012-09-19 21:16:15 +0000
+++ src/compiler/translator/prolog_graph.cpp 2013-01-08 11:10:56 +0000
@@ -55,7 +55,7 @@
55 zstring varName = '$' + v1.getVarExpr()->get_name()->getStringValue();55 zstring varName = '$' + v1.getVarExpr()->get_name()->getStringValue();
5656
57 RAISE_ERROR(err::XPST0008, v2.getVarExpr()->get_loc(),57 RAISE_ERROR(err::XPST0008, v2.getVarExpr()->get_loc(),
58 ERROR_PARAMS(varName, ZED(VariabledUndeclared)));58 ERROR_PARAMS(ZED(XPST0008_VariableName_2), varName));
59 }59 }
6060
61 addEdge(theGraph, v1, v2);61 addEdge(theGraph, v1, v2);
6262
=== modified file 'src/compiler/translator/translator.cpp'
--- src/compiler/translator/translator.cpp 2012-12-28 10:24:59 +0000
+++ src/compiler/translator/translator.cpp 2013-01-08 11:10:56 +0000
@@ -1149,27 +1149,7 @@
1149{1149{
1150 assert(sctx != NULL);1150 assert(sctx != NULL);
11511151
1152 switch (e->get_kind())1152 sctx->bind_var(e, e->get_loc());
1153 {
1154 case var_expr::let_var:
1155 {
1156 sctx->bind_var(e, e->get_loc(), err::XQST0039);
1157 break;
1158 }
1159 case var_expr::win_var:
1160 case var_expr::wincond_out_var:
1161 case var_expr::wincond_out_pos_var:
1162 case var_expr::wincond_in_var:
1163 case var_expr::wincond_in_pos_var:
1164 {
1165 sctx->bind_var(e, e->get_loc(), err::XQST0103);
1166 break;
1167 }
1168 default:
1169 {
1170 sctx->bind_var(e, e->get_loc(), err::XQST0049);
1171 }
1172 }
1173}1153}
11741154
11751155
@@ -1221,26 +1201,27 @@
1221********************************************************************************/1201********************************************************************************/
1222var_expr* lookup_ctx_var(const QName* qname, const QueryLoc& loc)1202var_expr* lookup_ctx_var(const QName* qname, const QueryLoc& loc)
1223{1203{
1224 if (theIsInIndexDomain)1204 store::Item_t qnameItem;
1225 {1205 expand_no_default_qname(qnameItem, qname, loc);
1226 try1206
1227 {1207 VarInfo* var = theSctx->lookup_var(qnameItem.getp());
1228 return lookup_var(qname, loc, err::XPDY0002);1208
1229 }1209 if (var == NULL)
1230 catch (ZorbaException const& e)1210 {
1231 {1211 if (theIsInIndexDomain)
1232 if (e.diagnostic() == err::XPDY0002)1212 {
1233 {1213 RAISE_ERROR(zerr::ZDST0032_INDEX_REFERENCES_CTX_ITEM, loc,
1234 RAISE_ERROR(zerr::ZDST0032_INDEX_REFERENCES_CTX_ITEM, loc,1214 ERROR_PARAMS(theIndexDecl->getName()->getStringValue()));
1235 ERROR_PARAMS(theIndexDecl->getName()->getStringValue()));1215 }
1236 }1216 else
1237 throw;1217 {
1238 }1218 zstring varName = static_context::var_name(qnameItem);
1239 }1219 RAISE_ERROR(err::XPDY0002, loc,
1240 else1220 ERROR_PARAMS(ZED(XPDY0002_ContextUndeclared_2), varName));
1241 {1221 }
1242 return lookup_var(qname, loc, err::XPDY0002);1222 }
1243 }1223
1224 return var->getVar();
1244}1225}
12451226
12461227
@@ -1252,10 +1233,10 @@
1252 If the lexical qname has a prefix for which no namespace binding exists, the1233 If the lexical qname has a prefix for which no namespace binding exists, the
1253 method raises error.1234 method raises error.
12541235
1255 If var is not found, the method raises the given error, unless the given error1236 If var is not found, the method raises XPST0008, unless the raiseError param
1256 is zerr::ZXQP0000_NO_ERROR, in which case it returns NULL.1237 is alse, in which case it returns NULL.
1257********************************************************************************/1238********************************************************************************/
1258var_expr* lookup_var(const QName* qname, const QueryLoc& loc, const Error& err)1239var_expr* lookup_var(const QName* qname, const QueryLoc& loc, bool raiseError)
1259{1240{
1260 store::Item_t qnameItem;1241 store::Item_t qnameItem;
1261 expand_no_default_qname(qnameItem, qname, loc);1242 expand_no_default_qname(qnameItem, qname, loc);
@@ -1264,12 +1245,11 @@
12641245
1265 if (!var)1246 if (!var)
1266 {1247 {
1267 if (err != zerr::ZXQP0000_NO_ERROR)1248 if (raiseError)
1268 {1249 {
1269 zstring varName = static_context::var_name(qnameItem);1250 zstring varName = static_context::var_name(qnameItem);
1270 throw XQUERY_EXCEPTION_VAR(err,1251 RAISE_ERROR(err::XPST0008, loc,
1271 ERROR_PARAMS(varName, ZED(VariabledUndeclared)),1252 ERROR_PARAMS(ZED(XPST0008_VariableName_2), varName));
1272 ERROR_LOC(loc));
1273 }1253 }
12741254
1275 return NULL;1255 return NULL;
@@ -1284,21 +1264,20 @@
1284 moves upwards the ancestor path until the first instance (if any) of the var1264 moves upwards the ancestor path until the first instance (if any) of the var
1285 is found.1265 is found.
12861266
1287 If var is not found, the method raises the given error, unless the given error1267 If var is not found, the method raises XPST0008, unless the raiseError param
1288 is MAX_ZORBA_ERROR_CODE, in which case it returns NULL.1268 is alse, in which case it returns NULL.
1289********************************************************************************/1269********************************************************************************/
1290var_expr* lookup_var(const store::Item* qname, const QueryLoc& loc, const Error& err)1270var_expr* lookup_var(const store::Item* qname, const QueryLoc& loc, bool raiseError)
1291{1271{
1292 VarInfo* var = theSctx->lookup_var(qname);1272 VarInfo* var = theSctx->lookup_var(qname);
12931273
1294 if (!var)1274 if (!var)
1295 {1275 {
1296 if (err != zerr::ZXQP0000_NO_ERROR)1276 if (raiseError)
1297 {1277 {
1298 zstring varName = static_context::var_name(qname);1278 zstring varName = static_context::var_name(qname);
1299 throw XQUERY_EXCEPTION_VAR(err,1279 RAISE_ERROR(err::XPST0008, loc,
1300 ERROR_PARAMS(varName, ZED(VariabledUndeclared)),1280 ERROR_PARAMS(ZED(XPST0008_VariableName_2), varName));
1301 ERROR_LOC(loc));
1302 }1281 }
13031282
1304 return NULL;1283 return NULL;
@@ -1909,10 +1888,10 @@
1909 {1888 {
1910 VarInDecl* varDecl = varDecls[j];1889 VarInDecl* varDecl = varDecls[j];
19111890
1912 vars.insert(lookup_var(varDecl->get_var_name(), loc, err::XPST0008));1891 vars.insert(lookup_var(varDecl->get_var_name(), loc, true));
19131892
1914 if (varDecl->get_posvar() != NULL)1893 if (varDecl->get_posvar() != NULL)
1915 vars.insert(lookup_var(varDecl->get_posvar()->get_name(), loc, err::XPST0008));1894 vars.insert(lookup_var(varDecl->get_posvar()->get_name(), loc, true));
1916 }1895 }
1917 }1896 }
1918 else if (typeid(c) == typeid(LetClause))1897 else if (typeid(c) == typeid(LetClause))
@@ -1922,13 +1901,13 @@
19221901
1923 for (int j = (int)lV.size() - 1; j >= 0; --j)1902 for (int j = (int)lV.size() - 1; j >= 0; --j)
1924 {1903 {
1925 vars.insert(lookup_var(lV[j]->get_var_name(), loc, err::XPST0008));1904 vars.insert(lookup_var(lV[j]->get_var_name(), loc, true));
1926 }1905 }
1927 }1906 }
1928 else if (typeid(c) == typeid(WindowClause))1907 else if (typeid(c) == typeid(WindowClause))
1929 {1908 {
1930 const WindowClause& wc = *static_cast<const WindowClause *>(&c);1909 const WindowClause& wc = *static_cast<const WindowClause *>(&c);
1931 vars.insert(lookup_var(wc.get_var()->get_var_name(), loc, err::XPST0008));1910 vars.insert(lookup_var(wc.get_var()->get_var_name(), loc, true));
1932 for (int j = 1; j >= 0; j--)1911 for (int j = 1; j >= 0; j--)
1933 {1912 {
1934 const FLWORWinCond* cond = &*wc[j];1913 const FLWORWinCond* cond = &*wc[j];
@@ -1938,13 +1917,13 @@
1938 if (wv != NULL)1917 if (wv != NULL)
1939 {1918 {
1940 if (wv->get_next())1919 if (wv->get_next())
1941 vars.insert(lookup_var(wv->get_next(), loc, err::XPST0008));1920 vars.insert(lookup_var(wv->get_next(), loc, true));
1942 if (wv->get_prev())1921 if (wv->get_prev())
1943 vars.insert(lookup_var(wv->get_prev(), loc, err::XPST0008));1922 vars.insert(lookup_var(wv->get_prev(), loc, true));
1944 if (wv->get_curr())1923 if (wv->get_curr())
1945 vars.insert(lookup_var(wv->get_curr(), loc, err::XPST0008));1924 vars.insert(lookup_var(wv->get_curr(), loc, true));
1946 if (wv->get_posvar() != NULL)1925 if (wv->get_posvar() != NULL)
1947 vars.insert(lookup_var(wv->get_posvar()->get_name(), loc, err::XPST0008));1926 vars.insert(lookup_var(wv->get_posvar()->get_name(), loc, true));
1948 }1927 }
1949 }1928 }
1950 }1929 }
@@ -1953,7 +1932,7 @@
1953 {1932 {
1954 vars.insert(lookup_var(static_cast<const CountClause*>(&c)->get_varname(),1933 vars.insert(lookup_var(static_cast<const CountClause*>(&c)->get_varname(),
1955 loc,1934 loc,
1956 err::XPST0008));1935 true));
1957 }1936 }
1958 else if (typeid(c) == typeid(OrderByClause))1937 else if (typeid(c) == typeid(OrderByClause))
1959 {1938 {
@@ -1968,7 +1947,7 @@
1968 {1947 {
1969 GroupSpec* groupSpec = (*(groupClause.get_spec_list()))[gSpecPos];1948 GroupSpec* groupSpec = (*(groupClause.get_spec_list()))[gSpecPos];
1970 if (groupSpec->get_binding_expr() != NULL)1949 if (groupSpec->get_binding_expr() != NULL)
1971 vars.insert(lookup_var(groupSpec->get_var_name(), loc, err::XPST0008));1950 vars.insert(lookup_var(groupSpec->get_var_name(), loc, true));
1972 }1951 }
19731952
1974 // Group-by redefines ALL previous variables, but the GroupByClause lists1953 // Group-by redefines ALL previous variables, but the GroupByClause lists
@@ -2169,7 +2148,7 @@
2169 theSctx->set_default_elem_type_ns(targetNS, true, loc);2148 theSctx->set_default_elem_type_ns(targetNS, true, loc);
21702149
2171 if (! pfx.empty())2150 if (! pfx.empty())
2172 theSctx->bind_ns(pfx, targetNS, loc, err::XQST0033);2151 theSctx->bind_ns(pfx, targetNS, loc);
2173 }2152 }
21742153
2175 zstring xsdTNS = zstring(XML_SCHEMA_NS);2154 zstring xsdTNS = zstring(XML_SCHEMA_NS);
@@ -3005,7 +2984,7 @@
3005 ! (pfx == theModulePrefix &&2984 ! (pfx == theModulePrefix &&
3006 targetNS == theModuleNamespace))2985 targetNS == theModuleNamespace))
3007 {2986 {
3008 theSctx->bind_ns(pfx, targetNS, loc, err::XQST0033);2987 theSctx->bind_ns(pfx, targetNS, loc);
3009 }2988 }
30102989
3011 const URILiteralList* atlist = v.get_at_list();2990 const URILiteralList* atlist = v.get_at_list();
@@ -3988,7 +3967,7 @@
39883967
3989 if (theSctx->xquery_version() >= StaticContextConsts::xquery_version_3_0)3968 if (theSctx->xquery_version() >= StaticContextConsts::xquery_version_3_0)
3990 {3969 {
3991 ve = lookup_var(qnameItem, loc, err::XPST0008);3970 ve = lookup_var(qnameItem, loc, true);
39923971
3993 assert(ve);3972 assert(ve);
3994 }3973 }
@@ -5003,16 +4982,10 @@
5003 flwor_expr* evFlworExpr = theExprManager->4982 flwor_expr* evFlworExpr = theExprManager->
5004 create_flwor_expr(theRootSctx, theUDF, loc, false);4983 create_flwor_expr(theRootSctx, theUDF, loc, false);
50054984
5006 evFlworExpr->set_return_expr(theExprManager->create_const_expr(theRootSctx,4985 evFlworExpr->set_return_expr(CREATE(const)(theRootSctx, theUDF, loc, true));
5007 theUDF,
5008 loc,
5009 true));
50104986
5011 // $x_ in dc:collection( xs:QName("org:employees") )4987 // $x_ in dc:collection( xs:QName("org:employees") )
5012 var_expr* evVarExpr = bind_var(loc,4988 var_expr* evVarExpr = bind_var(loc, varItem, var_expr::for_var, NULL);
5013 varItem,
5014 var_expr::for_var,
5015 NULL);
50164989
5017 // maybe make one more collExpr?4990 // maybe make one more collExpr?
5018 evFlworExpr->add_clause(wrap_in_forclause(collExpr, evVarExpr, NULL));4991 evFlworExpr->add_clause(wrap_in_forclause(collExpr, evVarExpr, NULL));
@@ -5941,7 +5914,7 @@
5941{5914{
5942 TRACE_VISIT_OUT();5915 TRACE_VISIT_OUT();
59435916
5944 var_expr* ve = lookup_var(v.get_name(), loc, err::XPST0008);5917 var_expr* ve = lookup_var(v.get_name(), loc, true);
59455918
5946 if ((ve->get_kind() != var_expr::local_var &&5919 if ((ve->get_kind() != var_expr::local_var &&
5947 ve->get_kind() != var_expr::prolog_var) ||5920 ve->get_kind() != var_expr::prolog_var) ||
@@ -6862,11 +6835,11 @@
68626835
6863 if (spec->get_binding_expr() == NULL)6836 if (spec->get_binding_expr() == NULL)
6864 {6837 {
6865 ve = lookup_var(varname, loc, err::XPST0008);6838 ve = lookup_var(varname, loc, true);
6866 }6839 }
6867 else6840 else
6868 {6841 {
6869 ve = lookup_var(varname, loc, zerr::ZXQP0000_NO_ERROR);6842 ve = lookup_var(varname, loc, false);
6870 }6843 }
68716844
6872 if (ve != NULL)6845 if (ve != NULL)
@@ -6947,16 +6920,14 @@
6947 if (!var)6920 if (!var)
6948 {6921 {
6949 RAISE_ERROR(err::XPST0008, specLoc,6922 RAISE_ERROR(err::XPST0008, specLoc,
6950 ERROR_PARAMS(varName->getStringValue(), ZED(VariabledUndeclared)));6923 ERROR_PARAMS(ZED(XPST0008_VariableName_2), varName->getStringValue()));
6951 }6924 }
69526925
6953 expr* inputExpr = var->getVar();6926 expr* inputExpr = var->getVar();
69546927
6955 if (inputExpr->get_expr_kind() == var_expr_kind)6928 assert(inputExpr->get_expr_kind() == var_expr_kind);
6956 {6929
6957 inputExpr = theExprManager->6930 inputExpr = CREATE(wrapper)(theRootSctx, theUDF, specLoc, inputExpr);
6958 create_wrapper_expr(theRootSctx, theUDF, specLoc, inputExpr);
6959 }
69606931
6961 inputExpr = wrap_in_atomization(inputExpr);6932 inputExpr = wrap_in_atomization(inputExpr);
69626933
@@ -8633,7 +8604,8 @@
8633 if (e.diagnostic() == err::FORG0001)8604 if (e.diagnostic() == err::FORG0001)
8634 throw;// XQUERY_EXCEPTION(err::XPST0003, ERROR_LOC(loc));8605 throw;// XQUERY_EXCEPTION(err::XPST0003, ERROR_LOC(loc));
8635 else8606 else
8636 RAISE_ERROR(err::XPST0081, loc, ERROR_PARAMS(result->getStringValue()));8607 RAISE_ERROR(err::XPST0081, loc,
8608 ERROR_PARAMS(ce->get_val()->getStringValue()));
8637 }8609 }
8638 }8610 }
86398611
@@ -9345,7 +9317,7 @@
93459317
9346 if (stepExpr->get_expr_kind() == wrapper_expr_kind)9318 if (stepExpr->get_expr_kind() == wrapper_expr_kind)
9347 {9319 {
9348 var_expr* dotVar = lookup_var(DOT_VARNAME, loc, zerr::ZXQP0000_NO_ERROR);9320 var_expr* dotVar = lookup_var(DOT_VARNAME, loc, false);
9349 if (static_cast<wrapper_expr*>(stepExpr)->get_input() == dotVar)9321 if (static_cast<wrapper_expr*>(stepExpr)->get_input() == dotVar)
9350 errKind = TREAT_PATH_DOT;9322 errKind = TREAT_PATH_DOT;
9351 }9323 }
@@ -10371,7 +10343,7 @@
1037110343
10372 try10344 try
10373 {10345 {
10374 ve = lookup_var(v.get_name(), loc, err::XPST0008);10346 ve = lookup_var(v.get_name(), loc, true);
10375 }10347 }
10376 catch (const ZorbaException& e)10348 catch (const ZorbaException& e)
10377 {10349 {
@@ -10404,33 +10376,48 @@
1040410376
10405 xqtref_t declaredType = ve->get_type();10377 xqtref_t declaredType = ve->get_type();
1040610378
10407 if (declaredType != NULL && !TypeOps::is_in_scope(tm, *declaredType))10379 if (declaredType != NULL && !TypeOps::is_in_scope(tm, *declaredType) &&
10380 theSctx->xquery_version() == StaticContextConsts::xquery_version_1_0)
10408 {10381 {
10409 const Error& error = (declaredType->get_manager() == tm ?10382 if (declaredType->get_manager() == tm)
10410 err::XPTY0004 : err::XQST0036);
10411
10412 if (theModuleNamespace.empty())
10413 {10383 {
10414 throw XQUERY_EXCEPTION_VAR(10384 if (theModuleNamespace.empty())
10415 error,10385 {
10416 ERROR_PARAMS(ZED(BadType_23o),10386 RAISE_ERROR(err::XPTY0004, loc,
10417 *declaredType,10387 ERROR_PARAMS(ZED(BadType_23o),
10418 ZED( NoTypeInMainModule_4 ),10388 *declaredType,
10419 ve->get_name()->getStringValue()),10389 ZED(NoTypeInMainModule_4),
10420 ERROR_LOC( loc )10390 ve->get_name()->getStringValue()));
10421 );10391 }
10392 else
10393 {
10394 RAISE_ERROR(err::XPTY0004, loc,
10395 ERROR_PARAMS(ZED(BadType_23o),
10396 *declaredType,
10397 ZED(NoTypeInModule_45),
10398 ve->get_name()->getStringValue(),
10399 theModuleNamespace));
10400 }
10422 }10401 }
10423 else10402 else
10424 {10403 {
10425 throw XQUERY_EXCEPTION_VAR(10404 if (theModuleNamespace.empty())
10426 error,10405 {
10427 ERROR_PARAMS(ZED(BadType_23o),10406 RAISE_ERROR(err::XQST0036, loc,
10428 *declaredType,10407 ERROR_PARAMS(ZED(BadType_23o),
10429 ZED( NoTypeInModule_45 ),10408 *declaredType,
10409 ZED(NoTypeInMainModule_4),
10410 ve->get_name()->getStringValue()));
10411 }
10412 else
10413 {
10414 RAISE_ERROR(err::XQST0036, loc,
10415 ERROR_PARAMS(ZED(BadType_23o),
10416 *declaredType,
10417 ZED(NoTypeInModule_45),
10430 ve->get_name()->getStringValue(),10418 ve->get_name()->getStringValue(),
10431 theModuleNamespace),10419 theModuleNamespace));
10432 ERROR_LOC( loc )10420 }
10433 );
10434 }10421 }
10435 }10422 }
1043610423
@@ -10578,7 +10565,8 @@
1057810565
10579 xqtref_t retType = sign.returnType();10566 xqtref_t retType = sign.returnType();
1058010567
10581 if (!TypeOps::is_in_scope(tm, *retType))10568 if (!TypeOps::is_in_scope(tm, *retType) &&
10569 theSctx->xquery_version() == StaticContextConsts::xquery_version_1_0)
10582 {10570 {
10583 if (theModuleNamespace.empty())10571 if (theModuleNamespace.empty())
10584 {10572 {
@@ -10604,7 +10592,9 @@
10604 for (csize i = 0; i < numParams; ++i)10592 for (csize i = 0; i < numParams; ++i)
10605 {10593 {
10606 xqtref_t type = sign[i];10594 xqtref_t type = sign[i];
10607 if (!TypeOps::is_in_scope(tm, *type))10595
10596 if (!TypeOps::is_in_scope(tm, *type) &&
10597 theSctx->xquery_version() == StaticContextConsts::xquery_version_1_0)
10608 {10598 {
10609 if (theModuleNamespace.empty())10599 if (theModuleNamespace.empty())
10610 {10600 {
@@ -11186,7 +11176,7 @@
11186 ztd::to_string(theTempVarCounter++);11176 ztd::to_string(theTempVarCounter++);
11187 GENV_ITEMFACTORY->createQName(qnameItem, "", "", localName.c_str());11177 GENV_ITEMFACTORY->createQName(qnameItem, "", "", localName.c_str());
11188 }11178 }
11189 while (lookup_var(qnameItem, loc, zerr::ZXQP0000_NO_ERROR) != NULL);11179 while (lookup_var(qnameItem, loc, false) != NULL);
1119011180
11191 var_expr* var = create_var(loc, qnameItem, var_expr::let_var);11181 var_expr* var = create_var(loc, qnameItem, var_expr::let_var);
11192 temp_vars.push_back(var);11182 temp_vars.push_back(var);
@@ -11976,7 +11966,7 @@
1197611966
1197711967
11978/*******************************************************************************11968/*******************************************************************************
11979 [120] DirAttributeList ::= DirAttr | DirAttributeList DirAttr11969 [120] DirAttributeList ::= DirAttr | DirAttributeList DirAttr
11980********************************************************************************/11970********************************************************************************/
11981void* begin_visit(const DirAttributeList& v)11971void* begin_visit(const DirAttributeList& v)
11982{11972{
@@ -11998,7 +11988,7 @@
11998 }11988 }
11999 }11989 }
1200011990
12001 unsigned long numAttrs = 0;11991 csize numAttrs = 0;
12002 std::vector<attr_expr*> attributes;11992 std::vector<attr_expr*> attributes;
12003 while(true)11993 while(true)
12004 {11994 {
@@ -12009,7 +11999,7 @@
12009 attr_expr* attrExpr = dynamic_cast<attr_expr*>(expr);11999 attr_expr* attrExpr = dynamic_cast<attr_expr*>(expr);
12010 const store::Item* attExprName = attrExpr->getQName();12000 const store::Item* attExprName = attrExpr->getQName();
1201112001
12012 for (unsigned long i = 0; i < numAttrs; ++i)12002 for (csize i = 0; i < numAttrs; ++i)
12013 {12003 {
12014 const store::Item* attName = attributes[i]->getQName();12004 const store::Item* attName = attributes[i]->getQName();
12015 if (attName->equals(attExprName))12005 if (attName->equals(attExprName))
@@ -12034,8 +12024,8 @@
12034 args.push_back((*it));12024 args.push_back((*it));
12035 }12025 }
1203612026
12037 fo_expr* expr_list =12027 fo_expr* expr_list =
12038 theExprManager->create_fo_expr(theRootSctx, theUDF, loc, op_concatenate, args);12028 CREATE(fo)(theRootSctx, theUDF, loc, op_concatenate, args);
1203912029
12040 normalize_fo(expr_list);12030 normalize_fo(expr_list);
1204112031
@@ -12045,6 +12035,7 @@
12045 return NULL; // reject visitor -- everything done12035 return NULL; // reject visitor -- everything done
12046}12036}
1204712037
12038
12048void end_visit(const DirAttributeList& v, void* /*visit_state*/)12039void end_visit(const DirAttributeList& v, void* /*visit_state*/)
12049{12040{
12050 // begin_visit() rejects visitor12041 // begin_visit() rejects visitor
@@ -12089,15 +12080,13 @@
12089 prefix = qname->get_localname();12080 prefix = qname->get_localname();
1209012081
12091 if (ZSTREQ(prefix, "xmlns"))12082 if (ZSTREQ(prefix, "xmlns"))
12092 throw XQUERY_EXCEPTION(12083 RAISE_ERROR(err::XQST0070, loc,
12093 err::XQST0070,12084 ERROR_PARAMS(prefix, ZED(NoRebindPrefix)));
12094 ERROR_PARAMS( prefix, ZED( NoRebindPrefix ) ),
12095 ERROR_LOC( loc )
12096 );
12097 }12085 }
1209812086
12099 const_expr* constValueExpr = dynamic_cast<const_expr*>(valueExpr);12087 const_expr* constValueExpr = dynamic_cast<const_expr*>(valueExpr);
12100 fo_expr* foExpr = dynamic_cast<fo_expr*>(valueExpr);12088 fo_expr* foExpr = dynamic_cast<fo_expr*>(valueExpr);
12089
12101 if (foExpr != NULL && foExpr->get_func() != op_concatenate)12090 if (foExpr != NULL && foExpr->get_func() != op_concatenate)
12102 foExpr = NULL;12091 foExpr = NULL;
1210312092
@@ -12108,7 +12097,7 @@
12108 }12097 }
12109 else if (foExpr != NULL)12098 else if (foExpr != NULL)
12110 {12099 {
12111 for (unsigned int i=0; i<foExpr->num_args(); i++)12100 for (csize i = 0; i < foExpr->num_args(); ++i)
12112 {12101 {
12113 const_expr* constValueExpr = dynamic_cast<const_expr*>(foExpr->get_arg(i));12102 const_expr* constValueExpr = dynamic_cast<const_expr*>(foExpr->get_arg(i));
12114 if (constValueExpr != NULL)12103 if (constValueExpr != NULL)
@@ -12143,7 +12132,7 @@
12143 RAISE_ERROR(err::XQST0070, loc, ERROR_PARAMS(uri, ZED(NoBindURI)));12132 RAISE_ERROR(err::XQST0070, loc, ERROR_PARAMS(uri, ZED(NoBindURI)));
12144 }12133 }
1214512134
12146 theSctx->bind_ns(prefix, uri, loc, err::XQST0071);12135 theSctx->bind_ns(prefix, uri, loc);
12147 theNSCtx->bind_ns(prefix, uri);12136 theNSCtx->bind_ns(prefix, uri);
1214812137
12149 if (prefix.empty())12138 if (prefix.empty())
@@ -12159,7 +12148,7 @@
1215912148
12160 // unbind the prefix12149 // unbind the prefix
12161 zstring empty;12150 zstring empty;
12162 theSctx->bind_ns(prefix, empty, loc, err::XQST0071);12151 theSctx->bind_ns(prefix, empty, loc);
12163 theNSCtx->bind_ns(prefix, empty);12152 theNSCtx->bind_ns(prefix, empty);
1216412153
12165 if (prefix.empty())12154 if (prefix.empty())
@@ -12170,13 +12159,13 @@
12170 throw XQUERY_EXCEPTION(err::XQST0022, ERROR_LOC(loc));12159 throw XQUERY_EXCEPTION(err::XQST0022, ERROR_LOC(loc));
12171 }12160 }
12172 }12161 }
12173 else
12174 // Plain direct attribute12162 // Plain direct attribute
12163 else
12175 {12164 {
12176 store::Item_t qnameItem;12165 store::Item_t qnameItem;
12177 expand_no_default_qname(qnameItem, qname, qname->get_location());12166 expand_no_default_qname(qnameItem, qname, qname->get_location());
1217812167
12179 expr* nameExpr = theExprManager->create_const_expr(theRootSctx, theUDF, loc, qnameItem);12168 expr* nameExpr = CREATE(const)(theRootSctx, theUDF, loc, qnameItem);
1218012169
12181 fo_expr* foExpr = NULL;12170 fo_expr* foExpr = NULL;
12182 if ((foExpr = dynamic_cast<fo_expr*>(valueExpr)) != NULL &&12171 if ((foExpr = dynamic_cast<fo_expr*>(valueExpr)) != NULL &&
@@ -12904,7 +12893,8 @@
1290412893
12905 xqtref_t t = CTX_TM->create_named_atomic_type(qnameItem,12894 xqtref_t t = CTX_TM->create_named_atomic_type(qnameItem,
12906 TypeConstants::QUANT_ONE,12895 TypeConstants::QUANT_ONE,
12907 loc);12896 loc,
12897 false);
1290812898
12909 // some types that should never be parsed, like xs:untyped, are;12899 // some types that should never be parsed, like xs:untyped, are;
12910 // we catch them with is_simple()12900 // we catch them with is_simple()
@@ -13269,11 +13259,8 @@
1326913259
13270 if (contentType == NULL)13260 if (contentType == NULL)
13271 {13261 {
13272 throw XQUERY_EXCEPTION(13262 RAISE_ERROR(err::XPST0008, loc,
13273 err::XPST0008,13263 ERROR_PARAMS(typeNameItem->getStringValue(), ZED(AttributeName)));
13274 ERROR_PARAMS( typeNameItem->getStringValue(), ZED( AttributeName ) ),
13275 ERROR_LOC( loc )
13276 );
13277 }13264 }
13278 }13265 }
1327913266
1328013267
=== modified file 'src/context/dynamic_context.cpp'
--- src/context/dynamic_context.cpp 2012-12-11 00:22:26 +0000
+++ src/context/dynamic_context.cpp 2013-01-08 11:10:56 +0000
@@ -462,7 +462,7 @@
462 theVarValues[varid].theState == VarValue::undeclared)462 theVarValues[varid].theState == VarValue::undeclared)
463 {463 {
464 RAISE_ERROR(err::XPDY0002, loc,464 RAISE_ERROR(err::XPDY0002, loc,
465 ERROR_PARAMS(varname->getStringValue(), ZED(VariabledUndeclared)));465 ERROR_PARAMS(ZED(XPDY0002_VariableUndeclared_2), varname->getStringValue()));
466 }466 }
467467
468 valueIter->open();468 valueIter->open();
@@ -516,7 +516,7 @@
516 theVarValues[varid].theState == VarValue::undeclared)516 theVarValues[varid].theState == VarValue::undeclared)
517 {517 {
518 RAISE_ERROR(err::XPDY0002, loc,518 RAISE_ERROR(err::XPDY0002, loc,
519 ERROR_PARAMS(varname->getStringValue(), ZED(VariabledUndeclared)));519 ERROR_PARAMS(ZED(XPDY0002_VariableUndeclared_2), varname->getStringValue()));
520 }520 }
521521
522 VarValue& var = theVarValues[varid];522 VarValue& var = theVarValues[varid];
@@ -559,7 +559,7 @@
559 theVarValues[varid].theState == VarValue::undeclared)559 theVarValues[varid].theState == VarValue::undeclared)
560 {560 {
561 RAISE_ERROR(err::XPDY0002, loc,561 RAISE_ERROR(err::XPDY0002, loc,
562 ERROR_PARAMS(varname->getStringValue(), ZED(VariabledUndeclared)));562 ERROR_PARAMS(ZED(XPDY0002_VariableUndeclared_2), varname->getStringValue()));
563 }563 }
564564
565 VarValue& var = theVarValues[varid];565 VarValue& var = theVarValues[varid];
@@ -606,14 +606,14 @@
606 {606 {
607 zstring varName = static_context::var_name(varname.getp());607 zstring varName = static_context::var_name(varname.getp());
608 RAISE_ERROR(err::XPDY0002, loc,608 RAISE_ERROR(err::XPDY0002, loc,
609 ERROR_PARAMS(varName, ZED(VariabledUndeclared)));609 ERROR_PARAMS(ZED(XPDY0002_VariableUndeclared_2), varName));
610 }610 }
611611
612 if (theVarValues[varid].theState == VarValue::declared)612 if (theVarValues[varid].theState == VarValue::declared)
613 {613 {
614 zstring varName = static_context::var_name(varname.getp());614 zstring varName = static_context::var_name(varname.getp());
615 RAISE_ERROR(err::XPDY0002, loc,615 RAISE_ERROR(err::XPDY0002, loc,
616 ERROR_PARAMS(varName, ZED(VariabledHasNoValue)));616 ERROR_PARAMS(ZED(XPDY0002_VariableHasNoValue_2), varName));
617 }617 }
618618
619 const VarValue& var = theVarValues[varid];619 const VarValue& var = theVarValues[varid];
620620
=== modified file 'src/context/namespace_context.cpp'
--- src/context/namespace_context.cpp 2012-12-28 10:24:59 +0000
+++ src/context/namespace_context.cpp 2013-01-08 11:10:56 +0000
@@ -101,7 +101,7 @@
101 else101 else
102 {102 {
103 QueryLoc loc;103 QueryLoc loc;
104 bool found = m_sctx->lookup_ns(aNamespace, aPrefix, loc, zerr::ZXQP0000_NO_ERROR);104 bool found = m_sctx->lookup_ns(aNamespace, aPrefix, loc, false);
105105
106 if (!found && aPrefix.empty())106 if (!found && aPrefix.empty())
107 {107 {
108108
=== modified file 'src/context/root_static_context.cpp'
--- src/context/root_static_context.cpp 2012-12-12 19:34:45 +0000
+++ src/context/root_static_context.cpp 2013-01-08 11:10:56 +0000
@@ -33,7 +33,7 @@
3333
34#ifdef WIN3234#ifdef WIN32
35#include <zorba/config.h>35#include <zorba/config.h>
36#endif WIN3236#endif //WIN32
3737
3838
39// DEFINE ENVIRONMENT VARIABLES39// DEFINE ENVIRONMENT VARIABLES
4040
=== modified file 'src/context/static_context.cpp'
--- src/context/static_context.cpp 2012-12-11 20:27:40 +0000
+++ src/context/static_context.cpp 2013-01-08 11:10:56 +0000
@@ -2045,8 +2045,7 @@
2045void static_context::bind_ns(2045void static_context::bind_ns(
2046 const zstring& prefix,2046 const zstring& prefix,
2047 const zstring& ns,2047 const zstring& ns,
2048 const QueryLoc& loc,2048 const QueryLoc& loc)
2049 const Error& err)
2050{2049{
2051 if (theNamespaceBindings == NULL)2050 if (theNamespaceBindings == NULL)
2052 {2051 {
@@ -2057,9 +2056,7 @@
20572056
2058 if (!theNamespaceBindings->insert(prefix, temp))2057 if (!theNamespaceBindings->insert(prefix, temp))
2059 {2058 {
2060 throw XQUERY_EXCEPTION_VAR(err,2059 RAISE_ERROR(err::XQST0033, loc, ERROR_PARAMS(prefix, ns));
2061 ERROR_PARAMS(prefix, temp),
2062 ERROR_LOC(loc));
2063 }2060 }
2064}2061}
20652062
@@ -2075,19 +2072,17 @@
2075 zstring& ns,2072 zstring& ns,
2076 const zstring& prefix,2073 const zstring& prefix,
2077 const QueryLoc& loc,2074 const QueryLoc& loc,
2078 const Error& err) const2075 bool raiseError) const
2079{2076{
2080 if (theNamespaceBindings == NULL || !theNamespaceBindings->get(prefix, ns))2077 if (theNamespaceBindings == NULL || !theNamespaceBindings->get(prefix, ns))
2081 {2078 {
2082 if (theParent != NULL)2079 if (theParent != NULL)
2083 {2080 {
2084 return theParent->lookup_ns(ns, prefix, loc, err);2081 return theParent->lookup_ns(ns, prefix, loc, raiseError);
2085 }2082 }
2086 else if (err != zerr::ZXQP0000_NO_ERROR)2083 else if (raiseError)
2087 {2084 {
2088 throw XQUERY_EXCEPTION_VAR(2085 RAISE_ERROR(err::XPST0081, loc, ERROR_PARAMS(prefix));
2089 err, ERROR_PARAMS( prefix ), ERROR_LOC( loc )
2090 );
2091 }2086 }
2092 else2087 else
2093 {2088 {
@@ -2096,11 +2091,9 @@
2096 }2091 }
2097 else if (!prefix.empty() && ns.empty())2092 else if (!prefix.empty() && ns.empty())
2098 {2093 {
2099 if (err != zerr::ZXQP0000_NO_ERROR)2094 if (raiseError)
2100 {2095 {
2101 throw XQUERY_EXCEPTION_VAR(2096 RAISE_ERROR(err::XPST0081, loc, ERROR_PARAMS(prefix));
2102 err, ERROR_PARAMS( prefix ), ERROR_LOC( loc )
2103 );
2104 }2097 }
2105 else2098 else
2106 {2099 {
@@ -2188,10 +2181,7 @@
2188/***************************************************************************//**2181/***************************************************************************//**
21892182
2190********************************************************************************/2183********************************************************************************/
2191void static_context::bind_var(2184void static_context::bind_var(var_expr* varExpr, const QueryLoc& loc)
2192 var_expr* varExpr,
2193 const QueryLoc& loc,
2194 const Error& err)
2195{2185{
2196 if (theVariablesMap == NULL)2186 if (theVariablesMap == NULL)
2197 {2187 {
@@ -2208,8 +2198,7 @@
22082198
2209 if (!theVariablesMap->insert(qname, vi))2199 if (!theVariablesMap->insert(qname, vi))
2210 {2200 {
2211 throw XQUERY_EXCEPTION_VAR(err,2201 goto error;
2212 ERROR_PARAMS(qname->getStringValue()), ERROR_LOC(loc));
2213 }2202 }
22142203
2215 if (varExpr->get_kind() == var_expr::prolog_var)2204 if (varExpr->get_kind() == var_expr::prolog_var)
@@ -2219,10 +2208,32 @@
2219 {2208 {
2220 if (!theVariablesMap->insert(qname, vi))2209 if (!theVariablesMap->insert(qname, vi))
2221 {2210 {
2222 throw XQUERY_EXCEPTION_VAR(err,2211 goto error;
2223 ERROR_PARAMS(qname->getStringValue()), ERROR_LOC(loc));
2224 }2212 }
2225 }2213 }
2214
2215 return;
2216
2217 error:
2218 switch (varExpr->get_kind())
2219 {
2220 case var_expr::let_var:
2221 {
2222 RAISE_ERROR(err::XQST0039, loc, ERROR_PARAMS(qname->getStringValue()));
2223 }
2224 case var_expr::win_var:
2225 case var_expr::wincond_out_var:
2226 case var_expr::wincond_out_pos_var:
2227 case var_expr::wincond_in_var:
2228 case var_expr::wincond_in_pos_var:
2229 {
2230 RAISE_ERROR(err::XQST0103, loc, ERROR_PARAMS(qname->getStringValue()));
2231 }
2232 default:
2233 {
2234 RAISE_ERROR(err::XQST0049, loc, ERROR_PARAMS(qname->getStringValue()));
2235 }
2236 }
2226}2237}
22272238
22282239
@@ -4085,7 +4096,7 @@
40854096
4086 if (!ve->is_private())4097 if (!ve->is_private())
4087 {4098 {
4088 bind_var(ve, loc, err::XQST0049);4099 bind_var(ve, loc);
4089 }4100 }
4090 else4101 else
4091 {4102 {
40924103
=== modified file 'src/context/static_context.h'
--- src/context/static_context.h 2012-12-06 01:17:18 +0000
+++ src/context/static_context.h 2013-01-08 11:10:56 +0000
@@ -853,14 +853,13 @@
853 void bind_ns(853 void bind_ns(
854 const zstring& prefix,854 const zstring& prefix,
855 const zstring& ns,855 const zstring& ns,
856 const QueryLoc& loc,856 const QueryLoc& loc);
857 const Error& err = err::XQST0033);
858857
859 bool lookup_ns(858 bool lookup_ns(
860 zstring& ns,859 zstring& ns,
861 const zstring& prefix,860 const zstring& prefix,
862 const QueryLoc& loc,861 const QueryLoc& loc,
863 const Error& err = err::XPST0081) const;862 bool raiseError = true) const;
864863
865 void expand_qname(864 void expand_qname(
866 store::Item_t& qname,865 store::Item_t& qname,
@@ -874,7 +873,7 @@
874 //873 //
875 // Variables874 // Variables
876 //875 //
877 void bind_var(var_expr* expr, const QueryLoc& loc, const Error& err);876 void bind_var(var_expr* expr, const QueryLoc& loc);
878877
879 VarInfo* lookup_var(const store::Item* qname) const;878 VarInfo* lookup_var(const store::Item* qname) const;
880879
881880
=== modified file 'src/diagnostics/diagnostic_en.xml'
--- src/diagnostics/diagnostic_en.xml 2012-12-29 06:48:09 +0000
+++ src/diagnostics/diagnostic_en.xml 2013-01-08 11:10:56 +0000
@@ -136,7 +136,19 @@
136 that is not defined in the static context, except for an ElementName in136 that is not defined in the static context, except for an ElementName in
137 an ElementTest or an AttributeName in an AttributeTest.137 an ElementTest or an AttributeName in an AttributeTest.
138 </comment>138 </comment>
139 <value>"$1": undefined $2</value>139 <value>$1</value>
140
141 <entry key="VariableName_2">
142 <value>"$2": undeclared variable</value>
143 </entry>
144
145 <entry key="SchemaAttributeName_2">
146 <value>"$2": undefined schema-attribute name</value>
147 </entry>
148
149 <entry key="SchemaElementName_2">
150 <value>"$2": undefined schema-element name</value>
151 </entry>
140 </diagnostic>152 </diagnostic>
141153
142 <diagnostic code="XPST0017">154 <diagnostic code="XPST0017">
@@ -714,7 +726,19 @@
714 It is a dynamic error if evaluation of an expression relies on some part726 It is a dynamic error if evaluation of an expression relies on some part
715 of the dynamic context that has not been assigned a value.727 of the dynamic context that has not been assigned a value.
716 </comment>728 </comment>
717 <value>"$1": $2</value>729 <value>$1</value>
730
731 <entry key="VariableHasNoValue_2">
732 <value>"$2": variable has no value</value>
733 </entry>
734
735 <entry key="VariableUndeclared_2">
736 <value>"$2": undeclared variable</value>
737 </entry>
738
739 <entry key="ContextUndeclared_2">
740 <value>$2 not declared</value>
741 </entry>
718 </diagnostic>742 </diagnostic>
719743
720 <diagnostic code="XPDY0050">744 <diagnostic code="XPDY0050">
@@ -1522,7 +1546,7 @@
1522 affects an element node by introducing a new namespace binding that1546 affects an element node by introducing a new namespace binding that
1523 conflicts with one of its existing namespace bindings.1547 conflicts with one of its existing namespace bindings.
1524 </comment>1548 </comment>
1525 <value>"$1": namespace binding conflicts with $2=$3</value>1549 <value>"$1": qname causes namespace binding conflict: prefix $2 cannot be bound to both $3 and $4</value>
1526 </diagnostic>1550 </diagnostic>
15271551
1528 <diagnostic code="XUDY0024">1552 <diagnostic code="XUDY0024">
@@ -1972,8 +1996,8 @@
1972 <value>XQuery not compiled in debug mode</value>1996 <value>XQuery not compiled in debug mode</value>
1973 </diagnostic>1997 </diagnostic>
19741998
1975 <diagnostic code="ZAPI0011" name="ELEMENT_NOT_DECLARED">1999 <diagnostic code="ZAPI0011" name="VARIABLE_NOT_DECLARED">
1976 <value>"$1": undefined $2</value>2000 <value>"$1": undeclared variable</value>
1977 </diagnostic>2001 </diagnostic>
19782002
1979 <diagnostic code="ZAPI0014" name="INVALID_ARGUMENT">2003 <diagnostic code="ZAPI0014" name="INVALID_ARGUMENT">
@@ -3545,14 +3569,6 @@
3545 <value>the standalone attribute has a value other than "omit"</value>3569 <value>the standalone attribute has a value other than "omit"</value>
3546 </entry>3570 </entry>
35473571
3548 <entry key="SchemaAttributeName">
3549 <value>schema-attribute name</value>
3550 </entry>
3551
3552 <entry key="SchemaElementName">
3553 <value>schema-element name</value>
3554 </entry>
3555
3556 <entry key="SchemaOutOfMemory">3572 <entry key="SchemaOutOfMemory">
3557 <value>OutOfMemoryException during parsing</value>3573 <value>OutOfMemoryException during parsing</value>
3558 </entry>3574 </entry>
@@ -3802,18 +3818,6 @@
3802 <value>"$2": variable value must be single item</value>3818 <value>"$2": variable value must be single item</value>
3803 </entry>3819 </entry>
38043820
3805 <entry key="Variable">
3806 <value>variable</value>
3807 </entry>
3808
3809 <entry key="VariabledHasNoValue">
3810 <value>variable has no value</value>
3811 </entry>
3812
3813 <entry key="VariabledUndeclared">
3814 <value>undeclared variable</value>
3815 </entry>
3816
3817 <entry key="XMLSchema">3821 <entry key="XMLSchema">
3818 <value>XML schema</value>3822 <value>XML schema</value>
3819 </entry>3823 </entry>
38203824
=== modified file 'src/diagnostics/pregenerated/diagnostic_list.cpp'
--- src/diagnostics/pregenerated/diagnostic_list.cpp 2012-12-21 22:05:39 +0000
+++ src/diagnostics/pregenerated/diagnostic_list.cpp 2013-01-08 11:10:56 +0000
@@ -717,7 +717,7 @@
717ZorbaErrorCode ZAPI0009_XQUERY_NOT_COMPILED_IN_DEBUG_MODE( "ZAPI0009" );717ZorbaErrorCode ZAPI0009_XQUERY_NOT_COMPILED_IN_DEBUG_MODE( "ZAPI0009" );
718718
719719
720ZorbaErrorCode ZAPI0011_ELEMENT_NOT_DECLARED( "ZAPI0011" );720ZorbaErrorCode ZAPI0011_VARIABLE_NOT_DECLARED( "ZAPI0011" );
721721
722722
723ZorbaErrorCode ZAPI0014_INVALID_ARGUMENT( "ZAPI0014" );723ZorbaErrorCode ZAPI0014_INVALID_ARGUMENT( "ZAPI0014" );
724724
=== modified file 'src/diagnostics/pregenerated/dict_en.cpp'
--- src/diagnostics/pregenerated/dict_en.cpp 2012-12-29 06:48:09 +0000
+++ src/diagnostics/pregenerated/dict_en.cpp 2013-01-08 11:10:56 +0000
@@ -178,12 +178,12 @@
178 { "SESU0007", "\"$1\": unsupported encoding" },178 { "SESU0007", "\"$1\": unsupported encoding" },
179 { "SESU0011", "\"$1\": unsupported normalization form" },179 { "SESU0011", "\"$1\": unsupported normalization form" },
180 { "SESU0013", "\"$1\": unsupported $2 version; supported versions are: $3" },180 { "SESU0013", "\"$1\": unsupported $2 version; supported versions are: $3" },
181 { "XPDY0002", "\"$1\": $2" },181 { "XPDY0002", "$1" },
182 { "XPDY0050", "\"$1\" cannot be treated as type $2" },182 { "XPDY0050", "\"$1\" cannot be treated as type $2" },
183 { "XPST0001", "${\"1\": }undefined value${: 2}" },183 { "XPST0001", "${\"1\": }undefined value${: 2}" },
184 { "XPST0003", "invalid expression${: 1}" },184 { "XPST0003", "invalid expression${: 1}" },
185 { "XPST0005", "static type must not be empty-sequence()" },185 { "XPST0005", "static type must not be empty-sequence()" },
186 { "XPST0008", "\"$1\": undefined $2" },186 { "XPST0008", "$1" },
187 { "XPST0017", "\"$1\": $2" },187 { "XPST0017", "\"$1\": $2" },
188 { "XPST0051", "\"$1\": not defined as atomic type${: 2}" },188 { "XPST0051", "\"$1\": not defined as atomic type${: 2}" },
189 { "XPST0080", "\"$1\": invalid type for \"cast\" or \"castable\" exression" },189 { "XPST0080", "\"$1\": invalid type for \"cast\" or \"castable\" exression" },
@@ -276,7 +276,7 @@
276 { "XUDY0018", "\"$1\": function declared external, non-updating returns non-empty pending update list" },276 { "XUDY0018", "\"$1\": function declared external, non-updating returns non-empty pending update list" },
277 { "XUDY0019", "\"$1\": function declated external, updating returns non-empty data model instance" },277 { "XUDY0019", "\"$1\": function declated external, updating returns non-empty data model instance" },
278 { "XUDY0021", "$1${ 2}" },278 { "XUDY0021", "$1${ 2}" },
279 { "XUDY0023", "\"$1\": namespace binding conflicts with $2=$3" },279 { "XUDY0023", "\"$1\": qname causes namespace binding conflict: prefix $2 cannot be bound to both $3 and $4" },
280 { "XUDY0024", "\"$1\": namespace binding conflicts with $2=$3" },280 { "XUDY0024", "\"$1\": namespace binding conflicts with $2=$3" },
281 { "XUDY0027", "target expression is empty sequence" },281 { "XUDY0027", "target expression is empty sequence" },
282 { "XUDY0029", "node has no parent in \"insert\" expression (with \"before\" or \"after\")" },282 { "XUDY0029", "node has no parent in \"insert\" expression (with \"before\" or \"after\")" },
@@ -304,7 +304,7 @@
304 { "ZAPI0007", "cannot serialize pul" },304 { "ZAPI0007", "cannot serialize pul" },
305 { "ZAPI0008", "can not execute a non-updating XQuery" },305 { "ZAPI0008", "can not execute a non-updating XQuery" },
306 { "ZAPI0009", "XQuery not compiled in debug mode" },306 { "ZAPI0009", "XQuery not compiled in debug mode" },
307 { "ZAPI0011", "\"$1\": undefined $2" },307 { "ZAPI0011", "\"$1\": undeclared variable" },
308 { "ZAPI0014", "\"$1\": invalid argument${: 2}" },308 { "ZAPI0014", "\"$1\": invalid argument${: 2}" },
309 { "ZAPI0015", "\"$1\": createModule() function not found${: 2}" },309 { "ZAPI0015", "\"$1\": createModule() function not found${: 2}" },
310 { "ZAPI0019", "\"$1\": external module already registered" },310 { "ZAPI0019", "\"$1\": external module already registered" },
@@ -784,8 +784,6 @@
784#endif784#endif
785 { "~SEPM0009_Not10", "the version parameter has a value other than \"1.0\" and the doctype-system parameter is specified" },785 { "~SEPM0009_Not10", "the version parameter has a value other than \"1.0\" and the doctype-system parameter is specified" },
786 { "~SEPM0009_NotOmit", "the standalone attribute has a value other than \"omit\"" },786 { "~SEPM0009_NotOmit", "the standalone attribute has a value other than \"omit\"" },
787 { "~SchemaAttributeName", "schema-attribute name" },
788 { "~SchemaElementName", "schema-element name" },
789 { "~SchemaOutOfMemory", "OutOfMemoryException during parsing" },787 { "~SchemaOutOfMemory", "OutOfMemoryException during parsing" },
790 { "~SchemaParseError", "error during parsing" },788 { "~SchemaParseError", "error during parsing" },
791 { "~SchemaUnexpected", "unexpected exception during parsing" },789 { "~SchemaUnexpected", "unexpected exception during parsing" },
@@ -871,10 +869,10 @@
871#endif869#endif
872 { "~UnexpectedElement", "unexpected element" },870 { "~UnexpectedElement", "unexpected element" },
873 { "~VarValMustBeSingleItem_2", "\"$2\": variable value must be single item" },871 { "~VarValMustBeSingleItem_2", "\"$2\": variable value must be single item" },
874 { "~Variable", "variable" },
875 { "~VariabledHasNoValue", "variable has no value" },
876 { "~VariabledUndeclared", "undeclared variable" },
877 { "~XMLSchema", "XML schema" },872 { "~XMLSchema", "XML schema" },
873 { "~XPDY0002_ContextUndeclared_2", "$2 not declared" },
874 { "~XPDY0002_VariableHasNoValue_2", "\"$2\": variable has no value" },
875 { "~XPDY0002_VariableUndeclared_2", "\"$2\": undeclared variable" },
878 { "~XPST0003_Annotations", "function and variable annotations only available in XQuery 3.0 or later" },876 { "~XPST0003_Annotations", "function and variable annotations only available in XQuery 3.0 or later" },
879 { "~XPST0003_CountClause30", "\"count\" clause only available in XQuery 3.0 or later" },877 { "~XPST0003_CountClause30", "\"count\" clause only available in XQuery 3.0 or later" },
880 { "~XPST0003_ModuleDeclNotInMain", "module declaration must not be in main module" },878 { "~XPST0003_ModuleDeclNotInMain", "module declaration must not be in main module" },
@@ -886,6 +884,9 @@
886 { "~XPST0003_TryCatchExpr30", "\"try/catch\" expressions only available in XQuery 3.0 or later" },884 { "~XPST0003_TryCatchExpr30", "\"try/catch\" expressions only available in XQuery 3.0 or later" },
887 { "~XPST0003_WindowClause30", "\"window\" clause only available in XQuery 3.0 or later" },885 { "~XPST0003_WindowClause30", "\"window\" clause only available in XQuery 3.0 or later" },
888 { "~XPST0003_XQueryVersionAtLeast30_2", "\"$2\": XQuery version must be at least 3.0" },886 { "~XPST0003_XQueryVersionAtLeast30_2", "\"$2\": XQuery version must be at least 3.0" },
887 { "~XPST0008_SchemaAttributeName_2", "\"$2\": undefined schema-attribute name" },
888 { "~XPST0008_SchemaElementName_2", "\"$2\": undefined schema-element name" },
889 { "~XPST0008_VariableName_2", "\"$2\": undeclared variable" },
889 { "~XPTY0004_FormatNumber_2", "first parameter to format-number() function is type $2 that is not allowed" },890 { "~XPTY0004_FormatNumber_2", "first parameter to format-number() function is type $2 that is not allowed" },
890 { "~XPTY0004_JSONIQ_SELECTOR", "can not atomize and/or cast value of type $2 to string" },891 { "~XPTY0004_JSONIQ_SELECTOR", "can not atomize and/or cast value of type $2 to string" },
891 { "~XPTY0004_MultiValuedGroupingKey", "atomization of grouping variable produces more than one item" },892 { "~XPTY0004_MultiValuedGroupingKey", "atomization of grouping variable produces more than one item" },
892893
=== modified file 'src/diagnostics/pregenerated/dict_zed_keys.h'
--- src/diagnostics/pregenerated/dict_zed_keys.h 2012-12-29 06:48:09 +0000
+++ src/diagnostics/pregenerated/dict_zed_keys.h 2013-01-08 11:10:56 +0000
@@ -33,6 +33,9 @@
33#define ZED_XPST0003_Annotations "~XPST0003_Annotations"33#define ZED_XPST0003_Annotations "~XPST0003_Annotations"
34#define ZED_XPST0003_Scripting "~XPST0003_Scripting"34#define ZED_XPST0003_Scripting "~XPST0003_Scripting"
35#define ZED_XPST0003_PiTarget "~XPST0003_PiTarget"35#define ZED_XPST0003_PiTarget "~XPST0003_PiTarget"
36#define ZED_XPST0008_VariableName_2 "~XPST0008_VariableName_2"
37#define ZED_XPST0008_SchemaAttributeName_2 "~XPST0008_SchemaAttributeName_2"
38#define ZED_XPST0008_SchemaElementName_2 "~XPST0008_SchemaElementName_2"
36#define ZED_XPTY0004_NoReturnTypePromote_234 "~XPTY0004_NoReturnTypePromote_234"39#define ZED_XPTY0004_NoReturnTypePromote_234 "~XPTY0004_NoReturnTypePromote_234"
37#define ZED_XPTY0004_NoParamTypePromote_234 "~XPTY0004_NoParamTypePromote_234"40#define ZED_XPTY0004_NoParamTypePromote_234 "~XPTY0004_NoParamTypePromote_234"
38#define ZED_XPTY0004_NoTypePromote_23 "~XPTY0004_NoTypePromote_23"41#define ZED_XPTY0004_NoTypePromote_23 "~XPTY0004_NoTypePromote_23"
@@ -45,6 +48,9 @@
45#define ZED_XPTY0117_NotationParam_23 "~XPTY0117_NotationParam_23"48#define ZED_XPTY0117_NotationParam_23 "~XPTY0117_NotationParam_23"
46#define ZED_XQST0106_THE_SAME "~XQST0106_THE_SAME"49#define ZED_XQST0106_THE_SAME "~XQST0106_THE_SAME"
47#define ZED_XQST0106_CONFLICTING "~XQST0106_CONFLICTING"50#define ZED_XQST0106_CONFLICTING "~XQST0106_CONFLICTING"
51#define ZED_XPDY0002_VariableHasNoValue_2 "~XPDY0002_VariableHasNoValue_2"
52#define ZED_XPDY0002_VariableUndeclared_2 "~XPDY0002_VariableUndeclared_2"
53#define ZED_XPDY0002_ContextUndeclared_2 "~XPDY0002_ContextUndeclared_2"
48#define ZED_FTST0009_BadStopWordsLang "~FTST0009_BadStopWordsLang"54#define ZED_FTST0009_BadStopWordsLang "~FTST0009_BadStopWordsLang"
49#define ZED_FTST0009_BadStemmerLang "~FTST0009_BadStemmerLang"55#define ZED_FTST0009_BadStemmerLang "~FTST0009_BadStemmerLang"
50#define ZED_FTST0009_BadThesaurusLang "~FTST0009_BadThesaurusLang"56#define ZED_FTST0009_BadThesaurusLang "~FTST0009_BadThesaurusLang"
@@ -236,8 +242,6 @@
236#define ZED_QuotedColon_23 "~QuotedColon_23"242#define ZED_QuotedColon_23 "~QuotedColon_23"
237#define ZED_SEPM0009_Not10 "~SEPM0009_Not10"243#define ZED_SEPM0009_Not10 "~SEPM0009_Not10"
238#define ZED_SEPM0009_NotOmit "~SEPM0009_NotOmit"244#define ZED_SEPM0009_NotOmit "~SEPM0009_NotOmit"
239#define ZED_SchemaAttributeName "~SchemaAttributeName"
240#define ZED_SchemaElementName "~SchemaElementName"
241#define ZED_SchemaOutOfMemory "~SchemaOutOfMemory"245#define ZED_SchemaOutOfMemory "~SchemaOutOfMemory"
242#define ZED_SchemaParseError "~SchemaParseError"246#define ZED_SchemaParseError "~SchemaParseError"
243#define ZED_SchemaUnexpected "~SchemaUnexpected"247#define ZED_SchemaUnexpected "~SchemaUnexpected"
@@ -300,9 +304,6 @@
300#define ZED_UnescapedChar_3 "~UnescapedChar_3"304#define ZED_UnescapedChar_3 "~UnescapedChar_3"
301#define ZED_UnexpectedElement "~UnexpectedElement"305#define ZED_UnexpectedElement "~UnexpectedElement"
302#define ZED_VarValMustBeSingleItem_2 "~VarValMustBeSingleItem_2"306#define ZED_VarValMustBeSingleItem_2 "~VarValMustBeSingleItem_2"
303#define ZED_Variable "~Variable"
304#define ZED_VariabledHasNoValue "~VariabledHasNoValue"
305#define ZED_VariabledUndeclared "~VariabledUndeclared"
306#define ZED_XMLSchema "~XMLSchema"307#define ZED_XMLSchema "~XMLSchema"
307#define ZED_XUST0002_Transform "~XUST0002_Transform"308#define ZED_XUST0002_Transform "~XUST0002_Transform"
308#define ZED_XUST0002_UDF_2 "~XUST0002_UDF_2"309#define ZED_XUST0002_UDF_2 "~XUST0002_UDF_2"
309310
=== modified file 'src/runtime/core/var_iterators.cpp'
--- src/runtime/core/var_iterators.cpp 2012-10-08 12:09:36 +0000
+++ src/runtime/core/var_iterators.cpp 2013-01-08 11:10:56 +0000
@@ -464,7 +464,7 @@
464 else464 else
465 {465 {
466 RAISE_ERROR(err::XPDY0002, loc,466 RAISE_ERROR(err::XPDY0002, loc,
467 ERROR_PARAMS(theVarName->getStringValue(), ZED(VariabledUndeclared)));467 ERROR_PARAMS(ZED(XPDY0002_VariableUndeclared_2), theVarName->getStringValue()));
468 }468 }
469 } // if (theTargetPosIter != NULL && theTargetLenIter == NULL && theInfLen == false)469 } // if (theTargetPosIter != NULL && theTargetLenIter == NULL && theInfLen == false)
470470
@@ -532,7 +532,7 @@
532 else532 else
533 {533 {
534 RAISE_ERROR(err::XPDY0002, loc,534 RAISE_ERROR(err::XPDY0002, loc,
535 ERROR_PARAMS(theVarName->getStringValue(), ZED(VariabledUndeclared)));535 ERROR_PARAMS(ZED(XPDY0002_VariableUndeclared_2), theVarName->getStringValue()));
536 }536 }
537 } // if (theTargetPosIter != NULL && theTargetLenIter != NULL)537 } // if (theTargetPosIter != NULL && theTargetLenIter != NULL)
538538
@@ -565,7 +565,7 @@
565 else565 else
566 {566 {
567 RAISE_ERROR(err::XPDY0002, loc,567 RAISE_ERROR(err::XPDY0002, loc,
568 ERROR_PARAMS(theVarName->getStringValue(), ZED(VariabledUndeclared)));568 ERROR_PARAMS(ZED(XPDY0002_VariableUndeclared_2), theVarName->getStringValue()));
569 }569 }
570 } // if (theTargetPos > 0)570 } // if (theTargetPos > 0)
571571
@@ -596,7 +596,7 @@
596 else596 else
597 {597 {
598 RAISE_ERROR(err::XPDY0002, loc,598 RAISE_ERROR(err::XPDY0002, loc,
599 ERROR_PARAMS(theVarName->getStringValue(), ZED(VariabledUndeclared)));599 ERROR_PARAMS(ZED(XPDY0002_VariableUndeclared_2), theVarName->getStringValue()));
600 }600 }
601 }601 }
602602
603603
=== modified file 'src/runtime/eval/eval.cpp'
--- src/runtime/eval/eval.cpp 2012-10-24 11:32:56 +0000
+++ src/runtime/eval/eval.cpp 2013-01-08 11:10:56 +0000
@@ -310,7 +310,7 @@
310 ve->set_unique_id(outerGlobalVarId);310 ve->set_unique_id(outerGlobalVarId);
311 }311 }
312312
313 importSctx->bind_var(ve, loc, err::XQST0049);313 importSctx->bind_var(ve, loc);
314 }314 }
315315
316 // Import the outer-query ns bindings316 // Import the outer-query ns bindings
317317
=== modified file 'src/runtime/introspection/sctx_impl.cpp'
--- src/runtime/introspection/sctx_impl.cpp 2012-10-08 12:09:36 +0000
+++ src/runtime/introspection/sctx_impl.cpp 2013-01-08 11:10:56 +0000
@@ -102,7 +102,7 @@
102102
103 consumeNext(lName, theChildren[0].getp(), aPlanState);103 consumeNext(lName, theChildren[0].getp(), aPlanState);
104104
105 if (theSctx->lookup_ns(ns, lName->getStringValue(), loc, zerr::ZXQP0000_NO_ERROR))105 if (theSctx->lookup_ns(ns, lName->getStringValue(), loc, false))
106 {106 {
107 STACK_PUSH(GENV_ITEMFACTORY->createString(aResult, ns), state);107 STACK_PUSH(GENV_ITEMFACTORY->createString(aResult, ns), state);
108 }108 }
109109
=== modified file 'src/runtime/numerics/numerics_impl.cpp'
--- src/runtime/numerics/numerics_impl.cpp 2012-12-05 04:47:27 +0000
+++ src/runtime/numerics/numerics_impl.cpp 2013-01-08 11:10:56 +0000
@@ -909,27 +909,34 @@
909909
910 zstring ns;910 zstring ns;
911 zstring prefix = tmpFormatName.substr(0, tmpFormatName.find(':'));911 zstring prefix = tmpFormatName.substr(0, tmpFormatName.find(':'));
912 if (theSctx->lookup_ns(ns, prefix, loc, zerr::ZXQP0000_NO_ERROR))912 if (theSctx->lookup_ns(ns, prefix, loc, false))
913 {913 {
914 GENV_ITEMFACTORY->createQName(formatName, ns, prefix, tmpFormatName.substr(tmpFormatName.find(':')+1));914 GENV_ITEMFACTORY->createQName(formatName,
915 ns,
916 prefix,
917 tmpFormatName.substr(tmpFormatName.find(':')+1));
915 break;918 break;
916 }919 }
917920
918 // The prefix is not in the known namespaces, the only posibility left is for the function to be invoked from an EnclosedIterator921 // The prefix is not in the known namespaces, the only posibility left is for the function to be invoked from an EnclosedIterator
919 if (planState.theNodeConstuctionPath.empty())922 if (planState.theNodeConstuctionPath.empty())
920 {923 {
921 throw XQUERY_EXCEPTION(err::FODF1280, ERROR_PARAMS(tmpFormatName), ERROR_LOC(loc));924 RAISE_ERROR(err::FODF1280, loc, ERROR_PARAMS(tmpFormatName));
922 }925 }
923926
924 store::NsBindings bindings;927 store::NsBindings bindings;
925 planState.theNodeConstuctionPath.top()->getNamespaceBindings(bindings);928 planState.theNodeConstuctionPath.top()->getNamespaceBindings(bindings);
926 for (unsigned int i=0; i<bindings.size(); i++)929 for (unsigned int i = 0; i < bindings.size(); i++)
930 {
927 if (prefix == bindings[i].first)931 if (prefix == bindings[i].first)
928 {932 {
929 GENV_ITEMFACTORY->createQName(formatName, bindings[i].second, prefix, tmpFormatName.substr(tmpFormatName.find(':')+1));933 GENV_ITEMFACTORY->createQName(formatName,
934 bindings[i].second,
935 prefix,
936 tmpFormatName.substr(tmpFormatName.find(':')+1));
930 break;937 break;
931 }938 }
932939 }
933 } while(0);940 } while(0);
934941
935 if (formatName.isNull())942 if (formatName.isNull())
936943
=== modified file 'src/store/naive/node_items.cpp'
--- src/store/naive/node_items.cpp 2012-12-14 13:11:08 +0000
+++ src/store/naive/node_items.cpp 2013-01-08 11:10:56 +0000
@@ -22,8 +22,11 @@
22#include <zorba/item.h>22#include <zorba/item.h>
2323
24#include "api/unmarshaller.h"24#include "api/unmarshaller.h"
25
25#include "diagnostics/assert.h"26#include "diagnostics/assert.h"
27#include "diagnostics/util_macros.h"
26#include "diagnostics/xquery_diagnostics.h"28#include "diagnostics/xquery_diagnostics.h"
29
27#include "zorbatypes/URI.h"30#include "zorbatypes/URI.h"
28#ifndef ZORBA_NO_FULL_TEXT31#ifndef ZORBA_NO_FULL_TEXT
29#include "zorbautils/locale.h"32#include "zorbautils/locale.h"
@@ -3263,7 +3266,7 @@
3263********************************************************************************/3266********************************************************************************/
3264void ElementNode::checkNamespaceConflict(3267void ElementNode::checkNamespaceConflict(
3265 const store::Item* qname,3268 const store::Item* qname,
3266 Error const& ecode) const3269 const QueryLoc* loc) const
3267{3270{
3268 const QNameItem* qn = reinterpret_cast<const QNameItem*>(qname);3271 const QNameItem* qn = reinterpret_cast<const QNameItem*>(qname);
32693272
@@ -3279,7 +3282,8 @@
32793282
3280 if (found && ns2 != ns)3283 if (found && ns2 != ns)
3281 {3284 {
3282 throw XQUERY_EXCEPTION_VAR(ecode, ERROR_PARAMS(qname->show(), prefix, ns2));3285 RAISE_ERROR(err::XUDY0023, loc,
3286 ERROR_PARAMS(qn->getStringValue(), prefix, ns, ns2));
3283 }3287 }
3284}3288}
32853289
32863290
=== modified file 'src/store/naive/node_items.h'
--- src/store/naive/node_items.h 2012-12-14 13:23:51 +0000
+++ src/store/naive/node_items.h 2013-01-08 11:10:56 +0000
@@ -54,6 +54,9 @@
54namespace zorba54namespace zorba
55{55{
5656
57class QueryLoc;
58
59
57namespace store60namespace store
58{61{
59 class CopyMode;62 class CopyMode;
@@ -1086,7 +1089,7 @@
10861089
1087 void addBindingForQName2(const store::Item* qname);1090 void addBindingForQName2(const store::Item* qname);
10881091
1089 void checkNamespaceConflict(const store::Item* qname, Error const &ecode) const;1092 void checkNamespaceConflict(const store::Item* qname, const QueryLoc* loc) const;
10901093
1091 void uninheritBinding(1094 void uninheritBinding(
1092 NsBindingsContext* rootNSCtx,1095 NsBindingsContext* rootNSCtx,
10931096
=== modified file 'src/store/naive/pul_primitives.cpp'
--- src/store/naive/pul_primitives.cpp 2012-12-10 16:02:05 +0000
+++ src/store/naive/pul_primitives.cpp 2013-01-08 11:10:56 +0000
@@ -1277,17 +1277,17 @@
1277********************************************************************************/1277********************************************************************************/
1278void UpdDeleteNodesFromCollection::apply()1278void UpdDeleteNodesFromCollection::apply()
1279{1279{
1280 Collection* lColl = static_cast<Collection*>1280 Collection* coll = static_cast<Collection*>
1281 (GET_STORE().getCollection(theName, theIsDynamic).getp());1281 (GET_STORE().getCollection(theName, theIsDynamic).getp());
12821282
1283 assert(lColl);1283 assert(coll);
12841284
1285 theIsApplied = true;1285 theIsApplied = true;
12861286
1287 uint64_t size;1287 uint64_t size;
1288 try1288 try
1289 {1289 {
1290 size = to_xs_unsignedLong(lColl->size());1290 size = to_xs_unsignedLong(coll->size());
1291 }1291 }
1292 catch (std::range_error& e)1292 catch (std::range_error& e)
1293 {1293 {
@@ -1304,7 +1304,7 @@
1304 {1304 {
1305 for (csize i = numNodes; i > 0; --i)1305 for (csize i = numNodes; i > 0; --i)
1306 {1306 {
1307 if (theNodes[i-1] != lColl->nodeAt(xs_integer(size - i)))1307 if (theNodes[i-1] != coll->nodeAt(xs_integer(size - i)))
1308 {1308 {
1309 isLast = false;1309 isLast = false;
1310 break;1310 break;
@@ -1320,25 +1320,25 @@
1320 theFound.resize(numNodes);1320 theFound.resize(numNodes);
1321 thePositions.resize(numNodes);1321 thePositions.resize(numNodes);
13221322
1323 for (std::size_t i = 0; i < numNodes; ++i)1323 for (csize i = 0; i < numNodes; ++i)
1324 {1324 {
1325 theFound[i] = lColl->removeNode(theNodes[i], thePositions[i]);1325 theFound[i] = coll->removeNode(theNodes[i], thePositions[i]);
1326 ++theNumApplied;1326 ++theNumApplied;
1327 }1327 }
1328}1328}
13291329
1330void UpdDeleteNodesFromCollection::undo()1330void UpdDeleteNodesFromCollection::undo()
1331{1331{
1332 Collection* lColl = static_cast<Collection*>1332 Collection* coll = static_cast<Collection*>
1333 (GET_STORE().getCollection(theName, theIsDynamic).getp());1333 (GET_STORE().getCollection(theName, theIsDynamic).getp());
13341334
1335 assert(lColl);1335 assert(coll);
13361336
1337 for (csize i = 0; i < theNumApplied; ++i)1337 for (csize i = 0; i < theNumApplied; ++i)
1338 {1338 {
1339 if (theFound[i])1339 if (theFound[i])
1340 {1340 {
1341 lColl->addNode(theNodes[i], thePositions[i]);1341 coll->addNode(theNodes[i], thePositions[i]);
1342 }1342 }
1343 }1343 }
1344}1344}
@@ -1349,11 +1349,13 @@
1349********************************************************************************/1349********************************************************************************/
1350void UpdEditInCollection::apply()1350void UpdEditInCollection::apply()
1351{1351{
1352 Collection* lColl = static_cast<Collection*>1352#ifndef NDEBUG
1353 Collection* coll = static_cast<Collection*>
1353 (GET_STORE().getCollection(theName, theIsDynamic).getp());1354 (GET_STORE().getCollection(theName, theIsDynamic).getp());
13541355
1355 assert(lColl);1356 assert(coll);
1356 1357#endif
1358
1357 theTarget->swap(theContent.getp());1359 theTarget->swap(theContent.getp());
13581360
1359 theIsApplied = true;1361 theIsApplied = true;
@@ -1363,13 +1365,14 @@
1363void UpdEditInCollection::undo()1365void UpdEditInCollection::undo()
1364{1366{
1365 if (!theFound)1367 if (!theFound)
1366 {
1367 return;1368 return;
1368 }1369
1369 Collection* lColl = static_cast<Collection*>1370#ifndef NDEBUG
1371 Collection* coll = static_cast<Collection*>
1370 (GET_STORE().getCollection(theName, theIsDynamic).getp());1372 (GET_STORE().getCollection(theName, theIsDynamic).getp());
13711373
1372 assert(lColl);1374 assert(coll);
1375#endif
13731376
1374 theTarget->swap(theContent.getp());1377 theTarget->swap(theContent.getp());
1375}1378}
13761379
=== modified file 'src/store/naive/simple_pul.cpp'
--- src/store/naive/simple_pul.cpp 2012-12-10 16:02:05 +0000
+++ src/store/naive/simple_pul.cpp 2013-01-08 11:10:56 +0000
@@ -392,7 +392,7 @@
392392
393********************************************************************************/393********************************************************************************/
394void PULImpl::addInsertAttributes(394void PULImpl::addInsertAttributes(
395 const QueryLoc* aQueryLoc,395 const QueryLoc* loc,
396 store::Item_t& target,396 store::Item_t& target,
397 std::vector<store::Item_t>& attrs)397 std::vector<store::Item_t>& attrs)
398{398{
@@ -401,16 +401,16 @@
401 ElementNode* n = ELEM_NODE(target);401 ElementNode* n = ELEM_NODE(target);
402402
403 csize numAttrs = attrs.size();403 csize numAttrs = attrs.size();
404 for (csize i = 0; i < numAttrs; i++)404 for (csize i = 0; i < numAttrs; ++i)
405 {405 {
406 n->checkNamespaceConflict(attrs[i]->getNodeName(), err::XUDY0023);406 n->checkNamespaceConflict(attrs[i]->getNodeName(), loc);
407 }407 }
408408
409 NodeUpdates* updates = 0;409 NodeUpdates* updates = 0;
410 bool found = pul->theNodeToUpdatesMap.get(n, updates);410 bool found = pul->theNodeToUpdatesMap.get(n, updates);
411411
412 UpdInsertAttributes* upd = GET_PUL_FACTORY().412 UpdInsertAttributes* upd = GET_PUL_FACTORY().
413 createUpdInsertAttributes(pul, aQueryLoc, target, attrs);413 createUpdInsertAttributes(pul, loc, target, attrs);
414414
415 pul->theDoFirstList.push_back(upd);415 pul->theDoFirstList.push_back(upd);
416416
@@ -431,7 +431,7 @@
431431
432********************************************************************************/432********************************************************************************/
433void PULImpl::addReplaceNode(433void PULImpl::addReplaceNode(
434 const QueryLoc* aQueryLoc,434 const QueryLoc* loc,
435 store::Item_t& target,435 store::Item_t& target,
436 std::vector<store::Item_t>& newNodes)436 std::vector<store::Item_t>& newNodes)
437{437{
@@ -456,19 +456,19 @@
456 csize numNewAttrs = newNodes.size();456 csize numNewAttrs = newNodes.size();
457 for (csize i = 0; i < numNewAttrs; ++i)457 for (csize i = 0; i < numNewAttrs; ++i)
458 {458 {
459 elemParent->checkNamespaceConflict(newNodes[i]->getNodeName(), err::XUDY0023); 459 elemParent->checkNamespaceConflict(newNodes[i]->getNodeName(), loc);
460 }460 }
461 }461 }
462462
463 upd = GET_PUL_FACTORY().463 upd = GET_PUL_FACTORY().
464 createUpdReplaceAttribute(pul, aQueryLoc, parent, target, newNodes);464 createUpdReplaceAttribute(pul, loc, parent, target, newNodes);
465465
466 kind = store::UpdateConsts::UP_REPLACE_ATTRIBUTE;466 kind = store::UpdateConsts::UP_REPLACE_ATTRIBUTE;
467 }467 }
468 else468 else
469 {469 {
470 upd = GET_PUL_FACTORY().470 upd = GET_PUL_FACTORY().
471 createUpdReplaceChild(pul, aQueryLoc, parent, target, newNodes);471 createUpdReplaceChild(pul, loc, parent, target, newNodes);
472472
473 kind = store::UpdateConsts::UP_REPLACE_CHILD;473 kind = store::UpdateConsts::UP_REPLACE_CHILD;
474 }474 }
@@ -614,7 +614,7 @@
614614
615********************************************************************************/615********************************************************************************/
616void PULImpl::addRename(616void PULImpl::addRename(
617 const QueryLoc* aQueryLoc,617 const QueryLoc* loc,
618 store::Item_t& target,618 store::Item_t& target,
619 store::Item_t& newName)619 store::Item_t& newName)
620{620{
@@ -632,10 +632,9 @@
632 case store::StoreConsts::elementNode:632 case store::StoreConsts::elementNode:
633 {633 {
634 ElementNode* elemTarget = ELEM_NODE(target);634 ElementNode* elemTarget = ELEM_NODE(target);
635 elemTarget->checkNamespaceConflict(newName.getp(), err::XUDY0023);635 elemTarget->checkNamespaceConflict(newName.getp(), loc);
636636
637 upd = GET_PUL_FACTORY().637 upd = GET_PUL_FACTORY().createUpdRenameElem(pul, loc, target, newName);
638 createUpdRenameElem(pul, aQueryLoc, target, newName);
639 break;638 break;
640 }639 }
641 case store::StoreConsts::attributeNode:640 case store::StoreConsts::attributeNode:
@@ -643,16 +642,16 @@
643 ElementNode* elemParent = reinterpret_cast<ElementNode*>(n->theParent);642 ElementNode* elemParent = reinterpret_cast<ElementNode*>(n->theParent);
644643
645 if (elemParent != NULL)644 if (elemParent != NULL)
646 elemParent->checkNamespaceConflict(newName.getp(), err::XUDY0023);645 elemParent->checkNamespaceConflict(newName.getp(), loc);
647646
648 upd = GET_PUL_FACTORY().createUpdRenameAttr(pul, aQueryLoc, target, newName);647 upd = GET_PUL_FACTORY().createUpdRenameAttr(pul, loc, target, newName);
649 break;648 break;
650 }649 }
651 case store::StoreConsts::piNode:650 case store::StoreConsts::piNode:
652 {651 {
653 zstring tmp;652 zstring tmp;
654 newName->getStringValue2(tmp);653 newName->getStringValue2(tmp);
655 upd = GET_PUL_FACTORY().createUpdRenamePi(pul, aQueryLoc, target, tmp);654 upd = GET_PUL_FACTORY().createUpdRenamePi(pul, loc, target, tmp);
656 break;655 break;
657 }656 }
658 default:657 default:
@@ -670,7 +669,7 @@
670 else669 else
671 {670 {
672 csize numUpdates = updates->size();671 csize numUpdates = updates->size();
673 for (csize i = 0; i < numUpdates; i++)672 for (csize i = 0; i < numUpdates; ++i)
674 {673 {
675 if (store::UpdateConsts::isRename((*updates)[i]->getKind()))674 if (store::UpdateConsts::isRename((*updates)[i]->getKind()))
676 {675 {
677676
=== modified file 'src/types/casting.cpp'
--- src/types/casting.cpp 2012-12-29 06:48:09 +0000
+++ src/types/casting.cpp 2013-01-08 11:10:56 +0000
@@ -2371,7 +2371,7 @@
2371 xqtref_t sourceType = tm->create_named_type(item->getType(),2371 xqtref_t sourceType = tm->create_named_type(item->getType(),
2372 TypeConstants::QUANT_ONE,2372 TypeConstants::QUANT_ONE,
2373 loc,2373 loc,
2374 err::XPTY0004);2374 true);
23752375
2376 ZORBA_ASSERT(item->isAtomic());2376 ZORBA_ASSERT(item->isAtomic());
2377 ZORBA_ASSERT(sourceType != NULL);2377 ZORBA_ASSERT(sourceType != NULL);
@@ -2709,7 +2709,7 @@
2709 xqtref_t lSourceType = tm->create_named_type(aItem->getType(),2709 xqtref_t lSourceType = tm->create_named_type(aItem->getType(),
2710 TypeConstants::QUANT_ONE,2710 TypeConstants::QUANT_ONE,
2711 QueryLoc::null,2711 QueryLoc::null,
2712 err::XPTY0004);2712 true);
27132713
2714 TypeConstants::castable_t lIsCastable = TypeOps::castability(*lSourceType,2714 TypeConstants::castable_t lIsCastable = TypeOps::castability(*lSourceType,
2715 *targetType);2715 *targetType);
27162716
=== modified file 'src/types/schema/revalidateUtils.cpp'
--- src/types/schema/revalidateUtils.cpp 2012-12-28 10:24:59 +0000
+++ src/types/schema/revalidateUtils.cpp 2013-01-08 11:10:56 +0000
@@ -497,7 +497,8 @@
497{497{
498 xqtref_t type = typeManager->create_named_atomic_type(typeQName,498 xqtref_t type = typeManager->create_named_atomic_type(typeQName,
499 TypeConstants::QUANT_ONE,499 TypeConstants::QUANT_ONE,
500 loc);500 loc,
501 false);
501 //cout << " vup - processTextValue: '" << textValue->c_str() << "'\n";502 //cout << " vup - processTextValue: '" << textValue->c_str() << "'\n";
502 //cout << " vup - processTextValue: " << typeQName->getPrefix()->str()503 //cout << " vup - processTextValue: " << typeQName->getPrefix()->str()
503 // << ":" << typeQName->getLocalName()->str() << "@"504 // << ":" << typeQName->getLocalName()->str() << "@"
504505
=== modified file 'src/types/schema/schema.cpp'
--- src/types/schema/schema.cpp 2012-12-28 11:53:57 +0000
+++ src/types/schema/schema.cpp 2013-01-08 11:10:56 +0000
@@ -513,11 +513,8 @@
513513
514 if (!typeDef)514 if (!typeDef)
515 {515 {
516 throw XQUERY_EXCEPTION(516 RAISE_ERROR(err::XPST0008, loc,
517 err::XPST0008,517 ERROR_PARAMS(ZED(XPST0008_SchemaElementName_2), qname->getStringValue()));
518 ERROR_PARAMS( qname->getStringValue(), ZED( SchemaElementName ) ),
519 ERROR_LOC( loc )
520 );
521 }518 }
522519
523 const XMLCh* typeNameStr = typeDef->getName();520 const XMLCh* typeNameStr = typeDef->getName();
@@ -542,11 +539,8 @@
542539
543 if (!typeDef)540 if (!typeDef)
544 {541 {
545 throw XQUERY_EXCEPTION(542 RAISE_ERROR(err::XPST0008, loc,
546 err::XPST0008,543 ERROR_PARAMS(ZED(XPST0008_SchemaAttributeName_2), qname->getStringValue()));
547 ERROR_PARAMS( qname->getStringValue(), ZED( SchemaAttributeName ) ),
548 ERROR_LOC( loc )
549 );
550 }544 }
551545
552 const XMLCh* typeNameStr = typeDef->getName();546 const XMLCh* typeNameStr = typeDef->getName();
@@ -579,11 +573,8 @@
579573
580 if (!typeDef)574 if (!typeDef)
581 {575 {
582 throw XQUERY_EXCEPTION(576 RAISE_ERROR(err::XPST0008, loc,
583 err::XPST0008,577 ERROR_PARAMS(ZED(XPST0008_SchemaElementName_2), qname->getStringValue()));
584 ERROR_PARAMS( qname->getStringValue(), ZED( SchemaElementName ) ),
585 ERROR_LOC( loc )
586 );
587 }578 }
588579
589 xqtref_t res = createXQTypeFromTypeDefinition(typeManager, typeDef);580 xqtref_t res = createXQTypeFromTypeDefinition(typeManager, typeDef);
@@ -611,11 +602,8 @@
611602
612 if (!typeDef)603 if (!typeDef)
613 {604 {
614 throw XQUERY_EXCEPTION(605 RAISE_ERROR(err::XPST0008, loc,
615 err::XPST0008,606 ERROR_PARAMS(ZED(XPST0008_SchemaAttributeName_2), qname->getStringValue()));
616 ERROR_PARAMS( qname->getStringValue(), ZED( SchemaAttributeName ) ),
617 ERROR_LOC( loc )
618 );
619 }607 }
620608
621 return createXQTypeFromTypeDefinition(typeManager, typeDef);609 return createXQTypeFromTypeDefinition(typeManager, typeDef);
622610
=== modified file 'src/types/typeimpl.cpp'
--- src/types/typeimpl.cpp 2013-01-03 09:04:01 +0000
+++ src/types/typeimpl.cpp 2013-01-08 11:10:56 +0000
@@ -883,7 +883,7 @@
883 xqtref_t subContentType = tm->create_named_type(subitem->getType(),883 xqtref_t subContentType = tm->create_named_type(subitem->getType(),
884 TypeConstants::QUANT_ONE,884 TypeConstants::QUANT_ONE,
885 loc,885 loc,
886 err::XPTY0004);886 true);
887887
888 return TypeOps::is_subtype(tm, *subContentType, *theContentType);888 return TypeOps::is_subtype(tm, *subContentType, *theContentType);
889}889}
890890
=== modified file 'src/types/typemanager.h'
--- src/types/typemanager.h 2012-12-18 15:57:51 +0000
+++ src/types/typemanager.h 2013-01-08 11:10:56 +0000
@@ -111,7 +111,7 @@
111 store::Item* qname,111 store::Item* qname,
112 TypeConstants::quantifier_t q,112 TypeConstants::quantifier_t q,
113 const QueryLoc& loc,113 const QueryLoc& loc,
114 const Error& error = zerr::ZXQP0000_NO_ERROR) const = 0;114 bool raiseError) const = 0;
115115
116 virtual xqtref_t create_named_simple_type(116 virtual xqtref_t create_named_simple_type(
117 store::Item* qname) const = 0;117 store::Item* qname) const = 0;
@@ -120,7 +120,7 @@
120 store::Item* qname,120 store::Item* qname,
121 TypeConstants::quantifier_t q,121 TypeConstants::quantifier_t q,
122 const QueryLoc& loc,122 const QueryLoc& loc,
123 const Error& error = zerr::ZXQP0000_NO_ERROR) const = 0;123 bool raiseError = false) const = 0;
124124
125 virtual xqtref_t create_structured_item_type(TypeConstants::quantifier_t q) const = 0;125 virtual xqtref_t create_structured_item_type(TypeConstants::quantifier_t q) const = 0;
126126
127127
=== modified file 'src/types/typemanagerimpl.cpp'
--- src/types/typemanagerimpl.cpp 2012-12-28 10:24:59 +0000
+++ src/types/typemanagerimpl.cpp 2013-01-08 11:10:56 +0000
@@ -246,7 +246,7 @@
246 store::Item* qname,246 store::Item* qname,
247 TypeConstants::quantifier_t quantifier,247 TypeConstants::quantifier_t quantifier,
248 const QueryLoc& loc,248 const QueryLoc& loc,
249 const Error& error) const249 bool raiseError) const
250{250{
251 // Try to resolve the type name as a builtin atomic type251 // Try to resolve the type name as a builtin atomic type
252 RootTypeManager::qnametype_map_t& myMap = GENV_TYPESYSTEM.m_atomic_qnametype_map;252 RootTypeManager::qnametype_map_t& myMap = GENV_TYPESYSTEM.m_atomic_qnametype_map;
@@ -260,11 +260,10 @@
260 // type (because, otherwise it would have been found above). So we return NULL.260 // type (because, otherwise it would have been found above). So we return NULL.
261 if (ZSTREQ(qname->getNamespace(), XML_SCHEMA_NS))261 if (ZSTREQ(qname->getNamespace(), XML_SCHEMA_NS))
262 {262 {
263 if (error != zerr::ZXQP0000_NO_ERROR)263 if (raiseError)
264 {264 {
265 throw XQUERY_EXCEPTION_VAR(error,265 RAISE_ERROR(err::XPTY0004, loc,
266 ERROR_PARAMS(qname->getStringValue(), ZED(NotAmongInScopeSchemaTypes)),266 ERROR_PARAMS(qname->getStringValue(), ZED(NotAmongInScopeSchemaTypes)));
267 ERROR_LOC(loc));
268 }267 }
269 else268 else
270 {269 {
@@ -281,11 +280,10 @@
281280
282 if (namedType == NULL)281 if (namedType == NULL)
283 {282 {
284 if (error != zerr::ZXQP0000_NO_ERROR)283 if (raiseError)
285 {284 {
286 throw XQUERY_EXCEPTION_VAR(error,285 RAISE_ERROR(err::XPTY0004, loc,
287 ERROR_PARAMS(qname->getStringValue(), ZED(NotAmongInScopeSchemaTypes)),286 ERROR_PARAMS(qname->getStringValue(), ZED(NotAmongInScopeSchemaTypes)));
288 ERROR_LOC(loc));
289 }287 }
290 else288 else
291 {289 {
@@ -303,11 +301,10 @@
303 }301 }
304#endif302#endif
305303
306 if (error != zerr::ZXQP0000_NO_ERROR)304 if (raiseError)
307 {305 {
308 throw XQUERY_EXCEPTION_VAR(error,306 RAISE_ERROR(err::XPTY0004, loc,
309 ERROR_PARAMS(qname->getStringValue(), ZED(NotAmongInScopeSchemaTypes)),307 ERROR_PARAMS(qname->getStringValue(), ZED(NotAmongInScopeSchemaTypes)));
310 ERROR_LOC(loc));
311 }308 }
312 else309 else
313 {310 {
@@ -387,7 +384,7 @@
387 store::Item* qname,384 store::Item* qname,
388 TypeConstants::quantifier_t quant,385 TypeConstants::quantifier_t quant,
389 const QueryLoc& loc,386 const QueryLoc& loc,
390 const Error& error) const387 bool raiseError) const
391{388{
392 RootTypeManager& RTM = GENV_TYPESYSTEM;389 RootTypeManager& RTM = GENV_TYPESYSTEM;
393390
@@ -422,11 +419,10 @@
422419
423 if (namedType == NULL)420 if (namedType == NULL)
424 {421 {
425 if (error != zerr::ZXQP0000_NO_ERROR)422 if (raiseError)
426 {423 {
427 throw XQUERY_EXCEPTION_VAR(error,424 RAISE_ERROR(err::XPTY0004, loc,
428 ERROR_PARAMS(qname->getStringValue(), ZED(NotAmongInScopeSchemaTypes)),425 ERROR_PARAMS(qname->getStringValue(), ZED(NotAmongInScopeSchemaTypes)));
429 ERROR_LOC(loc));
430 }426 }
431 else427 else
432 {428 {
@@ -440,11 +436,10 @@
440 }436 }
441#endif437#endif
442438
443 if (error != zerr::ZXQP0000_NO_ERROR)439 if (raiseError)
444 {440 {
445 throw XQUERY_EXCEPTION_VAR(error,441 RAISE_ERROR(err::XPTY0004, loc,
446 ERROR_PARAMS(qname->getStringValue(), ZED(NotAmongInScopeSchemaTypes)),442 ERROR_PARAMS(qname->getStringValue(), ZED(NotAmongInScopeSchemaTypes)));
447 ERROR_LOC(loc));
448 }443 }
449 else444 else
450 {445 {
@@ -726,7 +721,7 @@
726 return create_named_atomic_type(item->getType(),721 return create_named_atomic_type(item->getType(),
727 quant,722 quant,
728 loc,723 loc,
729 err::XPTY0004);724 true);
730 }725 }
731 else if (item->isNode())726 else if (item->isNode())
732 {727 {
@@ -740,7 +735,7 @@
740 xqtref_t contentType = create_named_type(item->getType(),735 xqtref_t contentType = create_named_type(item->getType(),
741 quant,736 quant,
742 loc,737 loc,
743 err::XPTY0004);738 true);
744739
745 return create_node_type(nodeKind,740 return create_node_type(nodeKind,
746 item->getNodeName(),741 item->getNodeName(),
@@ -848,11 +843,8 @@
848{843{
849 if (m_schema == NULL)844 if (m_schema == NULL)
850 {845 {
851 throw XQUERY_EXCEPTION(846 RAISE_ERROR(err::XPST0008, loc,
852 err::XPST0008,847 ERROR_PARAMS(ZED(XPST0008_SchemaElementName_2), elemName->getStringValue()));
853 ERROR_PARAMS( elemName->getStringValue(), ZED( SchemaElementName ) ),
854 ERROR_LOC( loc )
855 );
856 }848 }
857849
858 xqtref_t contentType =850 xqtref_t contentType =
@@ -878,7 +870,7 @@
878 if (m_schema == NULL)870 if (m_schema == NULL)
879 {871 {
880 RAISE_ERROR(err::XPST0008, loc,872 RAISE_ERROR(err::XPST0008, loc,
881 ERROR_PARAMS(elemName->getStringValue(), ZED(SchemaElementName)));873 ERROR_PARAMS(ZED(XPST0008_SchemaElementName_2), elemName->getStringValue()));
882 }874 }
883875
884 m_schema->getTypeNameFromElementName(elemName, typeName, loc);876 m_schema->getTypeNameFromElementName(elemName, typeName, loc);
@@ -899,7 +891,7 @@
899 if (m_schema == NULL)891 if (m_schema == NULL)
900 {892 {
901 RAISE_ERROR(err::XPST0008, loc,893 RAISE_ERROR(err::XPST0008, loc,
902 ERROR_PARAMS(attrName->getStringValue(), ZED(SchemaAttributeName)));894 ERROR_PARAMS(ZED(XPST0008_SchemaAttributeName_2), attrName->getStringValue()));
903 }895 }
904896
905 xqtref_t contentType =897 xqtref_t contentType =
@@ -926,7 +918,7 @@
926 if (m_schema == NULL)918 if (m_schema == NULL)
927 {919 {
928 RAISE_ERROR(err::XPST0008, loc,920 RAISE_ERROR(err::XPST0008, loc,
929 ERROR_PARAMS(attrName->getStringValue(), ZED(SchemaAttributeName)));921 ERROR_PARAMS(ZED(XPST0008_SchemaAttributeName_2), attrName->getStringValue()));
930 }922 }
931923
932 m_schema->getTypeNameFromAttributeName(attrName, typeName, loc);924 m_schema->getTypeNameFromAttributeName(attrName, typeName, loc);
@@ -1105,7 +1097,7 @@
1105 ident.getUri().c_str(),1097 ident.getUri().c_str(),
1106 NULL,1098 NULL,
1107 ident.getLocalName().c_str());1099 ident.getLocalName().c_str());
1108 return create_named_type(i, q, QueryLoc::null, err::XPTY0004);1100 return create_named_type(i, q, QueryLoc::null, true);
1109 }1101 }
11101102
1111 case IdentTypes::ELEMENT_TYPE:1103 case IdentTypes::ELEMENT_TYPE:
11121104
=== modified file 'src/types/typemanagerimpl.h'
--- src/types/typemanagerimpl.h 2012-12-28 10:24:59 +0000
+++ src/types/typemanagerimpl.h 2013-01-08 11:10:56 +0000
@@ -108,7 +108,7 @@
108 store::Item* qname,108 store::Item* qname,
109 TypeConstants::quantifier_t quant,109 TypeConstants::quantifier_t quant,
110 const QueryLoc& loc,110 const QueryLoc& loc,
111 const Error& error = zerr::ZXQP0000_NO_ERROR) const;111 bool raiseError) const;
112112
113 virtual xqtref_t create_named_simple_type(113 virtual xqtref_t create_named_simple_type(
114 store::Item* qname) const;114 store::Item* qname) const;
@@ -117,7 +117,7 @@
117 store::Item* qname,117 store::Item* qname,
118 TypeConstants::quantifier_t quant,118 TypeConstants::quantifier_t quant,
119 const QueryLoc& loc,119 const QueryLoc& loc,
120 const Error& error = zerr::ZXQP0000_NO_ERROR) const;120 bool raiseError = false) const;
121121
122 xqtref_t create_structured_item_type(TypeConstants::quantifier_t q) const;122 xqtref_t create_structured_item_type(TypeConstants::quantifier_t q) const;
123123
124124
=== modified file 'src/types/typeops.cpp'
--- src/types/typeops.cpp 2012-12-28 10:24:59 +0000
+++ src/types/typeops.cpp 2013-01-08 11:10:56 +0000
@@ -777,7 +777,7 @@
777 xqtref_t subtype = tm->create_named_atomic_type(subitem->getType(),777 xqtref_t subtype = tm->create_named_atomic_type(subitem->getType(),
778 TypeConstants::QUANT_ONE,778 TypeConstants::QUANT_ONE,
779 loc,779 loc,
780 err::XPTY0004);780 true);
781 switch(subtype->type_kind()) 781 switch(subtype->type_kind())
782 {782 {
783 case XQType::ATOMIC_TYPE_KIND:783 case XQType::ATOMIC_TYPE_KIND:
@@ -866,7 +866,7 @@
866 xqtref_t subtype = tm->create_named_atomic_type(subitem->getType(),866 xqtref_t subtype = tm->create_named_atomic_type(subitem->getType(),
867 TypeConstants::QUANT_ONE,867 TypeConstants::QUANT_ONE,
868 loc,868 loc,
869 err::XPTY0004);869 true);
870 switch (subtype->type_kind())870 switch (subtype->type_kind())
871 {871 {
872 case XQType::ATOMIC_TYPE_KIND:872 case XQType::ATOMIC_TYPE_KIND:
@@ -911,7 +911,7 @@
911 xqtref_t subtype = tm->create_named_atomic_type(subitem->getType(),911 xqtref_t subtype = tm->create_named_atomic_type(subitem->getType(),
912 TypeConstants::QUANT_ONE,912 TypeConstants::QUANT_ONE,
913 loc,913 loc,
914 err::XPTY0004);914 true);
915 const UserDefinedXQType& udSuperType = 915 const UserDefinedXQType& udSuperType =
916 static_cast<const UserDefinedXQType&>(supertype);916 static_cast<const UserDefinedXQType&>(supertype);
917917
918918
=== modified file 'test/rbkt/Queries/zorba/modules/mainModule16.xq'
--- test/rbkt/Queries/zorba/modules/mainModule16.xq 2012-09-19 21:16:15 +0000
+++ test/rbkt/Queries/zorba/modules/mainModule16.xq 2013-01-08 11:10:56 +0000
@@ -5,6 +5,8 @@
5(: Purpose: Error XQST0036 :)5(: Purpose: Error XQST0036 :)
6(:*******************************************************:)6(:*******************************************************:)
77
8xquery version "1.0";
9
8import module namespace math = "http://example.org/math-functions" at10import module namespace math = "http://example.org/math-functions" at
9"libraryModule12.xqlib";11"libraryModule12.xqlib";
1012

Subscribers

People subscribed via source and target branches