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

Proposed by Markos Zaharioudakis on 2013-01-08
Status: Merged
Approved by: Markos Zaharioudakis on 2013-01-08
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 on 2013-01-08
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.
review: Approve
Zorba Build Bot (zorba-buildbot) wrote :

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

text conflict in ChangeLog

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 on 2013-01-08

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

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
1=== modified file 'ChangeLog'
2--- ChangeLog 2013-01-08 02:37:32 +0000
3+++ ChangeLog 2013-01-08 11:10:56 +0000
4@@ -46,6 +46,7 @@
5 * Fixed bug #1070551 (zerr:ZOSE0003 stream read failure)
6 * Fixed bug #992304 (Compiling library modules could load data from wrong
7 source)
8+ * Fixed bug #1043294 (XQST0036 not used in XQuery 3.0).
9 * Fixed bugs related to casting to user-defined types.
10
11
12
13=== modified file 'include/zorba/pregenerated/diagnostic_list.h'
14--- include/zorba/pregenerated/diagnostic_list.h 2012-12-21 22:05:39 +0000
15+++ include/zorba/pregenerated/diagnostic_list.h 2013-01-08 11:10:56 +0000
16@@ -492,7 +492,7 @@
17
18 extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZAPI0009_XQUERY_NOT_COMPILED_IN_DEBUG_MODE;
19
20-extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZAPI0011_ELEMENT_NOT_DECLARED;
21+extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZAPI0011_VARIABLE_NOT_DECLARED;
22
23 extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZAPI0014_INVALID_ARGUMENT;
24
25
26=== modified file 'modules/xqxq/xqxq.xq.src/xqxq.cpp'
27--- modules/xqxq/xqxq.xq.src/xqxq.cpp 2012-11-20 04:43:01 +0000
28+++ modules/xqxq/xqxq.xq.src/xqxq.cpp 2013-01-08 11:10:56 +0000
29@@ -609,7 +609,7 @@
30 }
31 catch (ZorbaException& ze)
32 {
33- if (ze.diagnostic() == zerr::ZAPI0011_ELEMENT_NOT_DECLARED)
34+ if (ze.diagnostic() == zerr::ZAPI0011_VARIABLE_NOT_DECLARED)
35 XQXQFunction::throwError("UndeclaredVariable", ze.what());
36 throw; // should not happen
37 }
38
39=== modified file 'src/api/dynamiccontextimpl.cpp'
40--- src/api/dynamiccontextimpl.cpp 2012-12-21 05:13:20 +0000
41+++ src/api/dynamiccontextimpl.cpp 2013-01-08 11:10:56 +0000
42@@ -129,11 +129,11 @@
43 if (!var)
44 {
45 throw XQUERY_EXCEPTION(err::XPST0008,
46- ERROR_PARAMS(BUILD_STRING('{',
47+ ERROR_PARAMS(ZED(XPST0008_VariableName_2),
48+ BUILD_STRING('{',
49 qnameItem->getNamespace(),
50 '}',
51- qnameItem->getLocalName()),
52- ZED(Variable)));
53+ qnameItem->getLocalName())));
54 }
55
56 return var;
57@@ -177,7 +177,8 @@
58 if (!var)
59 {
60 throw XQUERY_EXCEPTION(err::XPST0008,
61- ERROR_PARAMS(BUILD_STRING('{', inVarUri, '}', inVarLocalName ), ZED(Variable)));
62+ ERROR_PARAMS(ZED(XPST0008_VariableName_2),
63+ BUILD_STRING('{', inVarUri, '}', inVarLocalName )));
64 }
65
66 return var;
67
68=== modified file 'src/api/xqueryimpl.cpp'
69--- src/api/xqueryimpl.cpp 2012-10-08 12:09:36 +0000
70+++ src/api/xqueryimpl.cpp 2013-01-08 11:10:56 +0000
71@@ -848,12 +848,11 @@
72
73 if (!var)
74 {
75- throw XQUERY_EXCEPTION(zerr::ZAPI0011_ELEMENT_NOT_DECLARED,
76+ throw XQUERY_EXCEPTION(zerr::ZAPI0011_VARIABLE_NOT_DECLARED,
77 ERROR_PARAMS(BUILD_STRING('{',
78 qname->getNamespace(),
79 '}',
80- qname->getLocalName()),
81- ZED(Variable)));
82+ qname->getLocalName())));
83 }
84
85 if (var->hasInitializer())
86
87=== modified file 'src/compiler/parsetree/parsenodes.cpp'
88--- src/compiler/parsetree/parsenodes.cpp 2012-12-18 15:57:51 +0000
89+++ src/compiler/parsetree/parsenodes.cpp 2013-01-08 11:10:56 +0000
90@@ -17,6 +17,7 @@
91
92 #include "util/stl_util.h"
93 #include "diagnostics/assert.h"
94+#include "diagnostics/util_macros.h"
95 #include "diagnostics/xquery_diagnostics.h"
96
97 #include "types/typemanager.h"
98@@ -3644,20 +3645,23 @@
99 dir_content_hv.rbegin();
100
101 const DirElemContent* lPrev = 0;
102- // To find out if a DirElemContent is boundary whitespace, the current item cannot be accepted till
103- // the next item (relative to the current item) is passed to check_boundary_whitespace.
104+ // To find out if a DirElemContent is boundary whitespace, the current item
105+ // cannot be accepted till the next item (relative to the current item) is
106+ // passed to check_boundary_whitespace.
107 v.begin_check_boundary_whitespace();
108- for (; it!=dir_content_hv.rend(); ++it)
109+ for (; it != dir_content_hv.rend(); ++it)
110 {
111 const DirElemContent* e_p = &**it;
112 v.check_boundary_whitespace (*e_p);
113- if (lPrev != 0) {
114+ if (lPrev != 0)
115+ {
116 ACCEPT_CHK(lPrev);
117 }
118 lPrev = e_p;
119 }
120 v.end_check_boundary_whitespace();
121- if (lPrev != 0) {
122+ if (lPrev != 0)
123+ {
124 ACCEPT_CHK(lPrev);
125 }
126 END_VISITOR();
127@@ -3666,11 +3670,33 @@
128
129 // [97] DirAttributeList
130
131-DirAttributeList::DirAttributeList(
132- const QueryLoc& loc)
133-:
134+DirAttributeList::DirAttributeList(const QueryLoc& loc)
135+ :
136 parsenode(loc)
137-{}
138+{
139+}
140+
141+
142+void DirAttributeList::push_back(rchandle<DirAttr> attr)
143+{
144+ const QName* qname = attr->get_name();
145+
146+ if (qname->get_qname() == "xmlns" || qname->get_prefix() == "xmlns")
147+ {
148+ std::vector<rchandle<DirAttr> >::const_iterator ite = theAttributes.begin();
149+ std::vector<rchandle<DirAttr> >::const_iterator end = theAttributes.end();
150+ for (; ite != end; ++ite)
151+ {
152+ if (*((*ite)->get_name()) == *(qname))
153+ {
154+ RAISE_ERROR(err::XQST0071, attr->get_location(),
155+ ERROR_PARAMS(attr->get_name()->get_qname()));
156+ }
157+ }
158+ }
159+
160+ theAttributes.push_back(attr);
161+}
162
163
164 void DirAttributeList::accept( parsenode_visitor &v ) const
165
166=== modified file 'src/compiler/parsetree/parsenodes.h'
167--- src/compiler/parsetree/parsenodes.h 2012-12-21 22:05:39 +0000
168+++ src/compiler/parsetree/parsenodes.h 2013-01-08 11:10:56 +0000
169@@ -4358,13 +4358,13 @@
170 public:
171 DirAttributeList(const QueryLoc&);
172
173- void push_back(rchandle<DirAttr> attr) { theAttributes.push_back(attr); }
174+ void push_back(rchandle<DirAttr> attr);
175
176 rchandle<DirAttr> operator[](int i) { return theAttributes[i]; }
177
178- const DirAttr *operator[] (int i) const { return theAttributes[i]; }
179+ const DirAttr* operator[](int i) const { return theAttributes[i]; }
180
181- ulong size () const { return (ulong)theAttributes.size (); }
182+ csize size() const { return theAttributes.size(); }
183
184 void accept(parsenode_visitor&) const;
185 };
186@@ -4388,6 +4388,7 @@
187
188 public:
189 rchandle<QName> get_name() const { return theName; }
190+
191 rchandle<DirAttributeValue> get_value() const { return theValue; }
192
193 public:
194
195=== modified file 'src/compiler/rewriter/rules/fold_rules.cpp'
196--- src/compiler/rewriter/rules/fold_rules.cpp 2012-11-12 17:12:41 +0000
197+++ src/compiler/rewriter/rules/fold_rules.cpp 2013-01-08 11:10:56 +0000
198@@ -894,7 +894,7 @@
199 *tm->create_named_type(val->getType(),
200 TypeConstants::QUANT_ONE,
201 fo.get_loc(),
202- err::XPTY0004),
203+ true),
204 *rtm.INTEGER_TYPE_ONE,
205 fo.get_loc()))
206 {
207
208=== modified file 'src/compiler/translator/prolog_graph.cpp'
209--- src/compiler/translator/prolog_graph.cpp 2012-09-19 21:16:15 +0000
210+++ src/compiler/translator/prolog_graph.cpp 2013-01-08 11:10:56 +0000
211@@ -55,7 +55,7 @@
212 zstring varName = '$' + v1.getVarExpr()->get_name()->getStringValue();
213
214 RAISE_ERROR(err::XPST0008, v2.getVarExpr()->get_loc(),
215- ERROR_PARAMS(varName, ZED(VariabledUndeclared)));
216+ ERROR_PARAMS(ZED(XPST0008_VariableName_2), varName));
217 }
218
219 addEdge(theGraph, v1, v2);
220
221=== modified file 'src/compiler/translator/translator.cpp'
222--- src/compiler/translator/translator.cpp 2012-12-28 10:24:59 +0000
223+++ src/compiler/translator/translator.cpp 2013-01-08 11:10:56 +0000
224@@ -1149,27 +1149,7 @@
225 {
226 assert(sctx != NULL);
227
228- switch (e->get_kind())
229- {
230- case var_expr::let_var:
231- {
232- sctx->bind_var(e, e->get_loc(), err::XQST0039);
233- break;
234- }
235- case var_expr::win_var:
236- case var_expr::wincond_out_var:
237- case var_expr::wincond_out_pos_var:
238- case var_expr::wincond_in_var:
239- case var_expr::wincond_in_pos_var:
240- {
241- sctx->bind_var(e, e->get_loc(), err::XQST0103);
242- break;
243- }
244- default:
245- {
246- sctx->bind_var(e, e->get_loc(), err::XQST0049);
247- }
248- }
249+ sctx->bind_var(e, e->get_loc());
250 }
251
252
253@@ -1221,26 +1201,27 @@
254 ********************************************************************************/
255 var_expr* lookup_ctx_var(const QName* qname, const QueryLoc& loc)
256 {
257- if (theIsInIndexDomain)
258- {
259- try
260- {
261- return lookup_var(qname, loc, err::XPDY0002);
262- }
263- catch (ZorbaException const& e)
264- {
265- if (e.diagnostic() == err::XPDY0002)
266- {
267- RAISE_ERROR(zerr::ZDST0032_INDEX_REFERENCES_CTX_ITEM, loc,
268- ERROR_PARAMS(theIndexDecl->getName()->getStringValue()));
269- }
270- throw;
271- }
272- }
273- else
274- {
275- return lookup_var(qname, loc, err::XPDY0002);
276- }
277+ store::Item_t qnameItem;
278+ expand_no_default_qname(qnameItem, qname, loc);
279+
280+ VarInfo* var = theSctx->lookup_var(qnameItem.getp());
281+
282+ if (var == NULL)
283+ {
284+ if (theIsInIndexDomain)
285+ {
286+ RAISE_ERROR(zerr::ZDST0032_INDEX_REFERENCES_CTX_ITEM, loc,
287+ ERROR_PARAMS(theIndexDecl->getName()->getStringValue()));
288+ }
289+ else
290+ {
291+ zstring varName = static_context::var_name(qnameItem);
292+ RAISE_ERROR(err::XPDY0002, loc,
293+ ERROR_PARAMS(ZED(XPDY0002_ContextUndeclared_2), varName));
294+ }
295+ }
296+
297+ return var->getVar();
298 }
299
300
301@@ -1252,10 +1233,10 @@
302 If the lexical qname has a prefix for which no namespace binding exists, the
303 method raises error.
304
305- If var is not found, the method raises the given error, unless the given error
306- is zerr::ZXQP0000_NO_ERROR, in which case it returns NULL.
307+ If var is not found, the method raises XPST0008, unless the raiseError param
308+ is alse, in which case it returns NULL.
309 ********************************************************************************/
310-var_expr* lookup_var(const QName* qname, const QueryLoc& loc, const Error& err)
311+var_expr* lookup_var(const QName* qname, const QueryLoc& loc, bool raiseError)
312 {
313 store::Item_t qnameItem;
314 expand_no_default_qname(qnameItem, qname, loc);
315@@ -1264,12 +1245,11 @@
316
317 if (!var)
318 {
319- if (err != zerr::ZXQP0000_NO_ERROR)
320+ if (raiseError)
321 {
322 zstring varName = static_context::var_name(qnameItem);
323- throw XQUERY_EXCEPTION_VAR(err,
324- ERROR_PARAMS(varName, ZED(VariabledUndeclared)),
325- ERROR_LOC(loc));
326+ RAISE_ERROR(err::XPST0008, loc,
327+ ERROR_PARAMS(ZED(XPST0008_VariableName_2), varName));
328 }
329
330 return NULL;
331@@ -1284,21 +1264,20 @@
332 moves upwards the ancestor path until the first instance (if any) of the var
333 is found.
334
335- If var is not found, the method raises the given error, unless the given error
336- is MAX_ZORBA_ERROR_CODE, in which case it returns NULL.
337+ If var is not found, the method raises XPST0008, unless the raiseError param
338+ is alse, in which case it returns NULL.
339 ********************************************************************************/
340-var_expr* lookup_var(const store::Item* qname, const QueryLoc& loc, const Error& err)
341+var_expr* lookup_var(const store::Item* qname, const QueryLoc& loc, bool raiseError)
342 {
343 VarInfo* var = theSctx->lookup_var(qname);
344
345 if (!var)
346 {
347- if (err != zerr::ZXQP0000_NO_ERROR)
348+ if (raiseError)
349 {
350 zstring varName = static_context::var_name(qname);
351- throw XQUERY_EXCEPTION_VAR(err,
352- ERROR_PARAMS(varName, ZED(VariabledUndeclared)),
353- ERROR_LOC(loc));
354+ RAISE_ERROR(err::XPST0008, loc,
355+ ERROR_PARAMS(ZED(XPST0008_VariableName_2), varName));
356 }
357
358 return NULL;
359@@ -1909,10 +1888,10 @@
360 {
361 VarInDecl* varDecl = varDecls[j];
362
363- vars.insert(lookup_var(varDecl->get_var_name(), loc, err::XPST0008));
364+ vars.insert(lookup_var(varDecl->get_var_name(), loc, true));
365
366 if (varDecl->get_posvar() != NULL)
367- vars.insert(lookup_var(varDecl->get_posvar()->get_name(), loc, err::XPST0008));
368+ vars.insert(lookup_var(varDecl->get_posvar()->get_name(), loc, true));
369 }
370 }
371 else if (typeid(c) == typeid(LetClause))
372@@ -1922,13 +1901,13 @@
373
374 for (int j = (int)lV.size() - 1; j >= 0; --j)
375 {
376- vars.insert(lookup_var(lV[j]->get_var_name(), loc, err::XPST0008));
377+ vars.insert(lookup_var(lV[j]->get_var_name(), loc, true));
378 }
379 }
380 else if (typeid(c) == typeid(WindowClause))
381 {
382 const WindowClause& wc = *static_cast<const WindowClause *>(&c);
383- vars.insert(lookup_var(wc.get_var()->get_var_name(), loc, err::XPST0008));
384+ vars.insert(lookup_var(wc.get_var()->get_var_name(), loc, true));
385 for (int j = 1; j >= 0; j--)
386 {
387 const FLWORWinCond* cond = &*wc[j];
388@@ -1938,13 +1917,13 @@
389 if (wv != NULL)
390 {
391 if (wv->get_next())
392- vars.insert(lookup_var(wv->get_next(), loc, err::XPST0008));
393+ vars.insert(lookup_var(wv->get_next(), loc, true));
394 if (wv->get_prev())
395- vars.insert(lookup_var(wv->get_prev(), loc, err::XPST0008));
396+ vars.insert(lookup_var(wv->get_prev(), loc, true));
397 if (wv->get_curr())
398- vars.insert(lookup_var(wv->get_curr(), loc, err::XPST0008));
399+ vars.insert(lookup_var(wv->get_curr(), loc, true));
400 if (wv->get_posvar() != NULL)
401- vars.insert(lookup_var(wv->get_posvar()->get_name(), loc, err::XPST0008));
402+ vars.insert(lookup_var(wv->get_posvar()->get_name(), loc, true));
403 }
404 }
405 }
406@@ -1953,7 +1932,7 @@
407 {
408 vars.insert(lookup_var(static_cast<const CountClause*>(&c)->get_varname(),
409 loc,
410- err::XPST0008));
411+ true));
412 }
413 else if (typeid(c) == typeid(OrderByClause))
414 {
415@@ -1968,7 +1947,7 @@
416 {
417 GroupSpec* groupSpec = (*(groupClause.get_spec_list()))[gSpecPos];
418 if (groupSpec->get_binding_expr() != NULL)
419- vars.insert(lookup_var(groupSpec->get_var_name(), loc, err::XPST0008));
420+ vars.insert(lookup_var(groupSpec->get_var_name(), loc, true));
421 }
422
423 // Group-by redefines ALL previous variables, but the GroupByClause lists
424@@ -2169,7 +2148,7 @@
425 theSctx->set_default_elem_type_ns(targetNS, true, loc);
426
427 if (! pfx.empty())
428- theSctx->bind_ns(pfx, targetNS, loc, err::XQST0033);
429+ theSctx->bind_ns(pfx, targetNS, loc);
430 }
431
432 zstring xsdTNS = zstring(XML_SCHEMA_NS);
433@@ -3005,7 +2984,7 @@
434 ! (pfx == theModulePrefix &&
435 targetNS == theModuleNamespace))
436 {
437- theSctx->bind_ns(pfx, targetNS, loc, err::XQST0033);
438+ theSctx->bind_ns(pfx, targetNS, loc);
439 }
440
441 const URILiteralList* atlist = v.get_at_list();
442@@ -3988,7 +3967,7 @@
443
444 if (theSctx->xquery_version() >= StaticContextConsts::xquery_version_3_0)
445 {
446- ve = lookup_var(qnameItem, loc, err::XPST0008);
447+ ve = lookup_var(qnameItem, loc, true);
448
449 assert(ve);
450 }
451@@ -5003,16 +4982,10 @@
452 flwor_expr* evFlworExpr = theExprManager->
453 create_flwor_expr(theRootSctx, theUDF, loc, false);
454
455- evFlworExpr->set_return_expr(theExprManager->create_const_expr(theRootSctx,
456- theUDF,
457- loc,
458- true));
459+ evFlworExpr->set_return_expr(CREATE(const)(theRootSctx, theUDF, loc, true));
460
461 // $x_ in dc:collection( xs:QName("org:employees") )
462- var_expr* evVarExpr = bind_var(loc,
463- varItem,
464- var_expr::for_var,
465- NULL);
466+ var_expr* evVarExpr = bind_var(loc, varItem, var_expr::for_var, NULL);
467
468 // maybe make one more collExpr?
469 evFlworExpr->add_clause(wrap_in_forclause(collExpr, evVarExpr, NULL));
470@@ -5941,7 +5914,7 @@
471 {
472 TRACE_VISIT_OUT();
473
474- var_expr* ve = lookup_var(v.get_name(), loc, err::XPST0008);
475+ var_expr* ve = lookup_var(v.get_name(), loc, true);
476
477 if ((ve->get_kind() != var_expr::local_var &&
478 ve->get_kind() != var_expr::prolog_var) ||
479@@ -6862,11 +6835,11 @@
480
481 if (spec->get_binding_expr() == NULL)
482 {
483- ve = lookup_var(varname, loc, err::XPST0008);
484+ ve = lookup_var(varname, loc, true);
485 }
486 else
487 {
488- ve = lookup_var(varname, loc, zerr::ZXQP0000_NO_ERROR);
489+ ve = lookup_var(varname, loc, false);
490 }
491
492 if (ve != NULL)
493@@ -6947,16 +6920,14 @@
494 if (!var)
495 {
496 RAISE_ERROR(err::XPST0008, specLoc,
497- ERROR_PARAMS(varName->getStringValue(), ZED(VariabledUndeclared)));
498+ ERROR_PARAMS(ZED(XPST0008_VariableName_2), varName->getStringValue()));
499 }
500
501 expr* inputExpr = var->getVar();
502
503- if (inputExpr->get_expr_kind() == var_expr_kind)
504- {
505- inputExpr = theExprManager->
506- create_wrapper_expr(theRootSctx, theUDF, specLoc, inputExpr);
507- }
508+ assert(inputExpr->get_expr_kind() == var_expr_kind);
509+
510+ inputExpr = CREATE(wrapper)(theRootSctx, theUDF, specLoc, inputExpr);
511
512 inputExpr = wrap_in_atomization(inputExpr);
513
514@@ -8633,7 +8604,8 @@
515 if (e.diagnostic() == err::FORG0001)
516 throw;// XQUERY_EXCEPTION(err::XPST0003, ERROR_LOC(loc));
517 else
518- RAISE_ERROR(err::XPST0081, loc, ERROR_PARAMS(result->getStringValue()));
519+ RAISE_ERROR(err::XPST0081, loc,
520+ ERROR_PARAMS(ce->get_val()->getStringValue()));
521 }
522 }
523
524@@ -9345,7 +9317,7 @@
525
526 if (stepExpr->get_expr_kind() == wrapper_expr_kind)
527 {
528- var_expr* dotVar = lookup_var(DOT_VARNAME, loc, zerr::ZXQP0000_NO_ERROR);
529+ var_expr* dotVar = lookup_var(DOT_VARNAME, loc, false);
530 if (static_cast<wrapper_expr*>(stepExpr)->get_input() == dotVar)
531 errKind = TREAT_PATH_DOT;
532 }
533@@ -10371,7 +10343,7 @@
534
535 try
536 {
537- ve = lookup_var(v.get_name(), loc, err::XPST0008);
538+ ve = lookup_var(v.get_name(), loc, true);
539 }
540 catch (const ZorbaException& e)
541 {
542@@ -10404,33 +10376,48 @@
543
544 xqtref_t declaredType = ve->get_type();
545
546- if (declaredType != NULL && !TypeOps::is_in_scope(tm, *declaredType))
547+ if (declaredType != NULL && !TypeOps::is_in_scope(tm, *declaredType) &&
548+ theSctx->xquery_version() == StaticContextConsts::xquery_version_1_0)
549 {
550- const Error& error = (declaredType->get_manager() == tm ?
551- err::XPTY0004 : err::XQST0036);
552-
553- if (theModuleNamespace.empty())
554+ if (declaredType->get_manager() == tm)
555 {
556- throw XQUERY_EXCEPTION_VAR(
557- error,
558- ERROR_PARAMS(ZED(BadType_23o),
559- *declaredType,
560- ZED( NoTypeInMainModule_4 ),
561- ve->get_name()->getStringValue()),
562- ERROR_LOC( loc )
563- );
564+ if (theModuleNamespace.empty())
565+ {
566+ RAISE_ERROR(err::XPTY0004, loc,
567+ ERROR_PARAMS(ZED(BadType_23o),
568+ *declaredType,
569+ ZED(NoTypeInMainModule_4),
570+ ve->get_name()->getStringValue()));
571+ }
572+ else
573+ {
574+ RAISE_ERROR(err::XPTY0004, loc,
575+ ERROR_PARAMS(ZED(BadType_23o),
576+ *declaredType,
577+ ZED(NoTypeInModule_45),
578+ ve->get_name()->getStringValue(),
579+ theModuleNamespace));
580+ }
581 }
582 else
583 {
584- throw XQUERY_EXCEPTION_VAR(
585- error,
586- ERROR_PARAMS(ZED(BadType_23o),
587- *declaredType,
588- ZED( NoTypeInModule_45 ),
589+ if (theModuleNamespace.empty())
590+ {
591+ RAISE_ERROR(err::XQST0036, loc,
592+ ERROR_PARAMS(ZED(BadType_23o),
593+ *declaredType,
594+ ZED(NoTypeInMainModule_4),
595+ ve->get_name()->getStringValue()));
596+ }
597+ else
598+ {
599+ RAISE_ERROR(err::XQST0036, loc,
600+ ERROR_PARAMS(ZED(BadType_23o),
601+ *declaredType,
602+ ZED(NoTypeInModule_45),
603 ve->get_name()->getStringValue(),
604- theModuleNamespace),
605- ERROR_LOC( loc )
606- );
607+ theModuleNamespace));
608+ }
609 }
610 }
611
612@@ -10578,7 +10565,8 @@
613
614 xqtref_t retType = sign.returnType();
615
616- if (!TypeOps::is_in_scope(tm, *retType))
617+ if (!TypeOps::is_in_scope(tm, *retType) &&
618+ theSctx->xquery_version() == StaticContextConsts::xquery_version_1_0)
619 {
620 if (theModuleNamespace.empty())
621 {
622@@ -10604,7 +10592,9 @@
623 for (csize i = 0; i < numParams; ++i)
624 {
625 xqtref_t type = sign[i];
626- if (!TypeOps::is_in_scope(tm, *type))
627+
628+ if (!TypeOps::is_in_scope(tm, *type) &&
629+ theSctx->xquery_version() == StaticContextConsts::xquery_version_1_0)
630 {
631 if (theModuleNamespace.empty())
632 {
633@@ -11186,7 +11176,7 @@
634 ztd::to_string(theTempVarCounter++);
635 GENV_ITEMFACTORY->createQName(qnameItem, "", "", localName.c_str());
636 }
637- while (lookup_var(qnameItem, loc, zerr::ZXQP0000_NO_ERROR) != NULL);
638+ while (lookup_var(qnameItem, loc, false) != NULL);
639
640 var_expr* var = create_var(loc, qnameItem, var_expr::let_var);
641 temp_vars.push_back(var);
642@@ -11976,7 +11966,7 @@
643
644
645 /*******************************************************************************
646- [120] DirAttributeList ::= DirAttr | DirAttributeList DirAttr
647+ [120] DirAttributeList ::= DirAttr | DirAttributeList DirAttr
648 ********************************************************************************/
649 void* begin_visit(const DirAttributeList& v)
650 {
651@@ -11998,7 +11988,7 @@
652 }
653 }
654
655- unsigned long numAttrs = 0;
656+ csize numAttrs = 0;
657 std::vector<attr_expr*> attributes;
658 while(true)
659 {
660@@ -12009,7 +11999,7 @@
661 attr_expr* attrExpr = dynamic_cast<attr_expr*>(expr);
662 const store::Item* attExprName = attrExpr->getQName();
663
664- for (unsigned long i = 0; i < numAttrs; ++i)
665+ for (csize i = 0; i < numAttrs; ++i)
666 {
667 const store::Item* attName = attributes[i]->getQName();
668 if (attName->equals(attExprName))
669@@ -12034,8 +12024,8 @@
670 args.push_back((*it));
671 }
672
673- fo_expr* expr_list =
674- theExprManager->create_fo_expr(theRootSctx, theUDF, loc, op_concatenate, args);
675+ fo_expr* expr_list =
676+ CREATE(fo)(theRootSctx, theUDF, loc, op_concatenate, args);
677
678 normalize_fo(expr_list);
679
680@@ -12045,6 +12035,7 @@
681 return NULL; // reject visitor -- everything done
682 }
683
684+
685 void end_visit(const DirAttributeList& v, void* /*visit_state*/)
686 {
687 // begin_visit() rejects visitor
688@@ -12089,15 +12080,13 @@
689 prefix = qname->get_localname();
690
691 if (ZSTREQ(prefix, "xmlns"))
692- throw XQUERY_EXCEPTION(
693- err::XQST0070,
694- ERROR_PARAMS( prefix, ZED( NoRebindPrefix ) ),
695- ERROR_LOC( loc )
696- );
697+ RAISE_ERROR(err::XQST0070, loc,
698+ ERROR_PARAMS(prefix, ZED(NoRebindPrefix)));
699 }
700
701 const_expr* constValueExpr = dynamic_cast<const_expr*>(valueExpr);
702 fo_expr* foExpr = dynamic_cast<fo_expr*>(valueExpr);
703+
704 if (foExpr != NULL && foExpr->get_func() != op_concatenate)
705 foExpr = NULL;
706
707@@ -12108,7 +12097,7 @@
708 }
709 else if (foExpr != NULL)
710 {
711- for (unsigned int i=0; i<foExpr->num_args(); i++)
712+ for (csize i = 0; i < foExpr->num_args(); ++i)
713 {
714 const_expr* constValueExpr = dynamic_cast<const_expr*>(foExpr->get_arg(i));
715 if (constValueExpr != NULL)
716@@ -12143,7 +12132,7 @@
717 RAISE_ERROR(err::XQST0070, loc, ERROR_PARAMS(uri, ZED(NoBindURI)));
718 }
719
720- theSctx->bind_ns(prefix, uri, loc, err::XQST0071);
721+ theSctx->bind_ns(prefix, uri, loc);
722 theNSCtx->bind_ns(prefix, uri);
723
724 if (prefix.empty())
725@@ -12159,7 +12148,7 @@
726
727 // unbind the prefix
728 zstring empty;
729- theSctx->bind_ns(prefix, empty, loc, err::XQST0071);
730+ theSctx->bind_ns(prefix, empty, loc);
731 theNSCtx->bind_ns(prefix, empty);
732
733 if (prefix.empty())
734@@ -12170,13 +12159,13 @@
735 throw XQUERY_EXCEPTION(err::XQST0022, ERROR_LOC(loc));
736 }
737 }
738- else
739 // Plain direct attribute
740+ else
741 {
742 store::Item_t qnameItem;
743 expand_no_default_qname(qnameItem, qname, qname->get_location());
744
745- expr* nameExpr = theExprManager->create_const_expr(theRootSctx, theUDF, loc, qnameItem);
746+ expr* nameExpr = CREATE(const)(theRootSctx, theUDF, loc, qnameItem);
747
748 fo_expr* foExpr = NULL;
749 if ((foExpr = dynamic_cast<fo_expr*>(valueExpr)) != NULL &&
750@@ -12904,7 +12893,8 @@
751
752 xqtref_t t = CTX_TM->create_named_atomic_type(qnameItem,
753 TypeConstants::QUANT_ONE,
754- loc);
755+ loc,
756+ false);
757
758 // some types that should never be parsed, like xs:untyped, are;
759 // we catch them with is_simple()
760@@ -13269,11 +13259,8 @@
761
762 if (contentType == NULL)
763 {
764- throw XQUERY_EXCEPTION(
765- err::XPST0008,
766- ERROR_PARAMS( typeNameItem->getStringValue(), ZED( AttributeName ) ),
767- ERROR_LOC( loc )
768- );
769+ RAISE_ERROR(err::XPST0008, loc,
770+ ERROR_PARAMS(typeNameItem->getStringValue(), ZED(AttributeName)));
771 }
772 }
773
774
775=== modified file 'src/context/dynamic_context.cpp'
776--- src/context/dynamic_context.cpp 2012-12-11 00:22:26 +0000
777+++ src/context/dynamic_context.cpp 2013-01-08 11:10:56 +0000
778@@ -462,7 +462,7 @@
779 theVarValues[varid].theState == VarValue::undeclared)
780 {
781 RAISE_ERROR(err::XPDY0002, loc,
782- ERROR_PARAMS(varname->getStringValue(), ZED(VariabledUndeclared)));
783+ ERROR_PARAMS(ZED(XPDY0002_VariableUndeclared_2), varname->getStringValue()));
784 }
785
786 valueIter->open();
787@@ -516,7 +516,7 @@
788 theVarValues[varid].theState == VarValue::undeclared)
789 {
790 RAISE_ERROR(err::XPDY0002, loc,
791- ERROR_PARAMS(varname->getStringValue(), ZED(VariabledUndeclared)));
792+ ERROR_PARAMS(ZED(XPDY0002_VariableUndeclared_2), varname->getStringValue()));
793 }
794
795 VarValue& var = theVarValues[varid];
796@@ -559,7 +559,7 @@
797 theVarValues[varid].theState == VarValue::undeclared)
798 {
799 RAISE_ERROR(err::XPDY0002, loc,
800- ERROR_PARAMS(varname->getStringValue(), ZED(VariabledUndeclared)));
801+ ERROR_PARAMS(ZED(XPDY0002_VariableUndeclared_2), varname->getStringValue()));
802 }
803
804 VarValue& var = theVarValues[varid];
805@@ -606,14 +606,14 @@
806 {
807 zstring varName = static_context::var_name(varname.getp());
808 RAISE_ERROR(err::XPDY0002, loc,
809- ERROR_PARAMS(varName, ZED(VariabledUndeclared)));
810+ ERROR_PARAMS(ZED(XPDY0002_VariableUndeclared_2), varName));
811 }
812
813 if (theVarValues[varid].theState == VarValue::declared)
814 {
815 zstring varName = static_context::var_name(varname.getp());
816 RAISE_ERROR(err::XPDY0002, loc,
817- ERROR_PARAMS(varName, ZED(VariabledHasNoValue)));
818+ ERROR_PARAMS(ZED(XPDY0002_VariableHasNoValue_2), varName));
819 }
820
821 const VarValue& var = theVarValues[varid];
822
823=== modified file 'src/context/namespace_context.cpp'
824--- src/context/namespace_context.cpp 2012-12-28 10:24:59 +0000
825+++ src/context/namespace_context.cpp 2013-01-08 11:10:56 +0000
826@@ -101,7 +101,7 @@
827 else
828 {
829 QueryLoc loc;
830- bool found = m_sctx->lookup_ns(aNamespace, aPrefix, loc, zerr::ZXQP0000_NO_ERROR);
831+ bool found = m_sctx->lookup_ns(aNamespace, aPrefix, loc, false);
832
833 if (!found && aPrefix.empty())
834 {
835
836=== modified file 'src/context/root_static_context.cpp'
837--- src/context/root_static_context.cpp 2012-12-12 19:34:45 +0000
838+++ src/context/root_static_context.cpp 2013-01-08 11:10:56 +0000
839@@ -33,7 +33,7 @@
840
841 #ifdef WIN32
842 #include <zorba/config.h>
843-#endif WIN32
844+#endif //WIN32
845
846
847 // DEFINE ENVIRONMENT VARIABLES
848
849=== modified file 'src/context/static_context.cpp'
850--- src/context/static_context.cpp 2012-12-11 20:27:40 +0000
851+++ src/context/static_context.cpp 2013-01-08 11:10:56 +0000
852@@ -2045,8 +2045,7 @@
853 void static_context::bind_ns(
854 const zstring& prefix,
855 const zstring& ns,
856- const QueryLoc& loc,
857- const Error& err)
858+ const QueryLoc& loc)
859 {
860 if (theNamespaceBindings == NULL)
861 {
862@@ -2057,9 +2056,7 @@
863
864 if (!theNamespaceBindings->insert(prefix, temp))
865 {
866- throw XQUERY_EXCEPTION_VAR(err,
867- ERROR_PARAMS(prefix, temp),
868- ERROR_LOC(loc));
869+ RAISE_ERROR(err::XQST0033, loc, ERROR_PARAMS(prefix, ns));
870 }
871 }
872
873@@ -2075,19 +2072,17 @@
874 zstring& ns,
875 const zstring& prefix,
876 const QueryLoc& loc,
877- const Error& err) const
878+ bool raiseError) const
879 {
880 if (theNamespaceBindings == NULL || !theNamespaceBindings->get(prefix, ns))
881 {
882 if (theParent != NULL)
883 {
884- return theParent->lookup_ns(ns, prefix, loc, err);
885+ return theParent->lookup_ns(ns, prefix, loc, raiseError);
886 }
887- else if (err != zerr::ZXQP0000_NO_ERROR)
888+ else if (raiseError)
889 {
890- throw XQUERY_EXCEPTION_VAR(
891- err, ERROR_PARAMS( prefix ), ERROR_LOC( loc )
892- );
893+ RAISE_ERROR(err::XPST0081, loc, ERROR_PARAMS(prefix));
894 }
895 else
896 {
897@@ -2096,11 +2091,9 @@
898 }
899 else if (!prefix.empty() && ns.empty())
900 {
901- if (err != zerr::ZXQP0000_NO_ERROR)
902+ if (raiseError)
903 {
904- throw XQUERY_EXCEPTION_VAR(
905- err, ERROR_PARAMS( prefix ), ERROR_LOC( loc )
906- );
907+ RAISE_ERROR(err::XPST0081, loc, ERROR_PARAMS(prefix));
908 }
909 else
910 {
911@@ -2188,10 +2181,7 @@
912 /***************************************************************************//**
913
914 ********************************************************************************/
915-void static_context::bind_var(
916- var_expr* varExpr,
917- const QueryLoc& loc,
918- const Error& err)
919+void static_context::bind_var(var_expr* varExpr, const QueryLoc& loc)
920 {
921 if (theVariablesMap == NULL)
922 {
923@@ -2208,8 +2198,7 @@
924
925 if (!theVariablesMap->insert(qname, vi))
926 {
927- throw XQUERY_EXCEPTION_VAR(err,
928- ERROR_PARAMS(qname->getStringValue()), ERROR_LOC(loc));
929+ goto error;
930 }
931
932 if (varExpr->get_kind() == var_expr::prolog_var)
933@@ -2219,10 +2208,32 @@
934 {
935 if (!theVariablesMap->insert(qname, vi))
936 {
937- throw XQUERY_EXCEPTION_VAR(err,
938- ERROR_PARAMS(qname->getStringValue()), ERROR_LOC(loc));
939+ goto error;
940 }
941 }
942+
943+ return;
944+
945+ error:
946+ switch (varExpr->get_kind())
947+ {
948+ case var_expr::let_var:
949+ {
950+ RAISE_ERROR(err::XQST0039, loc, ERROR_PARAMS(qname->getStringValue()));
951+ }
952+ case var_expr::win_var:
953+ case var_expr::wincond_out_var:
954+ case var_expr::wincond_out_pos_var:
955+ case var_expr::wincond_in_var:
956+ case var_expr::wincond_in_pos_var:
957+ {
958+ RAISE_ERROR(err::XQST0103, loc, ERROR_PARAMS(qname->getStringValue()));
959+ }
960+ default:
961+ {
962+ RAISE_ERROR(err::XQST0049, loc, ERROR_PARAMS(qname->getStringValue()));
963+ }
964+ }
965 }
966
967
968@@ -4085,7 +4096,7 @@
969
970 if (!ve->is_private())
971 {
972- bind_var(ve, loc, err::XQST0049);
973+ bind_var(ve, loc);
974 }
975 else
976 {
977
978=== modified file 'src/context/static_context.h'
979--- src/context/static_context.h 2012-12-06 01:17:18 +0000
980+++ src/context/static_context.h 2013-01-08 11:10:56 +0000
981@@ -853,14 +853,13 @@
982 void bind_ns(
983 const zstring& prefix,
984 const zstring& ns,
985- const QueryLoc& loc,
986- const Error& err = err::XQST0033);
987+ const QueryLoc& loc);
988
989 bool lookup_ns(
990 zstring& ns,
991 const zstring& prefix,
992 const QueryLoc& loc,
993- const Error& err = err::XPST0081) const;
994+ bool raiseError = true) const;
995
996 void expand_qname(
997 store::Item_t& qname,
998@@ -874,7 +873,7 @@
999 //
1000 // Variables
1001 //
1002- void bind_var(var_expr* expr, const QueryLoc& loc, const Error& err);
1003+ void bind_var(var_expr* expr, const QueryLoc& loc);
1004
1005 VarInfo* lookup_var(const store::Item* qname) const;
1006
1007
1008=== modified file 'src/diagnostics/diagnostic_en.xml'
1009--- src/diagnostics/diagnostic_en.xml 2012-12-29 06:48:09 +0000
1010+++ src/diagnostics/diagnostic_en.xml 2013-01-08 11:10:56 +0000
1011@@ -136,7 +136,19 @@
1012 that is not defined in the static context, except for an ElementName in
1013 an ElementTest or an AttributeName in an AttributeTest.
1014 </comment>
1015- <value>"$1": undefined $2</value>
1016+ <value>$1</value>
1017+
1018+ <entry key="VariableName_2">
1019+ <value>"$2": undeclared variable</value>
1020+ </entry>
1021+
1022+ <entry key="SchemaAttributeName_2">
1023+ <value>"$2": undefined schema-attribute name</value>
1024+ </entry>
1025+
1026+ <entry key="SchemaElementName_2">
1027+ <value>"$2": undefined schema-element name</value>
1028+ </entry>
1029 </diagnostic>
1030
1031 <diagnostic code="XPST0017">
1032@@ -714,7 +726,19 @@
1033 It is a dynamic error if evaluation of an expression relies on some part
1034 of the dynamic context that has not been assigned a value.
1035 </comment>
1036- <value>"$1": $2</value>
1037+ <value>$1</value>
1038+
1039+ <entry key="VariableHasNoValue_2">
1040+ <value>"$2": variable has no value</value>
1041+ </entry>
1042+
1043+ <entry key="VariableUndeclared_2">
1044+ <value>"$2": undeclared variable</value>
1045+ </entry>
1046+
1047+ <entry key="ContextUndeclared_2">
1048+ <value>$2 not declared</value>
1049+ </entry>
1050 </diagnostic>
1051
1052 <diagnostic code="XPDY0050">
1053@@ -1522,7 +1546,7 @@
1054 affects an element node by introducing a new namespace binding that
1055 conflicts with one of its existing namespace bindings.
1056 </comment>
1057- <value>"$1": namespace binding conflicts with $2=$3</value>
1058+ <value>"$1": qname causes namespace binding conflict: prefix $2 cannot be bound to both $3 and $4</value>
1059 </diagnostic>
1060
1061 <diagnostic code="XUDY0024">
1062@@ -1972,8 +1996,8 @@
1063 <value>XQuery not compiled in debug mode</value>
1064 </diagnostic>
1065
1066- <diagnostic code="ZAPI0011" name="ELEMENT_NOT_DECLARED">
1067- <value>"$1": undefined $2</value>
1068+ <diagnostic code="ZAPI0011" name="VARIABLE_NOT_DECLARED">
1069+ <value>"$1": undeclared variable</value>
1070 </diagnostic>
1071
1072 <diagnostic code="ZAPI0014" name="INVALID_ARGUMENT">
1073@@ -3545,14 +3569,6 @@
1074 <value>the standalone attribute has a value other than "omit"</value>
1075 </entry>
1076
1077- <entry key="SchemaAttributeName">
1078- <value>schema-attribute name</value>
1079- </entry>
1080-
1081- <entry key="SchemaElementName">
1082- <value>schema-element name</value>
1083- </entry>
1084-
1085 <entry key="SchemaOutOfMemory">
1086 <value>OutOfMemoryException during parsing</value>
1087 </entry>
1088@@ -3802,18 +3818,6 @@
1089 <value>"$2": variable value must be single item</value>
1090 </entry>
1091
1092- <entry key="Variable">
1093- <value>variable</value>
1094- </entry>
1095-
1096- <entry key="VariabledHasNoValue">
1097- <value>variable has no value</value>
1098- </entry>
1099-
1100- <entry key="VariabledUndeclared">
1101- <value>undeclared variable</value>
1102- </entry>
1103-
1104 <entry key="XMLSchema">
1105 <value>XML schema</value>
1106 </entry>
1107
1108=== modified file 'src/diagnostics/pregenerated/diagnostic_list.cpp'
1109--- src/diagnostics/pregenerated/diagnostic_list.cpp 2012-12-21 22:05:39 +0000
1110+++ src/diagnostics/pregenerated/diagnostic_list.cpp 2013-01-08 11:10:56 +0000
1111@@ -717,7 +717,7 @@
1112 ZorbaErrorCode ZAPI0009_XQUERY_NOT_COMPILED_IN_DEBUG_MODE( "ZAPI0009" );
1113
1114
1115-ZorbaErrorCode ZAPI0011_ELEMENT_NOT_DECLARED( "ZAPI0011" );
1116+ZorbaErrorCode ZAPI0011_VARIABLE_NOT_DECLARED( "ZAPI0011" );
1117
1118
1119 ZorbaErrorCode ZAPI0014_INVALID_ARGUMENT( "ZAPI0014" );
1120
1121=== modified file 'src/diagnostics/pregenerated/dict_en.cpp'
1122--- src/diagnostics/pregenerated/dict_en.cpp 2012-12-29 06:48:09 +0000
1123+++ src/diagnostics/pregenerated/dict_en.cpp 2013-01-08 11:10:56 +0000
1124@@ -178,12 +178,12 @@
1125 { "SESU0007", "\"$1\": unsupported encoding" },
1126 { "SESU0011", "\"$1\": unsupported normalization form" },
1127 { "SESU0013", "\"$1\": unsupported $2 version; supported versions are: $3" },
1128- { "XPDY0002", "\"$1\": $2" },
1129+ { "XPDY0002", "$1" },
1130 { "XPDY0050", "\"$1\" cannot be treated as type $2" },
1131 { "XPST0001", "${\"1\": }undefined value${: 2}" },
1132 { "XPST0003", "invalid expression${: 1}" },
1133 { "XPST0005", "static type must not be empty-sequence()" },
1134- { "XPST0008", "\"$1\": undefined $2" },
1135+ { "XPST0008", "$1" },
1136 { "XPST0017", "\"$1\": $2" },
1137 { "XPST0051", "\"$1\": not defined as atomic type${: 2}" },
1138 { "XPST0080", "\"$1\": invalid type for \"cast\" or \"castable\" exression" },
1139@@ -276,7 +276,7 @@
1140 { "XUDY0018", "\"$1\": function declared external, non-updating returns non-empty pending update list" },
1141 { "XUDY0019", "\"$1\": function declated external, updating returns non-empty data model instance" },
1142 { "XUDY0021", "$1${ 2}" },
1143- { "XUDY0023", "\"$1\": namespace binding conflicts with $2=$3" },
1144+ { "XUDY0023", "\"$1\": qname causes namespace binding conflict: prefix $2 cannot be bound to both $3 and $4" },
1145 { "XUDY0024", "\"$1\": namespace binding conflicts with $2=$3" },
1146 { "XUDY0027", "target expression is empty sequence" },
1147 { "XUDY0029", "node has no parent in \"insert\" expression (with \"before\" or \"after\")" },
1148@@ -304,7 +304,7 @@
1149 { "ZAPI0007", "cannot serialize pul" },
1150 { "ZAPI0008", "can not execute a non-updating XQuery" },
1151 { "ZAPI0009", "XQuery not compiled in debug mode" },
1152- { "ZAPI0011", "\"$1\": undefined $2" },
1153+ { "ZAPI0011", "\"$1\": undeclared variable" },
1154 { "ZAPI0014", "\"$1\": invalid argument${: 2}" },
1155 { "ZAPI0015", "\"$1\": createModule() function not found${: 2}" },
1156 { "ZAPI0019", "\"$1\": external module already registered" },
1157@@ -784,8 +784,6 @@
1158 #endif
1159 { "~SEPM0009_Not10", "the version parameter has a value other than \"1.0\" and the doctype-system parameter is specified" },
1160 { "~SEPM0009_NotOmit", "the standalone attribute has a value other than \"omit\"" },
1161- { "~SchemaAttributeName", "schema-attribute name" },
1162- { "~SchemaElementName", "schema-element name" },
1163 { "~SchemaOutOfMemory", "OutOfMemoryException during parsing" },
1164 { "~SchemaParseError", "error during parsing" },
1165 { "~SchemaUnexpected", "unexpected exception during parsing" },
1166@@ -871,10 +869,10 @@
1167 #endif
1168 { "~UnexpectedElement", "unexpected element" },
1169 { "~VarValMustBeSingleItem_2", "\"$2\": variable value must be single item" },
1170- { "~Variable", "variable" },
1171- { "~VariabledHasNoValue", "variable has no value" },
1172- { "~VariabledUndeclared", "undeclared variable" },
1173 { "~XMLSchema", "XML schema" },
1174+ { "~XPDY0002_ContextUndeclared_2", "$2 not declared" },
1175+ { "~XPDY0002_VariableHasNoValue_2", "\"$2\": variable has no value" },
1176+ { "~XPDY0002_VariableUndeclared_2", "\"$2\": undeclared variable" },
1177 { "~XPST0003_Annotations", "function and variable annotations only available in XQuery 3.0 or later" },
1178 { "~XPST0003_CountClause30", "\"count\" clause only available in XQuery 3.0 or later" },
1179 { "~XPST0003_ModuleDeclNotInMain", "module declaration must not be in main module" },
1180@@ -886,6 +884,9 @@
1181 { "~XPST0003_TryCatchExpr30", "\"try/catch\" expressions only available in XQuery 3.0 or later" },
1182 { "~XPST0003_WindowClause30", "\"window\" clause only available in XQuery 3.0 or later" },
1183 { "~XPST0003_XQueryVersionAtLeast30_2", "\"$2\": XQuery version must be at least 3.0" },
1184+ { "~XPST0008_SchemaAttributeName_2", "\"$2\": undefined schema-attribute name" },
1185+ { "~XPST0008_SchemaElementName_2", "\"$2\": undefined schema-element name" },
1186+ { "~XPST0008_VariableName_2", "\"$2\": undeclared variable" },
1187 { "~XPTY0004_FormatNumber_2", "first parameter to format-number() function is type $2 that is not allowed" },
1188 { "~XPTY0004_JSONIQ_SELECTOR", "can not atomize and/or cast value of type $2 to string" },
1189 { "~XPTY0004_MultiValuedGroupingKey", "atomization of grouping variable produces more than one item" },
1190
1191=== modified file 'src/diagnostics/pregenerated/dict_zed_keys.h'
1192--- src/diagnostics/pregenerated/dict_zed_keys.h 2012-12-29 06:48:09 +0000
1193+++ src/diagnostics/pregenerated/dict_zed_keys.h 2013-01-08 11:10:56 +0000
1194@@ -33,6 +33,9 @@
1195 #define ZED_XPST0003_Annotations "~XPST0003_Annotations"
1196 #define ZED_XPST0003_Scripting "~XPST0003_Scripting"
1197 #define ZED_XPST0003_PiTarget "~XPST0003_PiTarget"
1198+#define ZED_XPST0008_VariableName_2 "~XPST0008_VariableName_2"
1199+#define ZED_XPST0008_SchemaAttributeName_2 "~XPST0008_SchemaAttributeName_2"
1200+#define ZED_XPST0008_SchemaElementName_2 "~XPST0008_SchemaElementName_2"
1201 #define ZED_XPTY0004_NoReturnTypePromote_234 "~XPTY0004_NoReturnTypePromote_234"
1202 #define ZED_XPTY0004_NoParamTypePromote_234 "~XPTY0004_NoParamTypePromote_234"
1203 #define ZED_XPTY0004_NoTypePromote_23 "~XPTY0004_NoTypePromote_23"
1204@@ -45,6 +48,9 @@
1205 #define ZED_XPTY0117_NotationParam_23 "~XPTY0117_NotationParam_23"
1206 #define ZED_XQST0106_THE_SAME "~XQST0106_THE_SAME"
1207 #define ZED_XQST0106_CONFLICTING "~XQST0106_CONFLICTING"
1208+#define ZED_XPDY0002_VariableHasNoValue_2 "~XPDY0002_VariableHasNoValue_2"
1209+#define ZED_XPDY0002_VariableUndeclared_2 "~XPDY0002_VariableUndeclared_2"
1210+#define ZED_XPDY0002_ContextUndeclared_2 "~XPDY0002_ContextUndeclared_2"
1211 #define ZED_FTST0009_BadStopWordsLang "~FTST0009_BadStopWordsLang"
1212 #define ZED_FTST0009_BadStemmerLang "~FTST0009_BadStemmerLang"
1213 #define ZED_FTST0009_BadThesaurusLang "~FTST0009_BadThesaurusLang"
1214@@ -236,8 +242,6 @@
1215 #define ZED_QuotedColon_23 "~QuotedColon_23"
1216 #define ZED_SEPM0009_Not10 "~SEPM0009_Not10"
1217 #define ZED_SEPM0009_NotOmit "~SEPM0009_NotOmit"
1218-#define ZED_SchemaAttributeName "~SchemaAttributeName"
1219-#define ZED_SchemaElementName "~SchemaElementName"
1220 #define ZED_SchemaOutOfMemory "~SchemaOutOfMemory"
1221 #define ZED_SchemaParseError "~SchemaParseError"
1222 #define ZED_SchemaUnexpected "~SchemaUnexpected"
1223@@ -300,9 +304,6 @@
1224 #define ZED_UnescapedChar_3 "~UnescapedChar_3"
1225 #define ZED_UnexpectedElement "~UnexpectedElement"
1226 #define ZED_VarValMustBeSingleItem_2 "~VarValMustBeSingleItem_2"
1227-#define ZED_Variable "~Variable"
1228-#define ZED_VariabledHasNoValue "~VariabledHasNoValue"
1229-#define ZED_VariabledUndeclared "~VariabledUndeclared"
1230 #define ZED_XMLSchema "~XMLSchema"
1231 #define ZED_XUST0002_Transform "~XUST0002_Transform"
1232 #define ZED_XUST0002_UDF_2 "~XUST0002_UDF_2"
1233
1234=== modified file 'src/runtime/core/var_iterators.cpp'
1235--- src/runtime/core/var_iterators.cpp 2012-10-08 12:09:36 +0000
1236+++ src/runtime/core/var_iterators.cpp 2013-01-08 11:10:56 +0000
1237@@ -464,7 +464,7 @@
1238 else
1239 {
1240 RAISE_ERROR(err::XPDY0002, loc,
1241- ERROR_PARAMS(theVarName->getStringValue(), ZED(VariabledUndeclared)));
1242+ ERROR_PARAMS(ZED(XPDY0002_VariableUndeclared_2), theVarName->getStringValue()));
1243 }
1244 } // if (theTargetPosIter != NULL && theTargetLenIter == NULL && theInfLen == false)
1245
1246@@ -532,7 +532,7 @@
1247 else
1248 {
1249 RAISE_ERROR(err::XPDY0002, loc,
1250- ERROR_PARAMS(theVarName->getStringValue(), ZED(VariabledUndeclared)));
1251+ ERROR_PARAMS(ZED(XPDY0002_VariableUndeclared_2), theVarName->getStringValue()));
1252 }
1253 } // if (theTargetPosIter != NULL && theTargetLenIter != NULL)
1254
1255@@ -565,7 +565,7 @@
1256 else
1257 {
1258 RAISE_ERROR(err::XPDY0002, loc,
1259- ERROR_PARAMS(theVarName->getStringValue(), ZED(VariabledUndeclared)));
1260+ ERROR_PARAMS(ZED(XPDY0002_VariableUndeclared_2), theVarName->getStringValue()));
1261 }
1262 } // if (theTargetPos > 0)
1263
1264@@ -596,7 +596,7 @@
1265 else
1266 {
1267 RAISE_ERROR(err::XPDY0002, loc,
1268- ERROR_PARAMS(theVarName->getStringValue(), ZED(VariabledUndeclared)));
1269+ ERROR_PARAMS(ZED(XPDY0002_VariableUndeclared_2), theVarName->getStringValue()));
1270 }
1271 }
1272
1273
1274=== modified file 'src/runtime/eval/eval.cpp'
1275--- src/runtime/eval/eval.cpp 2012-10-24 11:32:56 +0000
1276+++ src/runtime/eval/eval.cpp 2013-01-08 11:10:56 +0000
1277@@ -310,7 +310,7 @@
1278 ve->set_unique_id(outerGlobalVarId);
1279 }
1280
1281- importSctx->bind_var(ve, loc, err::XQST0049);
1282+ importSctx->bind_var(ve, loc);
1283 }
1284
1285 // Import the outer-query ns bindings
1286
1287=== modified file 'src/runtime/introspection/sctx_impl.cpp'
1288--- src/runtime/introspection/sctx_impl.cpp 2012-10-08 12:09:36 +0000
1289+++ src/runtime/introspection/sctx_impl.cpp 2013-01-08 11:10:56 +0000
1290@@ -102,7 +102,7 @@
1291
1292 consumeNext(lName, theChildren[0].getp(), aPlanState);
1293
1294- if (theSctx->lookup_ns(ns, lName->getStringValue(), loc, zerr::ZXQP0000_NO_ERROR))
1295+ if (theSctx->lookup_ns(ns, lName->getStringValue(), loc, false))
1296 {
1297 STACK_PUSH(GENV_ITEMFACTORY->createString(aResult, ns), state);
1298 }
1299
1300=== modified file 'src/runtime/numerics/numerics_impl.cpp'
1301--- src/runtime/numerics/numerics_impl.cpp 2012-12-05 04:47:27 +0000
1302+++ src/runtime/numerics/numerics_impl.cpp 2013-01-08 11:10:56 +0000
1303@@ -909,27 +909,34 @@
1304
1305 zstring ns;
1306 zstring prefix = tmpFormatName.substr(0, tmpFormatName.find(':'));
1307- if (theSctx->lookup_ns(ns, prefix, loc, zerr::ZXQP0000_NO_ERROR))
1308+ if (theSctx->lookup_ns(ns, prefix, loc, false))
1309 {
1310- GENV_ITEMFACTORY->createQName(formatName, ns, prefix, tmpFormatName.substr(tmpFormatName.find(':')+1));
1311+ GENV_ITEMFACTORY->createQName(formatName,
1312+ ns,
1313+ prefix,
1314+ tmpFormatName.substr(tmpFormatName.find(':')+1));
1315 break;
1316 }
1317
1318 // The prefix is not in the known namespaces, the only posibility left is for the function to be invoked from an EnclosedIterator
1319 if (planState.theNodeConstuctionPath.empty())
1320 {
1321- throw XQUERY_EXCEPTION(err::FODF1280, ERROR_PARAMS(tmpFormatName), ERROR_LOC(loc));
1322+ RAISE_ERROR(err::FODF1280, loc, ERROR_PARAMS(tmpFormatName));
1323 }
1324
1325 store::NsBindings bindings;
1326 planState.theNodeConstuctionPath.top()->getNamespaceBindings(bindings);
1327- for (unsigned int i=0; i<bindings.size(); i++)
1328+ for (unsigned int i = 0; i < bindings.size(); i++)
1329+ {
1330 if (prefix == bindings[i].first)
1331 {
1332- GENV_ITEMFACTORY->createQName(formatName, bindings[i].second, prefix, tmpFormatName.substr(tmpFormatName.find(':')+1));
1333+ GENV_ITEMFACTORY->createQName(formatName,
1334+ bindings[i].second,
1335+ prefix,
1336+ tmpFormatName.substr(tmpFormatName.find(':')+1));
1337 break;
1338 }
1339-
1340+ }
1341 } while(0);
1342
1343 if (formatName.isNull())
1344
1345=== modified file 'src/store/naive/node_items.cpp'
1346--- src/store/naive/node_items.cpp 2012-12-14 13:11:08 +0000
1347+++ src/store/naive/node_items.cpp 2013-01-08 11:10:56 +0000
1348@@ -22,8 +22,11 @@
1349 #include <zorba/item.h>
1350
1351 #include "api/unmarshaller.h"
1352+
1353 #include "diagnostics/assert.h"
1354+#include "diagnostics/util_macros.h"
1355 #include "diagnostics/xquery_diagnostics.h"
1356+
1357 #include "zorbatypes/URI.h"
1358 #ifndef ZORBA_NO_FULL_TEXT
1359 #include "zorbautils/locale.h"
1360@@ -3263,7 +3266,7 @@
1361 ********************************************************************************/
1362 void ElementNode::checkNamespaceConflict(
1363 const store::Item* qname,
1364- Error const& ecode) const
1365+ const QueryLoc* loc) const
1366 {
1367 const QNameItem* qn = reinterpret_cast<const QNameItem*>(qname);
1368
1369@@ -3279,7 +3282,8 @@
1370
1371 if (found && ns2 != ns)
1372 {
1373- throw XQUERY_EXCEPTION_VAR(ecode, ERROR_PARAMS(qname->show(), prefix, ns2));
1374+ RAISE_ERROR(err::XUDY0023, loc,
1375+ ERROR_PARAMS(qn->getStringValue(), prefix, ns, ns2));
1376 }
1377 }
1378
1379
1380=== modified file 'src/store/naive/node_items.h'
1381--- src/store/naive/node_items.h 2012-12-14 13:23:51 +0000
1382+++ src/store/naive/node_items.h 2013-01-08 11:10:56 +0000
1383@@ -54,6 +54,9 @@
1384 namespace zorba
1385 {
1386
1387+class QueryLoc;
1388+
1389+
1390 namespace store
1391 {
1392 class CopyMode;
1393@@ -1086,7 +1089,7 @@
1394
1395 void addBindingForQName2(const store::Item* qname);
1396
1397- void checkNamespaceConflict(const store::Item* qname, Error const &ecode) const;
1398+ void checkNamespaceConflict(const store::Item* qname, const QueryLoc* loc) const;
1399
1400 void uninheritBinding(
1401 NsBindingsContext* rootNSCtx,
1402
1403=== modified file 'src/store/naive/pul_primitives.cpp'
1404--- src/store/naive/pul_primitives.cpp 2012-12-10 16:02:05 +0000
1405+++ src/store/naive/pul_primitives.cpp 2013-01-08 11:10:56 +0000
1406@@ -1277,17 +1277,17 @@
1407 ********************************************************************************/
1408 void UpdDeleteNodesFromCollection::apply()
1409 {
1410- Collection* lColl = static_cast<Collection*>
1411+ Collection* coll = static_cast<Collection*>
1412 (GET_STORE().getCollection(theName, theIsDynamic).getp());
1413
1414- assert(lColl);
1415+ assert(coll);
1416
1417 theIsApplied = true;
1418
1419 uint64_t size;
1420 try
1421 {
1422- size = to_xs_unsignedLong(lColl->size());
1423+ size = to_xs_unsignedLong(coll->size());
1424 }
1425 catch (std::range_error& e)
1426 {
1427@@ -1304,7 +1304,7 @@
1428 {
1429 for (csize i = numNodes; i > 0; --i)
1430 {
1431- if (theNodes[i-1] != lColl->nodeAt(xs_integer(size - i)))
1432+ if (theNodes[i-1] != coll->nodeAt(xs_integer(size - i)))
1433 {
1434 isLast = false;
1435 break;
1436@@ -1320,25 +1320,25 @@
1437 theFound.resize(numNodes);
1438 thePositions.resize(numNodes);
1439
1440- for (std::size_t i = 0; i < numNodes; ++i)
1441+ for (csize i = 0; i < numNodes; ++i)
1442 {
1443- theFound[i] = lColl->removeNode(theNodes[i], thePositions[i]);
1444+ theFound[i] = coll->removeNode(theNodes[i], thePositions[i]);
1445 ++theNumApplied;
1446 }
1447 }
1448
1449 void UpdDeleteNodesFromCollection::undo()
1450 {
1451- Collection* lColl = static_cast<Collection*>
1452+ Collection* coll = static_cast<Collection*>
1453 (GET_STORE().getCollection(theName, theIsDynamic).getp());
1454
1455- assert(lColl);
1456+ assert(coll);
1457
1458 for (csize i = 0; i < theNumApplied; ++i)
1459 {
1460 if (theFound[i])
1461 {
1462- lColl->addNode(theNodes[i], thePositions[i]);
1463+ coll->addNode(theNodes[i], thePositions[i]);
1464 }
1465 }
1466 }
1467@@ -1349,11 +1349,13 @@
1468 ********************************************************************************/
1469 void UpdEditInCollection::apply()
1470 {
1471- Collection* lColl = static_cast<Collection*>
1472+#ifndef NDEBUG
1473+ Collection* coll = static_cast<Collection*>
1474 (GET_STORE().getCollection(theName, theIsDynamic).getp());
1475
1476- assert(lColl);
1477-
1478+ assert(coll);
1479+#endif
1480+
1481 theTarget->swap(theContent.getp());
1482
1483 theIsApplied = true;
1484@@ -1363,13 +1365,14 @@
1485 void UpdEditInCollection::undo()
1486 {
1487 if (!theFound)
1488- {
1489 return;
1490- }
1491- Collection* lColl = static_cast<Collection*>
1492+
1493+#ifndef NDEBUG
1494+ Collection* coll = static_cast<Collection*>
1495 (GET_STORE().getCollection(theName, theIsDynamic).getp());
1496
1497- assert(lColl);
1498+ assert(coll);
1499+#endif
1500
1501 theTarget->swap(theContent.getp());
1502 }
1503
1504=== modified file 'src/store/naive/simple_pul.cpp'
1505--- src/store/naive/simple_pul.cpp 2012-12-10 16:02:05 +0000
1506+++ src/store/naive/simple_pul.cpp 2013-01-08 11:10:56 +0000
1507@@ -392,7 +392,7 @@
1508
1509 ********************************************************************************/
1510 void PULImpl::addInsertAttributes(
1511- const QueryLoc* aQueryLoc,
1512+ const QueryLoc* loc,
1513 store::Item_t& target,
1514 std::vector<store::Item_t>& attrs)
1515 {
1516@@ -401,16 +401,16 @@
1517 ElementNode* n = ELEM_NODE(target);
1518
1519 csize numAttrs = attrs.size();
1520- for (csize i = 0; i < numAttrs; i++)
1521+ for (csize i = 0; i < numAttrs; ++i)
1522 {
1523- n->checkNamespaceConflict(attrs[i]->getNodeName(), err::XUDY0023);
1524+ n->checkNamespaceConflict(attrs[i]->getNodeName(), loc);
1525 }
1526
1527 NodeUpdates* updates = 0;
1528 bool found = pul->theNodeToUpdatesMap.get(n, updates);
1529
1530 UpdInsertAttributes* upd = GET_PUL_FACTORY().
1531- createUpdInsertAttributes(pul, aQueryLoc, target, attrs);
1532+ createUpdInsertAttributes(pul, loc, target, attrs);
1533
1534 pul->theDoFirstList.push_back(upd);
1535
1536@@ -431,7 +431,7 @@
1537
1538 ********************************************************************************/
1539 void PULImpl::addReplaceNode(
1540- const QueryLoc* aQueryLoc,
1541+ const QueryLoc* loc,
1542 store::Item_t& target,
1543 std::vector<store::Item_t>& newNodes)
1544 {
1545@@ -456,19 +456,19 @@
1546 csize numNewAttrs = newNodes.size();
1547 for (csize i = 0; i < numNewAttrs; ++i)
1548 {
1549- elemParent->checkNamespaceConflict(newNodes[i]->getNodeName(), err::XUDY0023);
1550+ elemParent->checkNamespaceConflict(newNodes[i]->getNodeName(), loc);
1551 }
1552 }
1553
1554 upd = GET_PUL_FACTORY().
1555- createUpdReplaceAttribute(pul, aQueryLoc, parent, target, newNodes);
1556+ createUpdReplaceAttribute(pul, loc, parent, target, newNodes);
1557
1558 kind = store::UpdateConsts::UP_REPLACE_ATTRIBUTE;
1559 }
1560 else
1561 {
1562 upd = GET_PUL_FACTORY().
1563- createUpdReplaceChild(pul, aQueryLoc, parent, target, newNodes);
1564+ createUpdReplaceChild(pul, loc, parent, target, newNodes);
1565
1566 kind = store::UpdateConsts::UP_REPLACE_CHILD;
1567 }
1568@@ -614,7 +614,7 @@
1569
1570 ********************************************************************************/
1571 void PULImpl::addRename(
1572- const QueryLoc* aQueryLoc,
1573+ const QueryLoc* loc,
1574 store::Item_t& target,
1575 store::Item_t& newName)
1576 {
1577@@ -632,10 +632,9 @@
1578 case store::StoreConsts::elementNode:
1579 {
1580 ElementNode* elemTarget = ELEM_NODE(target);
1581- elemTarget->checkNamespaceConflict(newName.getp(), err::XUDY0023);
1582+ elemTarget->checkNamespaceConflict(newName.getp(), loc);
1583
1584- upd = GET_PUL_FACTORY().
1585- createUpdRenameElem(pul, aQueryLoc, target, newName);
1586+ upd = GET_PUL_FACTORY().createUpdRenameElem(pul, loc, target, newName);
1587 break;
1588 }
1589 case store::StoreConsts::attributeNode:
1590@@ -643,16 +642,16 @@
1591 ElementNode* elemParent = reinterpret_cast<ElementNode*>(n->theParent);
1592
1593 if (elemParent != NULL)
1594- elemParent->checkNamespaceConflict(newName.getp(), err::XUDY0023);
1595+ elemParent->checkNamespaceConflict(newName.getp(), loc);
1596
1597- upd = GET_PUL_FACTORY().createUpdRenameAttr(pul, aQueryLoc, target, newName);
1598+ upd = GET_PUL_FACTORY().createUpdRenameAttr(pul, loc, target, newName);
1599 break;
1600 }
1601 case store::StoreConsts::piNode:
1602 {
1603 zstring tmp;
1604 newName->getStringValue2(tmp);
1605- upd = GET_PUL_FACTORY().createUpdRenamePi(pul, aQueryLoc, target, tmp);
1606+ upd = GET_PUL_FACTORY().createUpdRenamePi(pul, loc, target, tmp);
1607 break;
1608 }
1609 default:
1610@@ -670,7 +669,7 @@
1611 else
1612 {
1613 csize numUpdates = updates->size();
1614- for (csize i = 0; i < numUpdates; i++)
1615+ for (csize i = 0; i < numUpdates; ++i)
1616 {
1617 if (store::UpdateConsts::isRename((*updates)[i]->getKind()))
1618 {
1619
1620=== modified file 'src/types/casting.cpp'
1621--- src/types/casting.cpp 2012-12-29 06:48:09 +0000
1622+++ src/types/casting.cpp 2013-01-08 11:10:56 +0000
1623@@ -2371,7 +2371,7 @@
1624 xqtref_t sourceType = tm->create_named_type(item->getType(),
1625 TypeConstants::QUANT_ONE,
1626 loc,
1627- err::XPTY0004);
1628+ true);
1629
1630 ZORBA_ASSERT(item->isAtomic());
1631 ZORBA_ASSERT(sourceType != NULL);
1632@@ -2709,7 +2709,7 @@
1633 xqtref_t lSourceType = tm->create_named_type(aItem->getType(),
1634 TypeConstants::QUANT_ONE,
1635 QueryLoc::null,
1636- err::XPTY0004);
1637+ true);
1638
1639 TypeConstants::castable_t lIsCastable = TypeOps::castability(*lSourceType,
1640 *targetType);
1641
1642=== modified file 'src/types/schema/revalidateUtils.cpp'
1643--- src/types/schema/revalidateUtils.cpp 2012-12-28 10:24:59 +0000
1644+++ src/types/schema/revalidateUtils.cpp 2013-01-08 11:10:56 +0000
1645@@ -497,7 +497,8 @@
1646 {
1647 xqtref_t type = typeManager->create_named_atomic_type(typeQName,
1648 TypeConstants::QUANT_ONE,
1649- loc);
1650+ loc,
1651+ false);
1652 //cout << " vup - processTextValue: '" << textValue->c_str() << "'\n";
1653 //cout << " vup - processTextValue: " << typeQName->getPrefix()->str()
1654 // << ":" << typeQName->getLocalName()->str() << "@"
1655
1656=== modified file 'src/types/schema/schema.cpp'
1657--- src/types/schema/schema.cpp 2012-12-28 11:53:57 +0000
1658+++ src/types/schema/schema.cpp 2013-01-08 11:10:56 +0000
1659@@ -513,11 +513,8 @@
1660
1661 if (!typeDef)
1662 {
1663- throw XQUERY_EXCEPTION(
1664- err::XPST0008,
1665- ERROR_PARAMS( qname->getStringValue(), ZED( SchemaElementName ) ),
1666- ERROR_LOC( loc )
1667- );
1668+ RAISE_ERROR(err::XPST0008, loc,
1669+ ERROR_PARAMS(ZED(XPST0008_SchemaElementName_2), qname->getStringValue()));
1670 }
1671
1672 const XMLCh* typeNameStr = typeDef->getName();
1673@@ -542,11 +539,8 @@
1674
1675 if (!typeDef)
1676 {
1677- throw XQUERY_EXCEPTION(
1678- err::XPST0008,
1679- ERROR_PARAMS( qname->getStringValue(), ZED( SchemaAttributeName ) ),
1680- ERROR_LOC( loc )
1681- );
1682+ RAISE_ERROR(err::XPST0008, loc,
1683+ ERROR_PARAMS(ZED(XPST0008_SchemaAttributeName_2), qname->getStringValue()));
1684 }
1685
1686 const XMLCh* typeNameStr = typeDef->getName();
1687@@ -579,11 +573,8 @@
1688
1689 if (!typeDef)
1690 {
1691- throw XQUERY_EXCEPTION(
1692- err::XPST0008,
1693- ERROR_PARAMS( qname->getStringValue(), ZED( SchemaElementName ) ),
1694- ERROR_LOC( loc )
1695- );
1696+ RAISE_ERROR(err::XPST0008, loc,
1697+ ERROR_PARAMS(ZED(XPST0008_SchemaElementName_2), qname->getStringValue()));
1698 }
1699
1700 xqtref_t res = createXQTypeFromTypeDefinition(typeManager, typeDef);
1701@@ -611,11 +602,8 @@
1702
1703 if (!typeDef)
1704 {
1705- throw XQUERY_EXCEPTION(
1706- err::XPST0008,
1707- ERROR_PARAMS( qname->getStringValue(), ZED( SchemaAttributeName ) ),
1708- ERROR_LOC( loc )
1709- );
1710+ RAISE_ERROR(err::XPST0008, loc,
1711+ ERROR_PARAMS(ZED(XPST0008_SchemaAttributeName_2), qname->getStringValue()));
1712 }
1713
1714 return createXQTypeFromTypeDefinition(typeManager, typeDef);
1715
1716=== modified file 'src/types/typeimpl.cpp'
1717--- src/types/typeimpl.cpp 2013-01-03 09:04:01 +0000
1718+++ src/types/typeimpl.cpp 2013-01-08 11:10:56 +0000
1719@@ -883,7 +883,7 @@
1720 xqtref_t subContentType = tm->create_named_type(subitem->getType(),
1721 TypeConstants::QUANT_ONE,
1722 loc,
1723- err::XPTY0004);
1724+ true);
1725
1726 return TypeOps::is_subtype(tm, *subContentType, *theContentType);
1727 }
1728
1729=== modified file 'src/types/typemanager.h'
1730--- src/types/typemanager.h 2012-12-18 15:57:51 +0000
1731+++ src/types/typemanager.h 2013-01-08 11:10:56 +0000
1732@@ -111,7 +111,7 @@
1733 store::Item* qname,
1734 TypeConstants::quantifier_t q,
1735 const QueryLoc& loc,
1736- const Error& error = zerr::ZXQP0000_NO_ERROR) const = 0;
1737+ bool raiseError) const = 0;
1738
1739 virtual xqtref_t create_named_simple_type(
1740 store::Item* qname) const = 0;
1741@@ -120,7 +120,7 @@
1742 store::Item* qname,
1743 TypeConstants::quantifier_t q,
1744 const QueryLoc& loc,
1745- const Error& error = zerr::ZXQP0000_NO_ERROR) const = 0;
1746+ bool raiseError = false) const = 0;
1747
1748 virtual xqtref_t create_structured_item_type(TypeConstants::quantifier_t q) const = 0;
1749
1750
1751=== modified file 'src/types/typemanagerimpl.cpp'
1752--- src/types/typemanagerimpl.cpp 2012-12-28 10:24:59 +0000
1753+++ src/types/typemanagerimpl.cpp 2013-01-08 11:10:56 +0000
1754@@ -246,7 +246,7 @@
1755 store::Item* qname,
1756 TypeConstants::quantifier_t quantifier,
1757 const QueryLoc& loc,
1758- const Error& error) const
1759+ bool raiseError) const
1760 {
1761 // Try to resolve the type name as a builtin atomic type
1762 RootTypeManager::qnametype_map_t& myMap = GENV_TYPESYSTEM.m_atomic_qnametype_map;
1763@@ -260,11 +260,10 @@
1764 // type (because, otherwise it would have been found above). So we return NULL.
1765 if (ZSTREQ(qname->getNamespace(), XML_SCHEMA_NS))
1766 {
1767- if (error != zerr::ZXQP0000_NO_ERROR)
1768+ if (raiseError)
1769 {
1770- throw XQUERY_EXCEPTION_VAR(error,
1771- ERROR_PARAMS(qname->getStringValue(), ZED(NotAmongInScopeSchemaTypes)),
1772- ERROR_LOC(loc));
1773+ RAISE_ERROR(err::XPTY0004, loc,
1774+ ERROR_PARAMS(qname->getStringValue(), ZED(NotAmongInScopeSchemaTypes)));
1775 }
1776 else
1777 {
1778@@ -281,11 +280,10 @@
1779
1780 if (namedType == NULL)
1781 {
1782- if (error != zerr::ZXQP0000_NO_ERROR)
1783+ if (raiseError)
1784 {
1785- throw XQUERY_EXCEPTION_VAR(error,
1786- ERROR_PARAMS(qname->getStringValue(), ZED(NotAmongInScopeSchemaTypes)),
1787- ERROR_LOC(loc));
1788+ RAISE_ERROR(err::XPTY0004, loc,
1789+ ERROR_PARAMS(qname->getStringValue(), ZED(NotAmongInScopeSchemaTypes)));
1790 }
1791 else
1792 {
1793@@ -303,11 +301,10 @@
1794 }
1795 #endif
1796
1797- if (error != zerr::ZXQP0000_NO_ERROR)
1798+ if (raiseError)
1799 {
1800- throw XQUERY_EXCEPTION_VAR(error,
1801- ERROR_PARAMS(qname->getStringValue(), ZED(NotAmongInScopeSchemaTypes)),
1802- ERROR_LOC(loc));
1803+ RAISE_ERROR(err::XPTY0004, loc,
1804+ ERROR_PARAMS(qname->getStringValue(), ZED(NotAmongInScopeSchemaTypes)));
1805 }
1806 else
1807 {
1808@@ -387,7 +384,7 @@
1809 store::Item* qname,
1810 TypeConstants::quantifier_t quant,
1811 const QueryLoc& loc,
1812- const Error& error) const
1813+ bool raiseError) const
1814 {
1815 RootTypeManager& RTM = GENV_TYPESYSTEM;
1816
1817@@ -422,11 +419,10 @@
1818
1819 if (namedType == NULL)
1820 {
1821- if (error != zerr::ZXQP0000_NO_ERROR)
1822+ if (raiseError)
1823 {
1824- throw XQUERY_EXCEPTION_VAR(error,
1825- ERROR_PARAMS(qname->getStringValue(), ZED(NotAmongInScopeSchemaTypes)),
1826- ERROR_LOC(loc));
1827+ RAISE_ERROR(err::XPTY0004, loc,
1828+ ERROR_PARAMS(qname->getStringValue(), ZED(NotAmongInScopeSchemaTypes)));
1829 }
1830 else
1831 {
1832@@ -440,11 +436,10 @@
1833 }
1834 #endif
1835
1836- if (error != zerr::ZXQP0000_NO_ERROR)
1837+ if (raiseError)
1838 {
1839- throw XQUERY_EXCEPTION_VAR(error,
1840- ERROR_PARAMS(qname->getStringValue(), ZED(NotAmongInScopeSchemaTypes)),
1841- ERROR_LOC(loc));
1842+ RAISE_ERROR(err::XPTY0004, loc,
1843+ ERROR_PARAMS(qname->getStringValue(), ZED(NotAmongInScopeSchemaTypes)));
1844 }
1845 else
1846 {
1847@@ -726,7 +721,7 @@
1848 return create_named_atomic_type(item->getType(),
1849 quant,
1850 loc,
1851- err::XPTY0004);
1852+ true);
1853 }
1854 else if (item->isNode())
1855 {
1856@@ -740,7 +735,7 @@
1857 xqtref_t contentType = create_named_type(item->getType(),
1858 quant,
1859 loc,
1860- err::XPTY0004);
1861+ true);
1862
1863 return create_node_type(nodeKind,
1864 item->getNodeName(),
1865@@ -848,11 +843,8 @@
1866 {
1867 if (m_schema == NULL)
1868 {
1869- throw XQUERY_EXCEPTION(
1870- err::XPST0008,
1871- ERROR_PARAMS( elemName->getStringValue(), ZED( SchemaElementName ) ),
1872- ERROR_LOC( loc )
1873- );
1874+ RAISE_ERROR(err::XPST0008, loc,
1875+ ERROR_PARAMS(ZED(XPST0008_SchemaElementName_2), elemName->getStringValue()));
1876 }
1877
1878 xqtref_t contentType =
1879@@ -878,7 +870,7 @@
1880 if (m_schema == NULL)
1881 {
1882 RAISE_ERROR(err::XPST0008, loc,
1883- ERROR_PARAMS(elemName->getStringValue(), ZED(SchemaElementName)));
1884+ ERROR_PARAMS(ZED(XPST0008_SchemaElementName_2), elemName->getStringValue()));
1885 }
1886
1887 m_schema->getTypeNameFromElementName(elemName, typeName, loc);
1888@@ -899,7 +891,7 @@
1889 if (m_schema == NULL)
1890 {
1891 RAISE_ERROR(err::XPST0008, loc,
1892- ERROR_PARAMS(attrName->getStringValue(), ZED(SchemaAttributeName)));
1893+ ERROR_PARAMS(ZED(XPST0008_SchemaAttributeName_2), attrName->getStringValue()));
1894 }
1895
1896 xqtref_t contentType =
1897@@ -926,7 +918,7 @@
1898 if (m_schema == NULL)
1899 {
1900 RAISE_ERROR(err::XPST0008, loc,
1901- ERROR_PARAMS(attrName->getStringValue(), ZED(SchemaAttributeName)));
1902+ ERROR_PARAMS(ZED(XPST0008_SchemaAttributeName_2), attrName->getStringValue()));
1903 }
1904
1905 m_schema->getTypeNameFromAttributeName(attrName, typeName, loc);
1906@@ -1105,7 +1097,7 @@
1907 ident.getUri().c_str(),
1908 NULL,
1909 ident.getLocalName().c_str());
1910- return create_named_type(i, q, QueryLoc::null, err::XPTY0004);
1911+ return create_named_type(i, q, QueryLoc::null, true);
1912 }
1913
1914 case IdentTypes::ELEMENT_TYPE:
1915
1916=== modified file 'src/types/typemanagerimpl.h'
1917--- src/types/typemanagerimpl.h 2012-12-28 10:24:59 +0000
1918+++ src/types/typemanagerimpl.h 2013-01-08 11:10:56 +0000
1919@@ -108,7 +108,7 @@
1920 store::Item* qname,
1921 TypeConstants::quantifier_t quant,
1922 const QueryLoc& loc,
1923- const Error& error = zerr::ZXQP0000_NO_ERROR) const;
1924+ bool raiseError) const;
1925
1926 virtual xqtref_t create_named_simple_type(
1927 store::Item* qname) const;
1928@@ -117,7 +117,7 @@
1929 store::Item* qname,
1930 TypeConstants::quantifier_t quant,
1931 const QueryLoc& loc,
1932- const Error& error = zerr::ZXQP0000_NO_ERROR) const;
1933+ bool raiseError = false) const;
1934
1935 xqtref_t create_structured_item_type(TypeConstants::quantifier_t q) const;
1936
1937
1938=== modified file 'src/types/typeops.cpp'
1939--- src/types/typeops.cpp 2012-12-28 10:24:59 +0000
1940+++ src/types/typeops.cpp 2013-01-08 11:10:56 +0000
1941@@ -777,7 +777,7 @@
1942 xqtref_t subtype = tm->create_named_atomic_type(subitem->getType(),
1943 TypeConstants::QUANT_ONE,
1944 loc,
1945- err::XPTY0004);
1946+ true);
1947 switch(subtype->type_kind())
1948 {
1949 case XQType::ATOMIC_TYPE_KIND:
1950@@ -866,7 +866,7 @@
1951 xqtref_t subtype = tm->create_named_atomic_type(subitem->getType(),
1952 TypeConstants::QUANT_ONE,
1953 loc,
1954- err::XPTY0004);
1955+ true);
1956 switch (subtype->type_kind())
1957 {
1958 case XQType::ATOMIC_TYPE_KIND:
1959@@ -911,7 +911,7 @@
1960 xqtref_t subtype = tm->create_named_atomic_type(subitem->getType(),
1961 TypeConstants::QUANT_ONE,
1962 loc,
1963- err::XPTY0004);
1964+ true);
1965 const UserDefinedXQType& udSuperType =
1966 static_cast<const UserDefinedXQType&>(supertype);
1967
1968
1969=== modified file 'test/rbkt/Queries/zorba/modules/mainModule16.xq'
1970--- test/rbkt/Queries/zorba/modules/mainModule16.xq 2012-09-19 21:16:15 +0000
1971+++ test/rbkt/Queries/zorba/modules/mainModule16.xq 2013-01-08 11:10:56 +0000
1972@@ -5,6 +5,8 @@
1973 (: Purpose: Error XQST0036 :)
1974 (:*******************************************************:)
1975
1976+xquery version "1.0";
1977+
1978 import module namespace math = "http://example.org/math-functions" at
1979 "libraryModule12.xqlib";
1980

Subscribers

People subscribed via source and target branches