Merge lp:~zorba-coders/zorba/bug-1024892 into lp:zorba

Proposed by Markos Zaharioudakis
Status: Merged
Approved by: Markos Zaharioudakis
Approved revision: 10980
Merged at revision: 10985
Proposed branch: lp:~zorba-coders/zorba/bug-1024892
Merge into: lp:zorba
Diff against target: 182 lines (+85/-31)
6 files modified
ChangeLog (+2/-0)
src/compiler/parsetree/parsenodes.cpp (+30/-10)
src/compiler/parsetree/parsenodes.h (+17/-20)
src/compiler/translator/translator.cpp (+1/-1)
test/rbkt/Queries/zorba/xqddf/test5.xq (+7/-0)
test/rbkt/Queries/zorba/xqddf/test5.xqlib (+28/-0)
To merge this branch: bzr merge lp:~zorba-coders/zorba/bug-1024892
Reviewer Review Type Date Requested Status
Markos Zaharioudakis Approve
Review via email: mp+118977@code.launchpad.net

Commit message

Fixed bug #1024892 (index declaration references udf declared after the index)

Description of the change

Fixed bug #1024892 (index declaration references udf declared after the index)

To post a comment you must log in.
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 bug-1024892-2012-08-09T15-27-05.846Z is finished. The final status was:

All tests succeeded!

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

Voting does not meet specified criteria. Required: Approve > 1, Disapprove < 1, Needs Fixing < 1, Pending < 1. Got: 2 Pending.

Revision history for this message
Markos Zaharioudakis (markos-za) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

There are additional revisions which have not been approved in review. Please seek review and approval of these new revisions.

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 bug-1024892-2012-08-14T11-38-28.961Z 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 2012-08-14 10:05:04 +0000
3+++ ChangeLog 2012-08-14 11:32:38 +0000
4@@ -6,6 +6,8 @@
5 * Fixed bugs #899364 and 899363 (throw XQST0103 in case of non-distinct window
6 variables)
7 * Fixed bug #899366 (enforce the type declaration of a window variable)
8+ * Fixed bug #1024892 (index declaration references udf declared after the index)
9+
10
11 version 2.6
12
13
14=== modified file 'src/compiler/parsetree/parsenodes.cpp'
15--- src/compiler/parsetree/parsenodes.cpp 2012-08-14 10:05:04 +0000
16+++ src/compiler/parsetree/parsenodes.cpp 2012-08-14 11:32:38 +0000
17@@ -628,11 +628,19 @@
18
19 VFO_Decl ::= VarDecl | ContextItemDecl | FunctionDecl | IndexDecl | OptionDecl
20 ********************************************************************************/
21-VFO_DeclList::VFO_DeclList(
22- const QueryLoc& loc_)
23+VFO_DeclList::VFO_DeclList(const QueryLoc& loc)
24 :
25- parsenode(loc_)
26-{
27+ parsenode(loc)
28+{
29+}
30+
31+
32+void VFO_DeclList::push_back(const rchandle<parsenode>& decl)
33+{
34+ theDecls.push_back(decl);
35+
36+ bool isIndexDecl = (dynamic_cast<AST_IndexDecl*>(decl.getp()) != NULL);
37+ theIndexDeclFlags.push_back(isIndexDecl);
38 }
39
40
41@@ -640,12 +648,24 @@
42 {
43 BEGIN_VISITOR();
44
45- for (std::vector<rchandle<parsenode> >::const_iterator it = vfo_hv.begin();
46- it != vfo_hv.end();
47- ++it)
48- {
49- ACCEPT_CHK (*it);
50- }
51+ csize numDecls = theDecls.size();
52+
53+ for (csize i = 0; i < numDecls; ++i)
54+ {
55+ if (theIndexDeclFlags[i])
56+ continue;
57+
58+ ACCEPT_CHK(theDecls[i]);
59+ }
60+
61+ for (csize i = 0; i < numDecls; ++i)
62+ {
63+ if (!theIndexDeclFlags[i])
64+ continue;
65+
66+ ACCEPT_CHK(theDecls[i]);
67+ }
68+
69 END_VISITOR();
70 }
71
72
73=== modified file 'src/compiler/parsetree/parsenodes.h'
74--- src/compiler/parsetree/parsenodes.h 2012-08-14 10:05:04 +0000
75+++ src/compiler/parsetree/parsenodes.h 2012-08-14 11:32:38 +0000
76@@ -813,30 +813,27 @@
77 class VFO_DeclList : public parsenode
78 {
79 protected:
80- std::vector<rchandle<parsenode> > vfo_hv;
81+ std::vector<rchandle<parsenode> > theDecls;
82+ std::vector<bool> theIndexDeclFlags;
83
84 public:
85 VFO_DeclList(const QueryLoc&);
86
87- ulong size () const { return (ulong)vfo_hv.size (); }
88-
89- void push_front(rchandle<parsenode> vfo_h) { vfo_hv.insert(vfo_hv.begin(), vfo_h); }
90-
91- void push_back(rchandle<parsenode> vfo_h) { vfo_hv.push_back(vfo_h); }
92-
93- void push_back (const VFO_DeclList &other) { vfo_hv.insert(vfo_hv.end(), other.vfo_hv.begin(), other.vfo_hv.end()); }
94-
95- rchandle<parsenode> operator[](int k) const { return vfo_hv[k]; }
96-
97- std::vector<rchandle<parsenode> >::iterator begin() { return vfo_hv.begin(); }
98-
99- std::vector<rchandle<parsenode> >::iterator end() { return vfo_hv.end(); }
100-
101- std::vector<rchandle<parsenode> >::const_iterator begin() const { return vfo_hv.begin(); }
102-
103- std::vector<rchandle<parsenode> >::const_iterator end() const { return vfo_hv.end(); }
104-
105- const VarDecl* findVarDecl(const QName& varname);
106+ csize size() const { return theDecls.size(); }
107+
108+ void push_back(const rchandle<parsenode>& vfo);
109+
110+ rchandle<parsenode> operator[](int k) const { return theDecls[k]; }
111+
112+ std::vector<rchandle<parsenode> >::const_iterator begin() const
113+ {
114+ return theDecls.begin();
115+ }
116+
117+ std::vector<rchandle<parsenode> >::const_iterator end() const
118+ {
119+ return theDecls.end();
120+ }
121
122 void accept(parsenode_visitor&) const;
123 };
124
125=== modified file 'src/compiler/translator/translator.cpp'
126--- src/compiler/translator/translator.cpp 2012-08-14 10:05:04 +0000
127+++ src/compiler/translator/translator.cpp 2012-08-14 11:32:38 +0000
128@@ -3213,7 +3213,7 @@
129 // (3) and then creates the udf object and binds it in the sctx.
130 // The 1st pass also binds all options, so that the module version information
131 // is available if we try to load external function libraries.
132- // 2nd pass; happens when accept() is called on each individual FunctionDecl
133+ // The 2nd pass happens when accept() is called on each individual FunctionDecl
134 // node in the list.
135
136 for (std::vector<rchandle<parsenode> >::const_iterator it = v.begin();
137
138=== added file 'test/rbkt/ExpQueryResults/zorba/xqddf/test5.xml.res'
139=== added file 'test/rbkt/Queries/zorba/xqddf/test5.xq'
140--- test/rbkt/Queries/zorba/xqddf/test5.xq 1970-01-01 00:00:00 +0000
141+++ test/rbkt/Queries/zorba/xqddf/test5.xq 2012-08-14 11:32:38 +0000
142@@ -0,0 +1,7 @@
143+import module namespace guestbook = "http://www.28msec.com/guestbook" at "test5.xqlib";
144+
145+
146+import module namespace db = "http://www.zorba-xquery.com/modules/store/static/collections/ddl";
147+
148+
149+db:create($guestbook:entries);
150
151=== added file 'test/rbkt/Queries/zorba/xqddf/test5.xqlib'
152--- test/rbkt/Queries/zorba/xqddf/test5.xqlib 1970-01-01 00:00:00 +0000
153+++ test/rbkt/Queries/zorba/xqddf/test5.xqlib 2012-08-14 11:32:38 +0000
154@@ -0,0 +1,28 @@
155+module namespace guestbook = "http://www.28msec.com/guestbook";
156+
157+import module namespace functx = "http://www.functx.com/";
158+
159+import module namespace db = "http://www.zorba-xquery.com/modules/store/static/collections/dml";
160+
161+import module namespace idx = "http://www.zorba-xquery.com/modules/store/static/indexes/dml";
162+
163+declare namespace an = "http://www.zorba-xquery.com/annotations";
164+
165+declare collection guestbook:entries as node()*;
166+
167+declare variable $guestbook:entries as xs:QName := xs:QName("guestbook:entries");
168+
169+(: Access a document range :)
170+declare %private %an:automatic %an:unique %an:value-range index guestbook:by-date
171+on nodes db:collection(xs:QName('guestbook:entries'))
172+by guestbook:convert-dateTime(@datetime) as xs:dateTime;
173+
174+
175+declare %private variable $guestbook:by-date as xs:QName := xs:QName('guestbook:by-date');
176+
177+
178+declare function guestbook:convert-dateTime($dateTime as xs:string) as xs:dateTime
179+{
180+ current-dateTime()
181+};
182+

Subscribers

People subscribed via source and target branches