Merge lp:~zorba-coders/zorba/markos-scratch into lp:zorba
- markos-scratch
- Merge into trunk
Proposed by
Markos Zaharioudakis
Status: | Merged |
---|---|
Approved by: | Markos Zaharioudakis |
Approved revision: | 10961 |
Merged at revision: | 11092 |
Proposed branch: | lp:~zorba-coders/zorba/markos-scratch |
Merge into: | lp:zorba |
Diff against target: |
11065 lines (+2844/-2065) 44 files modified
src/compiler/expression/CMakeLists.txt (+1/-0) src/compiler/expression/expr.cpp (+130/-300) src/compiler/expression/expr.h (+197/-132) src/compiler/expression/expr_base.cpp (+18/-42) src/compiler/expression/expr_base.h (+16/-14) src/compiler/expression/expr_clone.cpp (+790/-0) src/compiler/expression/expr_manager.cpp (+174/-140) src/compiler/expression/expr_manager.h (+85/-8) src/compiler/expression/flwor_expr.cpp (+107/-98) src/compiler/expression/flwor_expr.h (+25/-14) src/compiler/expression/fo_expr.cpp (+14/-29) src/compiler/expression/fo_expr.h (+15/-3) src/compiler/expression/ft_expr.cpp (+5/-10) src/compiler/expression/ft_expr.h (+2/-2) src/compiler/expression/ftnode.cpp (+95/-75) src/compiler/expression/ftnode.h (+31/-28) src/compiler/expression/function_item_expr.cpp (+13/-42) src/compiler/expression/function_item_expr.h (+7/-8) src/compiler/expression/json_exprs.cpp (+6/-50) src/compiler/expression/json_exprs.h (+6/-6) src/compiler/expression/path_expr.cpp (+18/-44) src/compiler/expression/path_expr.h (+15/-9) src/compiler/expression/script_exprs.cpp (+26/-93) src/compiler/expression/script_exprs.h (+18/-18) src/compiler/expression/update_exprs.cpp (+19/-67) src/compiler/expression/update_exprs.h (+53/-48) src/compiler/expression/var_expr.cpp (+4/-18) src/compiler/expression/var_expr.h (+2/-13) src/compiler/parsetree/parsenodes.cpp (+1/-1) src/compiler/rewriter/framework/rewriter_context.cpp (+1/-1) src/compiler/rewriter/rules/flwor_rules.cpp (+32/-12) src/compiler/rewriter/rules/fold_rules.cpp (+139/-107) src/compiler/rewriter/rules/hoist_rules.cpp (+19/-16) src/compiler/rewriter/rules/index_join_rule.cpp (+46/-33) src/compiler/rewriter/rules/type_rules.cpp (+23/-17) src/compiler/rewriter/tools/dataflow_annotations.cpp (+4/-6) src/compiler/rewriter/tools/dataflow_annotations.h (+0/-6) src/compiler/translator/translator.cpp (+644/-477) src/compiler/xqddf/value_index.cpp (+30/-23) src/functions/udf.cpp (+9/-0) src/functions/udf.h (+2/-0) src/runtime/eval/eval.cpp (+1/-0) src/runtime/function_item/function_item.cpp (+1/-1) test/rbkt/Queries/zorba/no-copy/q21.xq (+0/-54) |
To merge this branch: | bzr merge lp:~zorba-coders/zorba/markos-scratch |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Markos Zaharioudakis | Approve | ||
Review via email: mp+128675@code.launchpad.net |
Commit message
Associated expressions with UDFs
Description of the change
Associated expressions with UDFs
To post a comment you must log in.
- 10960. By Markos Zaharioudakis
-
associating exprs with udfs
Revision history for this message
Markos Zaharioudakis (markos-za) : | # |
review:
Approve
- 10961. By Markos Zaharioudakis
-
cleaning up no-copy rule
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-
All tests succeeded!
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/compiler/expression/CMakeLists.txt' | |||
2 | --- src/compiler/expression/CMakeLists.txt 2012-10-08 12:09:36 +0000 | |||
3 | +++ src/compiler/expression/CMakeLists.txt 2012-10-09 13:35:26 +0000 | |||
4 | @@ -14,6 +14,7 @@ | |||
5 | 14 | SET(EXPRESSION_SRCS | 14 | SET(EXPRESSION_SRCS |
6 | 15 | expr_consts.cpp | 15 | expr_consts.cpp |
7 | 16 | expr_base.cpp | 16 | expr_base.cpp |
8 | 17 | expr_clone.cpp | ||
9 | 17 | expr_iter.cpp | 18 | expr_iter.cpp |
10 | 18 | expr_type.cpp | 19 | expr_type.cpp |
11 | 19 | expr.cpp | 20 | expr.cpp |
12 | 20 | 21 | ||
13 | === modified file 'src/compiler/expression/expr.cpp' | |||
14 | --- src/compiler/expression/expr.cpp 2012-10-08 12:09:36 +0000 | |||
15 | +++ src/compiler/expression/expr.cpp 2012-10-09 13:35:26 +0000 | |||
16 | @@ -83,22 +83,19 @@ | |||
17 | 83 | DEF_EXPR_ACCEPT (pi_expr) | 83 | DEF_EXPR_ACCEPT (pi_expr) |
18 | 84 | 84 | ||
19 | 85 | 85 | ||
20 | 86 | #define CLONE( e, s ) ((e) == NULL ? NULL : (e)->clone(s)) | ||
21 | 87 | |||
22 | 88 | |||
23 | 89 | |||
24 | 90 | /******************************************************************************* | 86 | /******************************************************************************* |
25 | 91 | [68] IfExpr ::= "if" "(" Expr ")" "then" ExprSingle "else" ExprSingle | 87 | [68] IfExpr ::= "if" "(" Expr ")" "then" ExprSingle "else" ExprSingle |
26 | 92 | ********************************************************************************/ | 88 | ********************************************************************************/ |
27 | 93 | if_expr::if_expr( | 89 | if_expr::if_expr( |
28 | 94 | CompilerCB* ccb, | 90 | CompilerCB* ccb, |
29 | 95 | static_context* sctx, | 91 | static_context* sctx, |
30 | 92 | user_function* udf, | ||
31 | 96 | const QueryLoc& loc, | 93 | const QueryLoc& loc, |
32 | 97 | expr* condExpr, | 94 | expr* condExpr, |
33 | 98 | expr* thenExpr, | 95 | expr* thenExpr, |
34 | 99 | expr* elseExpr) | 96 | expr* elseExpr) |
35 | 100 | : | 97 | : |
37 | 101 | expr(ccb, sctx, loc, if_expr_kind), | 98 | expr(ccb, sctx, udf, loc, if_expr_kind), |
38 | 102 | theThenExpr(thenExpr), | 99 | theThenExpr(thenExpr), |
39 | 103 | theElseExpr(elseExpr) | 100 | theElseExpr(elseExpr) |
40 | 104 | { | 101 | { |
41 | @@ -108,10 +105,13 @@ | |||
42 | 108 | *GENV_TYPESYSTEM.BOOLEAN_TYPE_ONE, | 105 | *GENV_TYPESYSTEM.BOOLEAN_TYPE_ONE, |
43 | 109 | loc)) | 106 | loc)) |
44 | 110 | { | 107 | { |
49 | 111 | fo_expr* boolExpr = theCCB->theEM->create_fo_expr(sctx, | 108 | fo_expr* boolExpr = theCCB->theEM-> |
50 | 112 | loc, | 109 | create_fo_expr(sctx, |
51 | 113 | GET_BUILTIN_FUNCTION(FN_BOOLEAN_1), | 110 | udf, |
52 | 114 | condExpr); | 111 | loc, |
53 | 112 | GET_BUILTIN_FUNCTION(FN_BOOLEAN_1), | ||
54 | 113 | condExpr); | ||
55 | 114 | |||
56 | 115 | condExpr = boolExpr; | 115 | condExpr = boolExpr; |
57 | 116 | } | 116 | } |
58 | 117 | 117 | ||
59 | @@ -166,27 +166,18 @@ | |||
60 | 166 | } | 166 | } |
61 | 167 | 167 | ||
62 | 168 | 168 | ||
63 | 169 | expr* if_expr::cloneImpl(substitution_t& subst) const | ||
64 | 170 | { | ||
65 | 171 | return theCCB->theEM->create_if_expr(theSctx, | ||
66 | 172 | get_loc(), | ||
67 | 173 | get_cond_expr()->clone(subst), | ||
68 | 174 | get_then_expr()->clone(subst), | ||
69 | 175 | get_else_expr()->clone(subst)); | ||
70 | 176 | } | ||
71 | 177 | |||
72 | 178 | |||
73 | 179 | /***************************************************************************//** | 169 | /***************************************************************************//** |
74 | 180 | 170 | ||
75 | 181 | ********************************************************************************/ | 171 | ********************************************************************************/ |
76 | 182 | order_expr::order_expr( | 172 | order_expr::order_expr( |
77 | 183 | CompilerCB* ccb, | 173 | CompilerCB* ccb, |
78 | 184 | static_context* sctx, | 174 | static_context* sctx, |
79 | 175 | user_function* udf, | ||
80 | 185 | const QueryLoc& loc, | 176 | const QueryLoc& loc, |
81 | 186 | order_type_t type, | 177 | order_type_t type, |
82 | 187 | expr* inExpr) | 178 | expr* inExpr) |
83 | 188 | : | 179 | : |
85 | 189 | expr(ccb, sctx, loc, order_expr_kind), | 180 | expr(ccb, sctx, udf, loc, order_expr_kind), |
86 | 190 | theType(type), | 181 | theType(type), |
87 | 191 | theExpr(inExpr) | 182 | theExpr(inExpr) |
88 | 192 | { | 183 | { |
89 | @@ -203,25 +194,20 @@ | |||
90 | 203 | } | 194 | } |
91 | 204 | 195 | ||
92 | 205 | 196 | ||
93 | 206 | expr* order_expr::cloneImpl(substitution_t& subst) const | ||
94 | 207 | { | ||
95 | 208 | return theCCB->theEM->create_order_expr(theSctx, get_loc(), get_type(), get_expr()->clone(subst)); | ||
96 | 209 | } | ||
97 | 210 | |||
98 | 211 | |||
99 | 212 | /***************************************************************************//** | 197 | /***************************************************************************//** |
100 | 213 | 198 | ||
101 | 214 | ********************************************************************************/ | 199 | ********************************************************************************/ |
102 | 215 | validate_expr::validate_expr( | 200 | validate_expr::validate_expr( |
103 | 216 | CompilerCB* ccb, | 201 | CompilerCB* ccb, |
104 | 217 | static_context* sctx, | 202 | static_context* sctx, |
105 | 203 | user_function* udf, | ||
106 | 218 | const QueryLoc& loc, | 204 | const QueryLoc& loc, |
107 | 219 | enum ParseConstants::validation_mode_t mode, | 205 | enum ParseConstants::validation_mode_t mode, |
108 | 220 | const store::Item_t& typeName, | 206 | const store::Item_t& typeName, |
109 | 221 | expr* inExpr, | 207 | expr* inExpr, |
110 | 222 | rchandle<TypeManager> typemgr) | 208 | rchandle<TypeManager> typemgr) |
111 | 223 | : | 209 | : |
113 | 224 | expr(ccb, sctx, loc, validate_expr_kind), | 210 | expr(ccb, sctx, udf, loc, validate_expr_kind), |
114 | 225 | theMode(mode), | 211 | theMode(mode), |
115 | 226 | theTypeName(typeName), | 212 | theTypeName(typeName), |
116 | 227 | theTypeMgr(typemgr), | 213 | theTypeMgr(typemgr), |
117 | @@ -242,16 +228,6 @@ | |||
118 | 242 | } | 228 | } |
119 | 243 | 229 | ||
120 | 244 | 230 | ||
121 | 245 | expr* validate_expr::cloneImpl(substitution_t& subst) const | ||
122 | 246 | { | ||
123 | 247 | return theCCB->theEM->create_validate_expr(theSctx, | ||
124 | 248 | get_loc(), | ||
125 | 249 | get_valmode(), | ||
126 | 250 | const_cast<store::Item*>(get_type_name()), | ||
127 | 251 | get_expr()->clone(subst), | ||
128 | 252 | get_typemgr()); | ||
129 | 253 | } | ||
130 | 254 | |||
131 | 255 | 231 | ||
132 | 256 | /***************************************************************************//** | 232 | /***************************************************************************//** |
133 | 257 | Base for expression classes that require a namespace context | 233 | Base for expression classes that require a namespace context |
134 | @@ -259,11 +235,12 @@ | |||
135 | 259 | namespace_context_base_expr::namespace_context_base_expr( | 235 | namespace_context_base_expr::namespace_context_base_expr( |
136 | 260 | CompilerCB* ccb, | 236 | CompilerCB* ccb, |
137 | 261 | static_context* sctx, | 237 | static_context* sctx, |
138 | 238 | user_function* udf, | ||
139 | 262 | const QueryLoc& loc, | 239 | const QueryLoc& loc, |
140 | 263 | expr_kind_t kind, | 240 | expr_kind_t kind, |
141 | 264 | const namespace_context* aNSCtx) | 241 | const namespace_context* aNSCtx) |
142 | 265 | : | 242 | : |
144 | 266 | expr(ccb, sctx, loc, kind), | 243 | expr(ccb, sctx, udf, loc, kind), |
145 | 267 | theNSCtx(const_cast<namespace_context*>(aNSCtx)) | 244 | theNSCtx(const_cast<namespace_context*>(aNSCtx)) |
146 | 268 | { | 245 | { |
147 | 269 | } | 246 | } |
148 | @@ -282,12 +259,13 @@ | |||
149 | 282 | cast_or_castable_base_expr::cast_or_castable_base_expr( | 259 | cast_or_castable_base_expr::cast_or_castable_base_expr( |
150 | 283 | CompilerCB* ccb, | 260 | CompilerCB* ccb, |
151 | 284 | static_context* sctx, | 261 | static_context* sctx, |
152 | 262 | user_function* udf, | ||
153 | 285 | const QueryLoc& loc, | 263 | const QueryLoc& loc, |
154 | 286 | expr_kind_t kind, | 264 | expr_kind_t kind, |
155 | 287 | expr* input, | 265 | expr* input, |
156 | 288 | const xqtref_t& type) | 266 | const xqtref_t& type) |
157 | 289 | : | 267 | : |
159 | 290 | expr(ccb, sctx, loc, kind), | 268 | expr(ccb, sctx, udf, loc, kind), |
160 | 291 | theInputExpr(input), | 269 | theInputExpr(input), |
161 | 292 | theTargetType(type) | 270 | theTargetType(type) |
162 | 293 | { | 271 | { |
163 | @@ -327,12 +305,13 @@ | |||
164 | 327 | cast_base_expr::cast_base_expr( | 305 | cast_base_expr::cast_base_expr( |
165 | 328 | CompilerCB* ccb, | 306 | CompilerCB* ccb, |
166 | 329 | static_context* sctx, | 307 | static_context* sctx, |
167 | 308 | user_function* udf, | ||
168 | 330 | const QueryLoc& loc, | 309 | const QueryLoc& loc, |
169 | 331 | expr_kind_t kind, | 310 | expr_kind_t kind, |
170 | 332 | expr* input, | 311 | expr* input, |
171 | 333 | const xqtref_t& type) | 312 | const xqtref_t& type) |
172 | 334 | : | 313 | : |
174 | 335 | cast_or_castable_base_expr(ccb, sctx, loc, kind, input, type) | 314 | cast_or_castable_base_expr(ccb, sctx, udf, loc, kind, input, type) |
175 | 336 | { | 315 | { |
176 | 337 | setNonDiscardable(ANNOTATION_TRUE_FIXED); | 316 | setNonDiscardable(ANNOTATION_TRUE_FIXED); |
177 | 338 | } | 317 | } |
178 | @@ -346,11 +325,12 @@ | |||
179 | 346 | cast_expr::cast_expr( | 325 | cast_expr::cast_expr( |
180 | 347 | CompilerCB* ccb, | 326 | CompilerCB* ccb, |
181 | 348 | static_context* sctx, | 327 | static_context* sctx, |
182 | 328 | user_function* udf, | ||
183 | 349 | const QueryLoc& loc, | 329 | const QueryLoc& loc, |
184 | 350 | expr* inputExpr, | 330 | expr* inputExpr, |
185 | 351 | const xqtref_t& type) | 331 | const xqtref_t& type) |
186 | 352 | : | 332 | : |
188 | 353 | cast_base_expr(ccb, sctx, loc, cast_expr_kind, inputExpr, type) | 333 | cast_base_expr(ccb, sctx, udf, loc, cast_expr_kind, inputExpr, type) |
189 | 354 | { | 334 | { |
190 | 355 | assert(type->get_quantifier() == TypeConstants::QUANT_ONE || | 335 | assert(type->get_quantifier() == TypeConstants::QUANT_ONE || |
191 | 356 | type->get_quantifier() == TypeConstants::QUANT_QUESTION); | 336 | type->get_quantifier() == TypeConstants::QUANT_QUESTION); |
192 | @@ -363,21 +343,13 @@ | |||
193 | 363 | } | 343 | } |
194 | 364 | 344 | ||
195 | 365 | 345 | ||
196 | 366 | expr* cast_expr::cloneImpl(substitution_t& subst) const | ||
197 | 367 | { | ||
198 | 368 | return theCCB->theEM->create_cast_expr(theSctx, | ||
199 | 369 | get_loc(), | ||
200 | 370 | get_input()->clone(subst), | ||
201 | 371 | get_target_type()); | ||
202 | 372 | } | ||
203 | 373 | |||
204 | 374 | |||
205 | 375 | /***************************************************************************//** | 346 | /***************************************************************************//** |
206 | 376 | TreatExpr ::= CastableExpr ( "treat" "as" SequenceType )? | 347 | TreatExpr ::= CastableExpr ( "treat" "as" SequenceType )? |
207 | 377 | ********************************************************************************/ | 348 | ********************************************************************************/ |
208 | 378 | treat_expr::treat_expr( | 349 | treat_expr::treat_expr( |
209 | 379 | CompilerCB* ccb, | 350 | CompilerCB* ccb, |
210 | 380 | static_context* sctx, | 351 | static_context* sctx, |
211 | 352 | user_function* udf, | ||
212 | 381 | const QueryLoc& loc, | 353 | const QueryLoc& loc, |
213 | 382 | expr* inputExpr, | 354 | expr* inputExpr, |
214 | 383 | const xqtref_t& type, | 355 | const xqtref_t& type, |
215 | @@ -385,7 +357,7 @@ | |||
216 | 385 | bool check_prime, | 357 | bool check_prime, |
217 | 386 | store::Item* qname) | 358 | store::Item* qname) |
218 | 387 | : | 359 | : |
220 | 388 | cast_base_expr(ccb, sctx, loc, treat_expr_kind, inputExpr, type), | 360 | cast_base_expr(ccb, sctx, udf, loc, treat_expr_kind, inputExpr, type), |
221 | 389 | theErrorKind(err), | 361 | theErrorKind(err), |
222 | 390 | theCheckPrime(check_prime), | 362 | theCheckPrime(check_prime), |
223 | 391 | theQName(qname) | 363 | theQName(qname) |
224 | @@ -393,31 +365,20 @@ | |||
225 | 393 | } | 365 | } |
226 | 394 | 366 | ||
227 | 395 | 367 | ||
228 | 396 | expr* treat_expr::cloneImpl(substitution_t& subst) const | ||
229 | 397 | { | ||
230 | 398 | return theCCB->theEM->create_treat_expr(theSctx, | ||
231 | 399 | get_loc(), | ||
232 | 400 | get_input()->clone(subst), | ||
233 | 401 | get_target_type(), | ||
234 | 402 | get_err(), | ||
235 | 403 | get_check_prime(), | ||
236 | 404 | get_qname()); | ||
237 | 405 | } | ||
238 | 406 | |||
239 | 407 | |||
240 | 408 | /***************************************************************************//** | 368 | /***************************************************************************//** |
241 | 409 | 369 | ||
242 | 410 | ********************************************************************************/ | 370 | ********************************************************************************/ |
243 | 411 | promote_expr::promote_expr( | 371 | promote_expr::promote_expr( |
244 | 412 | CompilerCB* ccb, | 372 | CompilerCB* ccb, |
245 | 413 | static_context* sctx, | 373 | static_context* sctx, |
246 | 374 | user_function* udf, | ||
247 | 414 | const QueryLoc& loc, | 375 | const QueryLoc& loc, |
248 | 415 | expr* input, | 376 | expr* input, |
249 | 416 | const xqtref_t& type, | 377 | const xqtref_t& type, |
250 | 417 | PromoteIterator::ErrorKind err, | 378 | PromoteIterator::ErrorKind err, |
251 | 418 | store::Item* qname) | 379 | store::Item* qname) |
252 | 419 | : | 380 | : |
254 | 420 | cast_base_expr(ccb, sctx, loc, promote_expr_kind, input, type), | 381 | cast_base_expr(ccb, sctx, udf, loc, promote_expr_kind, input, type), |
255 | 421 | theErrorKind(err), | 382 | theErrorKind(err), |
256 | 422 | theQName(qname) | 383 | theQName(qname) |
257 | 423 | { | 384 | { |
258 | @@ -427,29 +388,19 @@ | |||
259 | 427 | } | 388 | } |
260 | 428 | 389 | ||
261 | 429 | 390 | ||
262 | 430 | expr* promote_expr::cloneImpl(substitution_t& subst) const | ||
263 | 431 | { | ||
264 | 432 | return theCCB->theEM->create_promote_expr(theSctx, | ||
265 | 433 | get_loc(), | ||
266 | 434 | get_input()->clone(subst), | ||
267 | 435 | get_target_type(), | ||
268 | 436 | theErrorKind, | ||
269 | 437 | theQName.getp()); | ||
270 | 438 | } | ||
271 | 439 | |||
272 | 440 | |||
273 | 441 | /***************************************************************************//** | 391 | /***************************************************************************//** |
274 | 442 | Base for castable, instanceof | 392 | Base for castable, instanceof |
275 | 443 | ********************************************************************************/ | 393 | ********************************************************************************/ |
276 | 444 | castable_base_expr::castable_base_expr( | 394 | castable_base_expr::castable_base_expr( |
277 | 445 | CompilerCB* ccb, | 395 | CompilerCB* ccb, |
278 | 446 | static_context* sctx, | 396 | static_context* sctx, |
279 | 397 | user_function* udf, | ||
280 | 447 | const QueryLoc& loc, | 398 | const QueryLoc& loc, |
281 | 448 | expr_kind_t kind, | 399 | expr_kind_t kind, |
282 | 449 | expr* input, | 400 | expr* input, |
283 | 450 | const xqtref_t& type) | 401 | const xqtref_t& type) |
284 | 451 | : | 402 | : |
286 | 452 | cast_or_castable_base_expr(ccb, sctx, loc, kind, input, type) | 403 | cast_or_castable_base_expr(ccb, sctx, udf, loc, kind, input, type) |
287 | 453 | { | 404 | { |
288 | 454 | } | 405 | } |
289 | 455 | 406 | ||
290 | @@ -462,11 +413,12 @@ | |||
291 | 462 | castable_expr::castable_expr( | 413 | castable_expr::castable_expr( |
292 | 463 | CompilerCB* ccb, | 414 | CompilerCB* ccb, |
293 | 464 | static_context* sctx, | 415 | static_context* sctx, |
294 | 416 | user_function* udf, | ||
295 | 465 | const QueryLoc& loc, | 417 | const QueryLoc& loc, |
296 | 466 | expr* inputExpr, | 418 | expr* inputExpr, |
297 | 467 | const xqtref_t& type) | 419 | const xqtref_t& type) |
298 | 468 | : | 420 | : |
300 | 469 | castable_base_expr (ccb, sctx, loc, castable_expr_kind, inputExpr, type) | 421 | castable_base_expr(ccb, sctx, udf, loc, castable_expr_kind, inputExpr, type) |
301 | 470 | { | 422 | { |
302 | 471 | } | 423 | } |
303 | 472 | 424 | ||
304 | @@ -477,53 +429,37 @@ | |||
305 | 477 | } | 429 | } |
306 | 478 | 430 | ||
307 | 479 | 431 | ||
308 | 480 | expr* castable_expr::cloneImpl(substitution_t& subst) const | ||
309 | 481 | { | ||
310 | 482 | return theCCB->theEM->create_castable_expr(theSctx, | ||
311 | 483 | get_loc(), | ||
312 | 484 | get_input()->clone(subst), | ||
313 | 485 | get_target_type()); | ||
314 | 486 | } | ||
315 | 487 | |||
316 | 488 | |||
317 | 489 | /***************************************************************************//** | 432 | /***************************************************************************//** |
318 | 490 | InstanceofExpr ::= TreatExpr ( "instance" "of" SequenceType )? | 433 | InstanceofExpr ::= TreatExpr ( "instance" "of" SequenceType )? |
319 | 491 | ********************************************************************************/ | 434 | ********************************************************************************/ |
320 | 492 | instanceof_expr::instanceof_expr( | 435 | instanceof_expr::instanceof_expr( |
321 | 493 | CompilerCB* ccb, | 436 | CompilerCB* ccb, |
322 | 494 | static_context* sctx, | 437 | static_context* sctx, |
323 | 438 | user_function* udf, | ||
324 | 495 | const QueryLoc& loc, | 439 | const QueryLoc& loc, |
325 | 496 | expr* inputExpr, | 440 | expr* inputExpr, |
326 | 497 | const xqtref_t& type, | 441 | const xqtref_t& type, |
327 | 498 | bool checkPrimeOnly) | 442 | bool checkPrimeOnly) |
328 | 499 | : | 443 | : |
330 | 500 | castable_base_expr(ccb, sctx, loc, instanceof_expr_kind, inputExpr, type), | 444 | castable_base_expr(ccb, sctx, udf, loc, instanceof_expr_kind, inputExpr, type), |
331 | 501 | theCheckPrimeOnly(checkPrimeOnly) | 445 | theCheckPrimeOnly(checkPrimeOnly) |
332 | 502 | { | 446 | { |
333 | 503 | } | 447 | } |
334 | 504 | 448 | ||
335 | 505 | 449 | ||
336 | 506 | expr* instanceof_expr::cloneImpl(substitution_t& subst) const | ||
337 | 507 | { | ||
338 | 508 | return theCCB->theEM->create_instanceof_expr(theSctx, | ||
339 | 509 | get_loc(), | ||
340 | 510 | get_input()->clone(subst), | ||
341 | 511 | get_target_type()); | ||
342 | 512 | } | ||
343 | 513 | |||
344 | 514 | |||
345 | 515 | /***************************************************************************//** | 450 | /***************************************************************************//** |
346 | 516 | 451 | ||
347 | 517 | ********************************************************************************/ | 452 | ********************************************************************************/ |
348 | 518 | name_cast_expr::name_cast_expr( | 453 | name_cast_expr::name_cast_expr( |
349 | 519 | CompilerCB* ccb, | 454 | CompilerCB* ccb, |
350 | 520 | static_context* sctx, | 455 | static_context* sctx, |
351 | 456 | user_function* udf, | ||
352 | 521 | const QueryLoc& loc, | 457 | const QueryLoc& loc, |
353 | 522 | expr* inputExpr, | 458 | expr* inputExpr, |
354 | 523 | const namespace_context* aNSCtx, | 459 | const namespace_context* aNSCtx, |
355 | 524 | bool isAttrName) | 460 | bool isAttrName) |
356 | 525 | : | 461 | : |
358 | 526 | namespace_context_base_expr(ccb, sctx, loc, name_cast_expr_kind, aNSCtx), | 462 | namespace_context_base_expr(ccb, sctx, udf, loc, name_cast_expr_kind, aNSCtx), |
359 | 527 | theInputExpr(inputExpr), | 463 | theInputExpr(inputExpr), |
360 | 528 | theIsAttrName(isAttrName) | 464 | theIsAttrName(isAttrName) |
361 | 529 | { | 465 | { |
362 | @@ -542,27 +478,18 @@ | |||
363 | 542 | } | 478 | } |
364 | 543 | 479 | ||
365 | 544 | 480 | ||
366 | 545 | expr* name_cast_expr::cloneImpl(substitution_t& subst) const | ||
367 | 546 | { | ||
368 | 547 | return theCCB->theEM->create_name_cast_expr(theSctx, | ||
369 | 548 | get_loc(), | ||
370 | 549 | get_input()->clone(subst), | ||
371 | 550 | getNSCtx(), | ||
372 | 551 | theIsAttrName); | ||
373 | 552 | } | ||
374 | 553 | |||
375 | 554 | |||
376 | 555 | /***************************************************************************//** | 481 | /***************************************************************************//** |
377 | 556 | CompDocConstructor ::= "document" "{" Expr "}" | 482 | CompDocConstructor ::= "document" "{" Expr "}" |
378 | 557 | ********************************************************************************/ | 483 | ********************************************************************************/ |
379 | 558 | doc_expr::doc_expr( | 484 | doc_expr::doc_expr( |
380 | 559 | CompilerCB* ccb, | 485 | CompilerCB* ccb, |
381 | 560 | static_context* sctx, | 486 | static_context* sctx, |
382 | 487 | user_function* udf, | ||
383 | 561 | const QueryLoc& loc, | 488 | const QueryLoc& loc, |
384 | 562 | expr* aContent, | 489 | expr* aContent, |
385 | 563 | bool copyNodes) | 490 | bool copyNodes) |
386 | 564 | : | 491 | : |
388 | 565 | expr(ccb, sctx, loc, doc_expr_kind), | 492 | expr(ccb, sctx, udf, loc, doc_expr_kind), |
389 | 566 | theContent(aContent), | 493 | theContent(aContent), |
390 | 567 | theCopyInputNodes(copyNodes) | 494 | theCopyInputNodes(copyNodes) |
391 | 568 | { | 495 | { |
392 | @@ -581,22 +508,13 @@ | |||
393 | 581 | } | 508 | } |
394 | 582 | 509 | ||
395 | 583 | 510 | ||
396 | 584 | expr* doc_expr::cloneImpl(substitution_t& subst) const | ||
397 | 585 | { | ||
398 | 586 | doc_expr* clone = theCCB->theEM->create_doc_expr(theSctx, | ||
399 | 587 | get_loc(), | ||
400 | 588 | CLONE(getContent(), subst), | ||
401 | 589 | theCopyInputNodes); | ||
402 | 590 | return clone; | ||
403 | 591 | } | ||
404 | 592 | |||
405 | 593 | |||
406 | 594 | /***************************************************************************//** | 511 | /***************************************************************************//** |
407 | 595 | 512 | ||
408 | 596 | ********************************************************************************/ | 513 | ********************************************************************************/ |
409 | 597 | elem_expr::elem_expr( | 514 | elem_expr::elem_expr( |
410 | 598 | CompilerCB* ccb, | 515 | CompilerCB* ccb, |
411 | 599 | static_context* sctx, | 516 | static_context* sctx, |
412 | 517 | user_function* udf, | ||
413 | 600 | const QueryLoc& aLoc, | 518 | const QueryLoc& aLoc, |
414 | 601 | expr* aQNameExpr, | 519 | expr* aQNameExpr, |
415 | 602 | expr* attrs, | 520 | expr* attrs, |
416 | @@ -604,7 +522,7 @@ | |||
417 | 604 | const namespace_context* aNSCtx, | 522 | const namespace_context* aNSCtx, |
418 | 605 | bool copyNodes) | 523 | bool copyNodes) |
419 | 606 | : | 524 | : |
421 | 607 | namespace_context_base_expr(ccb, sctx, aLoc, elem_expr_kind, aNSCtx), | 525 | namespace_context_base_expr(ccb, sctx, udf, aLoc, elem_expr_kind, aNSCtx), |
422 | 608 | theQNameExpr(aQNameExpr), | 526 | theQNameExpr(aQNameExpr), |
423 | 609 | theAttrs(attrs), | 527 | theAttrs(attrs), |
424 | 610 | theContent(content), | 528 | theContent(content), |
425 | @@ -619,13 +537,14 @@ | |||
426 | 619 | elem_expr::elem_expr( | 537 | elem_expr::elem_expr( |
427 | 620 | CompilerCB* ccb, | 538 | CompilerCB* ccb, |
428 | 621 | static_context* sctx, | 539 | static_context* sctx, |
429 | 540 | user_function* udf, | ||
430 | 622 | const QueryLoc& aLoc, | 541 | const QueryLoc& aLoc, |
431 | 623 | expr* aQNameExpr, | 542 | expr* aQNameExpr, |
432 | 624 | expr* content, | 543 | expr* content, |
433 | 625 | const namespace_context* aNSCtx, | 544 | const namespace_context* aNSCtx, |
434 | 626 | bool copyNodes) | 545 | bool copyNodes) |
435 | 627 | : | 546 | : |
437 | 628 | namespace_context_base_expr(ccb, sctx, aLoc, elem_expr_kind, aNSCtx), | 547 | namespace_context_base_expr(ccb, sctx, udf, aLoc, elem_expr_kind, aNSCtx), |
438 | 629 | theQNameExpr(aQNameExpr), | 548 | theQNameExpr(aQNameExpr), |
439 | 630 | theAttrs(0), | 549 | theAttrs(0), |
440 | 631 | theContent(content), | 550 | theContent(content), |
441 | @@ -663,30 +582,18 @@ | |||
442 | 663 | } | 582 | } |
443 | 664 | 583 | ||
444 | 665 | 584 | ||
445 | 666 | expr* elem_expr::cloneImpl(substitution_t& subst) const | ||
446 | 667 | { | ||
447 | 668 | elem_expr* clone = theCCB->theEM->create_elem_expr(theSctx, | ||
448 | 669 | get_loc(), | ||
449 | 670 | CLONE(getQNameExpr(), subst), | ||
450 | 671 | CLONE(getAttrs(), subst), | ||
451 | 672 | CLONE(getContent(), subst), | ||
452 | 673 | getNSCtx(), | ||
453 | 674 | theCopyInputNodes); | ||
454 | 675 | return clone; | ||
455 | 676 | } | ||
456 | 677 | |||
457 | 678 | |||
458 | 679 | /***************************************************************************//** | 585 | /***************************************************************************//** |
459 | 680 | 586 | ||
460 | 681 | ********************************************************************************/ | 587 | ********************************************************************************/ |
461 | 682 | attr_expr::attr_expr( | 588 | attr_expr::attr_expr( |
462 | 683 | CompilerCB* ccb, | 589 | CompilerCB* ccb, |
463 | 684 | static_context* sctx, | 590 | static_context* sctx, |
464 | 591 | user_function* udf, | ||
465 | 685 | const QueryLoc& loc, | 592 | const QueryLoc& loc, |
466 | 686 | expr* aQNameExpr, | 593 | expr* aQNameExpr, |
467 | 687 | expr* aValueExpr) | 594 | expr* aValueExpr) |
468 | 688 | : | 595 | : |
470 | 689 | expr(ccb, sctx, loc, attr_expr_kind), | 596 | expr(ccb, sctx, udf, loc, attr_expr_kind), |
471 | 690 | theQNameExpr(aQNameExpr), | 597 | theQNameExpr(aQNameExpr), |
472 | 691 | theValueExpr(aValueExpr) | 598 | theValueExpr(aValueExpr) |
473 | 692 | { | 599 | { |
474 | @@ -730,15 +637,6 @@ | |||
475 | 730 | } | 637 | } |
476 | 731 | 638 | ||
477 | 732 | 639 | ||
478 | 733 | expr* attr_expr::cloneImpl(substitution_t& subst) const | ||
479 | 734 | { | ||
480 | 735 | return theCCB->theEM->create_attr_expr(theSctx, | ||
481 | 736 | get_loc(), | ||
482 | 737 | CLONE(getQNameExpr(), subst), | ||
483 | 738 | CLONE(getValueExpr(), subst)); | ||
484 | 739 | } | ||
485 | 740 | |||
486 | 741 | |||
487 | 742 | DEF_EXPR_ACCEPT(attr_expr) | 640 | DEF_EXPR_ACCEPT(attr_expr) |
488 | 743 | 641 | ||
489 | 744 | 642 | ||
490 | @@ -748,11 +646,12 @@ | |||
491 | 748 | text_expr::text_expr( | 646 | text_expr::text_expr( |
492 | 749 | CompilerCB* ccb, | 647 | CompilerCB* ccb, |
493 | 750 | static_context* sctx, | 648 | static_context* sctx, |
494 | 649 | user_function* udf, | ||
495 | 751 | const QueryLoc& loc, | 650 | const QueryLoc& loc, |
496 | 752 | text_constructor_type type_arg, | 651 | text_constructor_type type_arg, |
497 | 753 | expr* content) | 652 | expr* content) |
498 | 754 | : | 653 | : |
500 | 755 | expr(ccb, sctx, loc, text_expr_kind), | 654 | expr(ccb, sctx, udf, loc, text_expr_kind), |
501 | 756 | type(type_arg), | 655 | type(type_arg), |
502 | 757 | theContentExpr(content) | 656 | theContentExpr(content) |
503 | 758 | { | 657 | { |
504 | @@ -773,23 +672,18 @@ | |||
505 | 773 | } | 672 | } |
506 | 774 | 673 | ||
507 | 775 | 674 | ||
508 | 776 | expr* text_expr::cloneImpl(substitution_t& subst) const | ||
509 | 777 | { | ||
510 | 778 | return theCCB->theEM->create_text_expr(theSctx, get_loc(), get_type(), CLONE(get_text(), subst)); | ||
511 | 779 | } | ||
512 | 780 | |||
513 | 781 | |||
514 | 782 | /***************************************************************************//** | 675 | /***************************************************************************//** |
515 | 783 | 676 | ||
516 | 784 | ********************************************************************************/ | 677 | ********************************************************************************/ |
517 | 785 | pi_expr::pi_expr( | 678 | pi_expr::pi_expr( |
518 | 786 | CompilerCB* ccb, | 679 | CompilerCB* ccb, |
519 | 787 | static_context* sctx, | 680 | static_context* sctx, |
520 | 681 | user_function* udf, | ||
521 | 788 | const QueryLoc& loc, | 682 | const QueryLoc& loc, |
522 | 789 | expr* targetExpr, | 683 | expr* targetExpr, |
523 | 790 | expr* contentExpr) | 684 | expr* contentExpr) |
524 | 791 | : | 685 | : |
526 | 792 | expr(ccb, sctx, loc, pi_expr_kind), | 686 | expr(ccb, sctx, udf, loc, pi_expr_kind), |
527 | 793 | theTargetExpr(targetExpr), | 687 | theTargetExpr(targetExpr), |
528 | 794 | theContentExpr(contentExpr) | 688 | theContentExpr(contentExpr) |
529 | 795 | { | 689 | { |
530 | @@ -823,23 +717,18 @@ | |||
531 | 823 | } | 717 | } |
532 | 824 | 718 | ||
533 | 825 | 719 | ||
534 | 826 | expr* pi_expr::cloneImpl(substitution_t& subst) const | ||
535 | 827 | { | ||
536 | 828 | return theCCB->theEM->create_pi_expr(theSctx, | ||
537 | 829 | get_loc(), | ||
538 | 830 | CLONE(get_target_expr(), subst), | ||
539 | 831 | CLONE(get_content_expr(), subst)); | ||
540 | 832 | } | ||
541 | 833 | |||
542 | 834 | |||
543 | 835 | |||
544 | 836 | /******************************************************************************* | 720 | /******************************************************************************* |
545 | 837 | Normally, it is used to wrap a var_expr in order to represent a var reference | 721 | Normally, it is used to wrap a var_expr in order to represent a var reference |
546 | 838 | (see var_expr.h). But it may wrap any other kind of expr as well. | 722 | (see var_expr.h). But it may wrap any other kind of expr as well. |
547 | 839 | ********************************************************************************/ | 723 | ********************************************************************************/ |
549 | 840 | wrapper_expr::wrapper_expr(CompilerCB* ccb, static_context* sctx, const QueryLoc& loc, expr* wrapped) | 724 | wrapper_expr::wrapper_expr( |
550 | 725 | CompilerCB* ccb, | ||
551 | 726 | static_context* sctx, | ||
552 | 727 | user_function* udf, | ||
553 | 728 | const QueryLoc& loc, | ||
554 | 729 | expr* wrapped) | ||
555 | 841 | : | 730 | : |
557 | 842 | expr(ccb, sctx, loc, wrapper_expr_kind), | 731 | expr(ccb, sctx, udf, loc, wrapper_expr_kind), |
558 | 843 | theWrappedExpr(wrapped) | 732 | theWrappedExpr(wrapped) |
559 | 844 | { | 733 | { |
560 | 845 | compute_scripting_kind(); | 734 | compute_scripting_kind(); |
561 | @@ -852,77 +741,89 @@ | |||
562 | 852 | } | 741 | } |
563 | 853 | 742 | ||
564 | 854 | 743 | ||
565 | 855 | expr* wrapper_expr::cloneImpl(substitution_t& subst) const | ||
566 | 856 | { | ||
567 | 857 | expr* e = theWrappedExpr->clone(subst); | ||
568 | 858 | |||
569 | 859 | if (theWrappedExpr->get_expr_kind() == var_expr_kind && | ||
570 | 860 | e->get_expr_kind() != var_expr_kind) | ||
571 | 861 | return e; | ||
572 | 862 | else | ||
573 | 863 | return theCCB->theEM->create_wrapper_expr(theSctx, get_loc(), e); | ||
574 | 864 | } | ||
575 | 865 | |||
576 | 866 | |||
577 | 867 | /***************************************************************************//** | 744 | /***************************************************************************//** |
578 | 868 | 745 | ||
579 | 869 | ********************************************************************************/ | 746 | ********************************************************************************/ |
581 | 870 | const_expr::const_expr(CompilerCB* ccb, static_context* sctx, const QueryLoc& loc, zstring& v) | 747 | const_expr::const_expr( |
582 | 748 | CompilerCB* ccb, | ||
583 | 749 | static_context* sctx, | ||
584 | 750 | user_function* udf, | ||
585 | 751 | const QueryLoc& loc, | ||
586 | 752 | zstring& v) | ||
587 | 871 | : | 753 | : |
589 | 872 | expr(ccb, sctx, loc, const_expr_kind) | 754 | expr(ccb, sctx, udf, loc, const_expr_kind) |
590 | 873 | { | 755 | { |
591 | 874 | GENV_ITEMFACTORY->createString(theValue, v); | 756 | GENV_ITEMFACTORY->createString(theValue, v); |
592 | 875 | theScriptingKind = SIMPLE_EXPR; | 757 | theScriptingKind = SIMPLE_EXPR; |
593 | 876 | } | 758 | } |
594 | 877 | 759 | ||
595 | 878 | 760 | ||
619 | 879 | const_expr::const_expr(CompilerCB* ccb, static_context* sctx, const QueryLoc& loc, const std::string& v) | 761 | const_expr::const_expr( |
620 | 880 | : | 762 | CompilerCB* ccb, |
621 | 881 | expr(ccb, sctx, loc, const_expr_kind) | 763 | static_context* sctx, |
622 | 882 | { | 764 | user_function* udf, |
623 | 883 | zstring tmp(v); | 765 | const QueryLoc& loc, |
624 | 884 | GENV_ITEMFACTORY->createString(theValue, tmp); | 766 | const std::string& v) |
625 | 885 | theScriptingKind = SIMPLE_EXPR; | 767 | : |
626 | 886 | } | 768 | expr(ccb, sctx, udf, loc, const_expr_kind) |
627 | 887 | 769 | { | |
628 | 888 | 770 | zstring tmp(v); | |
629 | 889 | const_expr::const_expr(CompilerCB* ccb, static_context* sctx, const QueryLoc& loc, const char* v) | 771 | GENV_ITEMFACTORY->createString(theValue, tmp); |
630 | 890 | : | 772 | theScriptingKind = SIMPLE_EXPR; |
631 | 891 | expr(ccb, sctx, loc, const_expr_kind) | 773 | } |
632 | 892 | { | 774 | |
633 | 893 | zstring tmp(v); | 775 | |
634 | 894 | GENV_ITEMFACTORY->createString(theValue, tmp); | 776 | const_expr::const_expr( |
635 | 895 | theScriptingKind = SIMPLE_EXPR; | 777 | CompilerCB* ccb, |
636 | 896 | } | 778 | static_context* sctx, |
637 | 897 | 779 | user_function* udf, | |
638 | 898 | 780 | const QueryLoc& loc, | |
639 | 899 | const_expr::const_expr(CompilerCB* ccb, static_context* sctx, const QueryLoc& loc, xs_integer v) | 781 | const char* v) |
640 | 900 | : | 782 | : |
641 | 901 | expr(ccb, sctx, loc, const_expr_kind) | 783 | expr(ccb, sctx, udf, loc, const_expr_kind) |
642 | 784 | { | ||
643 | 785 | zstring tmp(v); | ||
644 | 786 | GENV_ITEMFACTORY->createString(theValue, tmp); | ||
645 | 787 | theScriptingKind = SIMPLE_EXPR; | ||
646 | 788 | } | ||
647 | 789 | |||
648 | 790 | |||
649 | 791 | const_expr::const_expr( | ||
650 | 792 | CompilerCB* ccb, | ||
651 | 793 | static_context* sctx, | ||
652 | 794 | user_function* udf, | ||
653 | 795 | const QueryLoc& loc, | ||
654 | 796 | xs_integer v) | ||
655 | 797 | : | ||
656 | 798 | expr(ccb, sctx, udf, loc, const_expr_kind) | ||
657 | 902 | { | 799 | { |
658 | 903 | GENV_ITEMFACTORY->createInteger(theValue, v); | 800 | GENV_ITEMFACTORY->createInteger(theValue, v); |
659 | 904 | theScriptingKind = SIMPLE_EXPR; | 801 | theScriptingKind = SIMPLE_EXPR; |
660 | 905 | } | 802 | } |
661 | 906 | 803 | ||
662 | 804 | |||
663 | 907 | const_expr::const_expr( | 805 | const_expr::const_expr( |
664 | 908 | CompilerCB* ccb, | 806 | CompilerCB* ccb, |
665 | 909 | static_context* sctx, | 807 | static_context* sctx, |
666 | 808 | user_function* udf, | ||
667 | 910 | const QueryLoc& loc, | 809 | const QueryLoc& loc, |
668 | 911 | xs_decimal v) | 810 | xs_decimal v) |
669 | 912 | : | 811 | : |
671 | 913 | expr(ccb, sctx, loc, const_expr_kind) | 812 | expr(ccb, sctx, udf, loc, const_expr_kind) |
672 | 914 | { | 813 | { |
673 | 915 | GENV_ITEMFACTORY->createDecimal(theValue, v); | 814 | GENV_ITEMFACTORY->createDecimal(theValue, v); |
674 | 916 | theScriptingKind = SIMPLE_EXPR; | 815 | theScriptingKind = SIMPLE_EXPR; |
675 | 917 | } | 816 | } |
676 | 918 | 817 | ||
677 | 818 | |||
678 | 919 | const_expr::const_expr( | 819 | const_expr::const_expr( |
679 | 920 | CompilerCB* ccb, | 820 | CompilerCB* ccb, |
680 | 921 | static_context* sctx, | 821 | static_context* sctx, |
681 | 822 | user_function* udf, | ||
682 | 922 | const QueryLoc& loc, | 823 | const QueryLoc& loc, |
683 | 923 | xs_double v) | 824 | xs_double v) |
684 | 924 | : | 825 | : |
686 | 925 | expr(ccb, sctx, loc, const_expr_kind) | 826 | expr(ccb, sctx, udf, loc, const_expr_kind) |
687 | 926 | { | 827 | { |
688 | 927 | GENV_ITEMFACTORY->createDouble(theValue, v); | 828 | GENV_ITEMFACTORY->createDouble(theValue, v); |
689 | 928 | theScriptingKind = SIMPLE_EXPR; | 829 | theScriptingKind = SIMPLE_EXPR; |
690 | @@ -932,10 +833,11 @@ | |||
691 | 932 | const_expr::const_expr( | 833 | const_expr::const_expr( |
692 | 933 | CompilerCB* ccb, | 834 | CompilerCB* ccb, |
693 | 934 | static_context* sctx, | 835 | static_context* sctx, |
694 | 836 | user_function* udf, | ||
695 | 935 | const QueryLoc& loc, | 837 | const QueryLoc& loc, |
696 | 936 | xs_boolean v) | 838 | xs_boolean v) |
697 | 937 | : | 839 | : |
699 | 938 | expr(ccb, sctx, loc, const_expr_kind) | 840 | expr(ccb, sctx, udf, loc, const_expr_kind) |
700 | 939 | { | 841 | { |
701 | 940 | GENV_ITEMFACTORY->createBoolean(theValue, v); | 842 | GENV_ITEMFACTORY->createBoolean(theValue, v); |
702 | 941 | theScriptingKind = SIMPLE_EXPR; | 843 | theScriptingKind = SIMPLE_EXPR; |
703 | @@ -945,10 +847,11 @@ | |||
704 | 945 | const_expr::const_expr( | 847 | const_expr::const_expr( |
705 | 946 | CompilerCB* ccb, | 848 | CompilerCB* ccb, |
706 | 947 | static_context* sctx, | 849 | static_context* sctx, |
707 | 850 | user_function* udf, | ||
708 | 948 | const QueryLoc& loc, | 851 | const QueryLoc& loc, |
709 | 949 | const store::Item_t& v) | 852 | const store::Item_t& v) |
710 | 950 | : | 853 | : |
712 | 951 | expr(ccb, sctx, loc, const_expr_kind), | 854 | expr(ccb, sctx, udf, loc, const_expr_kind), |
713 | 952 | theValue(v) | 855 | theValue(v) |
714 | 953 | { | 856 | { |
715 | 954 | theScriptingKind = SIMPLE_EXPR; | 857 | theScriptingKind = SIMPLE_EXPR; |
716 | @@ -958,12 +861,13 @@ | |||
717 | 958 | const_expr::const_expr( | 861 | const_expr::const_expr( |
718 | 959 | CompilerCB* ccb, | 862 | CompilerCB* ccb, |
719 | 960 | static_context* sctx, | 863 | static_context* sctx, |
720 | 864 | user_function* udf, | ||
721 | 961 | const QueryLoc& aLoc, | 865 | const QueryLoc& aLoc, |
722 | 962 | const char* aNamespace, | 866 | const char* aNamespace, |
723 | 963 | const char* aPrefix, | 867 | const char* aPrefix, |
724 | 964 | const char* aLocal) | 868 | const char* aLocal) |
725 | 965 | : | 869 | : |
727 | 966 | expr(ccb, sctx, aLoc, const_expr_kind) | 870 | expr(ccb, sctx, udf, aLoc, const_expr_kind) |
728 | 967 | { | 871 | { |
729 | 968 | GENV_ITEMFACTORY->createQName(theValue, aNamespace, aPrefix, aLocal); | 872 | GENV_ITEMFACTORY->createQName(theValue, aNamespace, aPrefix, aLocal); |
730 | 969 | theScriptingKind = SIMPLE_EXPR; | 873 | theScriptingKind = SIMPLE_EXPR; |
731 | @@ -976,21 +880,16 @@ | |||
732 | 976 | } | 880 | } |
733 | 977 | 881 | ||
734 | 978 | 882 | ||
735 | 979 | expr* const_expr::cloneImpl(substitution_t&) const | ||
736 | 980 | { | ||
737 | 981 | return theCCB->theEM->create_const_expr(theSctx, get_loc(), theValue); | ||
738 | 982 | } | ||
739 | 983 | |||
740 | 984 | |||
741 | 985 | /******************************************************************************* | 883 | /******************************************************************************* |
742 | 986 | 884 | ||
743 | 987 | ********************************************************************************/ | 885 | ********************************************************************************/ |
744 | 988 | extension_expr::extension_expr( | 886 | extension_expr::extension_expr( |
745 | 989 | CompilerCB* ccb, | 887 | CompilerCB* ccb, |
746 | 990 | static_context* sctx, | 888 | static_context* sctx, |
747 | 889 | user_function* udf, | ||
748 | 991 | const QueryLoc& loc) | 890 | const QueryLoc& loc) |
749 | 992 | : | 891 | : |
751 | 993 | expr(ccb, sctx, loc, extension_expr_kind) | 892 | expr(ccb, sctx, udf, loc, extension_expr_kind) |
752 | 994 | { | 893 | { |
753 | 995 | compute_scripting_kind(); | 894 | compute_scripting_kind(); |
754 | 996 | } | 895 | } |
755 | @@ -999,10 +898,11 @@ | |||
756 | 999 | extension_expr::extension_expr( | 898 | extension_expr::extension_expr( |
757 | 1000 | CompilerCB* ccb, | 899 | CompilerCB* ccb, |
758 | 1001 | static_context* sctx, | 900 | static_context* sctx, |
759 | 901 | user_function* udf, | ||
760 | 1002 | const QueryLoc& loc, | 902 | const QueryLoc& loc, |
761 | 1003 | expr* e) | 903 | expr* e) |
762 | 1004 | : | 904 | : |
764 | 1005 | expr(ccb, sctx, loc, extension_expr_kind), | 905 | expr(ccb, sctx, udf, loc, extension_expr_kind), |
765 | 1006 | theExpr(e) | 906 | theExpr(e) |
766 | 1007 | { | 907 | { |
767 | 1008 | compute_scripting_kind(); | 908 | compute_scripting_kind(); |
768 | @@ -1020,23 +920,6 @@ | |||
769 | 1020 | } | 920 | } |
770 | 1021 | 921 | ||
771 | 1022 | 922 | ||
772 | 1023 | expr* extension_expr::cloneImpl(substitution_t& subst) const | ||
773 | 1024 | { | ||
774 | 1025 | extension_expr* lClone(0); | ||
775 | 1026 | lClone = ( | ||
776 | 1027 | theExpr == 0 ? theCCB->theEM->create_extension_expr(theSctx, get_loc()) | ||
777 | 1028 | : theCCB->theEM->create_extension_expr(theSctx, get_loc(), theExpr->clone()) ); | ||
778 | 1029 | // pragm doesn't contain expressions. Thus, it is not cloned. | ||
779 | 1030 | for ( std::vector<pragma*>::const_iterator lIter = thePragmas.begin(); | ||
780 | 1031 | lIter != thePragmas.end(); | ||
781 | 1032 | ++lIter ) | ||
782 | 1033 | { | ||
783 | 1034 | lClone->add(*lIter); | ||
784 | 1035 | } | ||
785 | 1036 | return lClone; | ||
786 | 1037 | } | ||
787 | 1038 | |||
788 | 1039 | |||
789 | 1040 | ///////////////////////////////////////////////////////////////////////// | 923 | ///////////////////////////////////////////////////////////////////////// |
790 | 1041 | // // | 924 | // // |
791 | 1042 | // XQuery 3.0 expressions // | 925 | // XQuery 3.0 expressions // |
792 | @@ -1049,7 +932,8 @@ | |||
793 | 1049 | 932 | ||
794 | 1050 | ********************************************************************************/ | 933 | ********************************************************************************/ |
795 | 1051 | catch_clause::catch_clause(CompilerCB* ccb) | 934 | catch_clause::catch_clause(CompilerCB* ccb) |
797 | 1052 | :theCCB(ccb) | 935 | : |
798 | 936 | theCCB(ccb) | ||
799 | 1053 | { | 937 | { |
800 | 1054 | } | 938 | } |
801 | 1055 | 939 | ||
802 | @@ -1057,10 +941,11 @@ | |||
803 | 1057 | trycatch_expr::trycatch_expr( | 941 | trycatch_expr::trycatch_expr( |
804 | 1058 | CompilerCB* ccb, | 942 | CompilerCB* ccb, |
805 | 1059 | static_context* sctx, | 943 | static_context* sctx, |
806 | 944 | user_function* udf, | ||
807 | 1060 | const QueryLoc& loc, | 945 | const QueryLoc& loc, |
808 | 1061 | expr* tryExpr) | 946 | expr* tryExpr) |
809 | 1062 | : | 947 | : |
811 | 1063 | expr(ccb, sctx, loc, trycatch_expr_kind), | 948 | expr(ccb, sctx, udf, loc, trycatch_expr_kind), |
812 | 1064 | theTryExpr(tryExpr) | 949 | theTryExpr(tryExpr) |
813 | 1065 | { | 950 | { |
814 | 1066 | compute_scripting_kind(); | 951 | compute_scripting_kind(); |
815 | @@ -1145,6 +1030,7 @@ | |||
816 | 1145 | { | 1030 | { |
817 | 1146 | lClause->add_nametest_h(lIter->getp()); | 1031 | lClause->add_nametest_h(lIter->getp()); |
818 | 1147 | } | 1032 | } |
819 | 1033 | |||
820 | 1148 | for (var_map_t::const_iterator lIter = theVarMap.begin(); | 1034 | for (var_map_t::const_iterator lIter = theVarMap.begin(); |
821 | 1149 | lIter != theVarMap.end(); | 1035 | lIter != theVarMap.end(); |
822 | 1150 | ++lIter) | 1036 | ++lIter) |
823 | @@ -1156,39 +1042,19 @@ | |||
824 | 1156 | } | 1042 | } |
825 | 1157 | 1043 | ||
826 | 1158 | 1044 | ||
827 | 1159 | expr* trycatch_expr::cloneImpl(substitution_t& subst) const | ||
828 | 1160 | { | ||
829 | 1161 | std::auto_ptr<trycatch_expr> lTryCatch( | ||
830 | 1162 | theCCB->theEM->create_trycatch_expr(theSctx, get_loc(), theTryExpr->clone(subst))); | ||
831 | 1163 | |||
832 | 1164 | for (std::vector<expr*>::const_iterator lIter = theCatchExprs.begin(); | ||
833 | 1165 | lIter != theCatchExprs.end(); | ||
834 | 1166 | ++lIter) | ||
835 | 1167 | { | ||
836 | 1168 | lTryCatch->add_catch_expr((*lIter)->clone(subst)); | ||
837 | 1169 | } | ||
838 | 1170 | |||
839 | 1171 | for (csize i = 0; i < clause_count(); ++i) | ||
840 | 1172 | { | ||
841 | 1173 | lTryCatch->add_clause(theCatchClauses[i]->clone(subst)); | ||
842 | 1174 | } | ||
843 | 1175 | |||
844 | 1176 | return lTryCatch.release(); | ||
845 | 1177 | } | ||
846 | 1178 | |||
847 | 1179 | |||
848 | 1180 | /******************************************************************************* | 1045 | /******************************************************************************* |
849 | 1181 | 1046 | ||
850 | 1182 | ********************************************************************************/ | 1047 | ********************************************************************************/ |
851 | 1183 | eval_expr::eval_expr( | 1048 | eval_expr::eval_expr( |
852 | 1184 | CompilerCB* ccb, | 1049 | CompilerCB* ccb, |
853 | 1185 | static_context* sctx, | 1050 | static_context* sctx, |
854 | 1051 | user_function* udf, | ||
855 | 1186 | const QueryLoc& loc, | 1052 | const QueryLoc& loc, |
856 | 1187 | expr* e, | 1053 | expr* e, |
857 | 1188 | expr_script_kind_t scriptingKind, | 1054 | expr_script_kind_t scriptingKind, |
858 | 1189 | namespace_context* nsCtx) | 1055 | namespace_context* nsCtx) |
859 | 1190 | : | 1056 | : |
861 | 1191 | namespace_context_base_expr(ccb, sctx, loc, eval_expr_kind, nsCtx), | 1057 | namespace_context_base_expr(ccb, sctx, udf, loc, eval_expr_kind, nsCtx), |
862 | 1192 | theExpr(e), | 1058 | theExpr(e), |
863 | 1193 | theInnerScriptingKind(scriptingKind), | 1059 | theInnerScriptingKind(scriptingKind), |
864 | 1194 | theDoNodeCopy(false) | 1060 | theDoNodeCopy(false) |
865 | @@ -1222,33 +1088,6 @@ | |||
866 | 1222 | } | 1088 | } |
867 | 1223 | 1089 | ||
868 | 1224 | 1090 | ||
869 | 1225 | expr* eval_expr::cloneImpl(substitution_t& s) const | ||
870 | 1226 | { | ||
871 | 1227 | eval_expr* new_eval = theCCB->theEM-> | ||
872 | 1228 | create_eval_expr(theSctx, | ||
873 | 1229 | theLoc, | ||
874 | 1230 | theExpr->clone(s), | ||
875 | 1231 | theInnerScriptingKind, | ||
876 | 1232 | theNSCtx.getp()); | ||
877 | 1233 | |||
878 | 1234 | new_eval->setNodeCopy(theDoNodeCopy); | ||
879 | 1235 | |||
880 | 1236 | new_eval->theOuterVarNames = theOuterVarNames; | ||
881 | 1237 | new_eval->theOuterVarTypes = theOuterVarTypes; | ||
882 | 1238 | |||
883 | 1239 | csize numVars = theOuterVarNames.size(); | ||
884 | 1240 | |||
885 | 1241 | new_eval->theArgs.resize(numVars); | ||
886 | 1242 | |||
887 | 1243 | for (csize i = 0; i < numVars; ++i) | ||
888 | 1244 | { | ||
889 | 1245 | new_eval->theArgs[i] = theArgs[i]->clone(s); | ||
890 | 1246 | } | ||
891 | 1247 | |||
892 | 1248 | return new_eval; | ||
893 | 1249 | } | ||
894 | 1250 | |||
895 | 1251 | |||
896 | 1252 | #ifdef ZORBA_WITH_DEBUGGER | 1091 | #ifdef ZORBA_WITH_DEBUGGER |
897 | 1253 | /******************************************************************************* | 1092 | /******************************************************************************* |
898 | 1254 | 1093 | ||
899 | @@ -1256,12 +1095,13 @@ | |||
900 | 1256 | debugger_expr::debugger_expr( | 1095 | debugger_expr::debugger_expr( |
901 | 1257 | CompilerCB* ccb, | 1096 | CompilerCB* ccb, |
902 | 1258 | static_context* sctx, | 1097 | static_context* sctx, |
903 | 1098 | user_function* udf, | ||
904 | 1259 | const QueryLoc& loc, | 1099 | const QueryLoc& loc, |
905 | 1260 | expr* aChild, | 1100 | expr* aChild, |
906 | 1261 | namespace_context* nsCtx, | 1101 | namespace_context* nsCtx, |
907 | 1262 | bool aIsVarDeclaration) | 1102 | bool aIsVarDeclaration) |
908 | 1263 | : | 1103 | : |
910 | 1264 | namespace_context_base_expr(ccb, sctx, loc, debugger_expr_kind, nsCtx), | 1104 | namespace_context_base_expr(ccb, sctx, udf, loc, debugger_expr_kind, nsCtx), |
911 | 1265 | theExpr(aChild), | 1105 | theExpr(aChild), |
912 | 1266 | theIsVarDeclaration(aIsVarDeclaration) | 1106 | theIsVarDeclaration(aIsVarDeclaration) |
913 | 1267 | { | 1107 | { |
914 | @@ -1283,10 +1123,11 @@ | |||
915 | 1283 | function_trace_expr::function_trace_expr( | 1123 | function_trace_expr::function_trace_expr( |
916 | 1284 | CompilerCB* ccb, | 1124 | CompilerCB* ccb, |
917 | 1285 | static_context* sctx, | 1125 | static_context* sctx, |
918 | 1126 | user_function* udf, | ||
919 | 1286 | const QueryLoc& loc, | 1127 | const QueryLoc& loc, |
920 | 1287 | expr* aChild) | 1128 | expr* aChild) |
921 | 1288 | : | 1129 | : |
923 | 1289 | expr(ccb, sctx, loc, aChild->get_expr_kind()), | 1130 | expr(ccb, sctx, udf, loc, aChild->get_expr_kind()), |
924 | 1290 | theExpr(aChild), | 1131 | theExpr(aChild), |
925 | 1291 | theFunctionArity(0) | 1132 | theFunctionArity(0) |
926 | 1292 | { | 1133 | { |
927 | @@ -1296,9 +1137,13 @@ | |||
928 | 1296 | } | 1137 | } |
929 | 1297 | 1138 | ||
930 | 1298 | 1139 | ||
932 | 1299 | function_trace_expr::function_trace_expr(expr* aExpr) | 1140 | function_trace_expr::function_trace_expr(user_function* udf, expr* aExpr) |
933 | 1300 | : | 1141 | : |
935 | 1301 | expr(aExpr->get_ccb(), aExpr->get_sctx(), aExpr->get_loc(), function_trace_expr_kind), | 1142 | expr(aExpr->get_ccb(), |
936 | 1143 | aExpr->get_sctx(), | ||
937 | 1144 | udf, | ||
938 | 1145 | aExpr->get_loc(), | ||
939 | 1146 | function_trace_expr_kind), | ||
940 | 1302 | theExpr(aExpr), | 1147 | theExpr(aExpr), |
941 | 1303 | theFunctionArity(0) | 1148 | theFunctionArity(0) |
942 | 1304 | { | 1149 | { |
943 | @@ -1319,20 +1164,5 @@ | |||
944 | 1319 | } | 1164 | } |
945 | 1320 | 1165 | ||
946 | 1321 | 1166 | ||
947 | 1322 | expr* function_trace_expr::cloneImpl(substitution_t& s) const | ||
948 | 1323 | { | ||
949 | 1324 | function_trace_expr* clone = theCCB->theEM-> | ||
950 | 1325 | create_function_trace_expr(theExpr->clone(s)); | ||
951 | 1326 | |||
952 | 1327 | clone->theFunctionName = theFunctionName; | ||
953 | 1328 | clone->theFunctionLocation = theFunctionLocation; | ||
954 | 1329 | clone->theFunctionCallLocation = theFunctionCallLocation; | ||
955 | 1330 | clone->theFunctionArity = theFunctionArity; | ||
956 | 1331 | |||
957 | 1332 | return clone; | ||
958 | 1333 | } | ||
959 | 1334 | |||
960 | 1335 | |||
961 | 1336 | |||
962 | 1337 | } /* namespace zorba */ | 1167 | } /* namespace zorba */ |
963 | 1338 | /* vim:set et sw=2 ts=2: */ | 1168 | /* vim:set et sw=2 ts=2: */ |
964 | 1339 | 1169 | ||
965 | === modified file 'src/compiler/expression/expr.h' | |||
966 | --- src/compiler/expression/expr.h 2012-10-08 12:09:36 +0000 | |||
967 | +++ src/compiler/expression/expr.h 2012-10-09 13:35:26 +0000 | |||
968 | @@ -58,14 +58,15 @@ | |||
969 | 58 | friend class expr; | 58 | friend class expr; |
970 | 59 | 59 | ||
971 | 60 | protected: | 60 | protected: |
975 | 61 | expr* theCondExpr; | 61 | expr * theCondExpr; |
976 | 62 | expr* theThenExpr; | 62 | expr * theThenExpr; |
977 | 63 | expr* theElseExpr; | 63 | expr * theElseExpr; |
978 | 64 | 64 | ||
979 | 65 | protected: | 65 | protected: |
980 | 66 | if_expr( | 66 | if_expr( |
981 | 67 | CompilerCB* ccb, | 67 | CompilerCB* ccb, |
982 | 68 | static_context* sctx, | 68 | static_context* sctx, |
983 | 69 | user_function* udf, | ||
984 | 69 | const QueryLoc& loc, | 70 | const QueryLoc& loc, |
985 | 70 | expr* c, | 71 | expr* c, |
986 | 71 | expr* t, | 72 | expr* t, |
987 | @@ -80,8 +81,6 @@ | |||
988 | 80 | 81 | ||
989 | 81 | void compute_scripting_kind(); | 82 | void compute_scripting_kind(); |
990 | 82 | 83 | ||
991 | 83 | expr* cloneImpl(substitution_t& s) const; | ||
992 | 84 | |||
993 | 85 | void accept(expr_visitor&); | 84 | void accept(expr_visitor&); |
994 | 86 | 85 | ||
995 | 87 | std::ostream& put(std::ostream&) const; | 86 | std::ostream& put(std::ostream&) const; |
996 | @@ -105,11 +104,17 @@ | |||
997 | 105 | }; | 104 | }; |
998 | 106 | 105 | ||
999 | 107 | protected: | 106 | protected: |
1002 | 108 | order_type_t theType; | 107 | order_type_t theType; |
1003 | 109 | expr* theExpr; | 108 | expr * theExpr; |
1004 | 110 | 109 | ||
1005 | 111 | protected: | 110 | protected: |
1007 | 112 | order_expr(CompilerCB* ccb, static_context* sctx, const QueryLoc&, order_type_t, expr*); | 111 | order_expr( |
1008 | 112 | CompilerCB* ccb, | ||
1009 | 113 | static_context* sctx, | ||
1010 | 114 | user_function* udf, | ||
1011 | 115 | const QueryLoc&, | ||
1012 | 116 | order_type_t, | ||
1013 | 117 | expr*); | ||
1014 | 113 | 118 | ||
1015 | 114 | public: | 119 | public: |
1016 | 115 | order_type_t get_type() const { return theType; } | 120 | order_type_t get_type() const { return theType; } |
1017 | @@ -118,8 +123,6 @@ | |||
1018 | 118 | 123 | ||
1019 | 119 | void compute_scripting_kind(); | 124 | void compute_scripting_kind(); |
1020 | 120 | 125 | ||
1021 | 121 | expr* cloneImpl(substitution_t& s) const; | ||
1022 | 122 | |||
1023 | 123 | void accept(expr_visitor&); | 126 | void accept(expr_visitor&); |
1024 | 124 | 127 | ||
1025 | 125 | std::ostream& put(std::ostream&) const; | 128 | std::ostream& put(std::ostream&) const; |
1026 | @@ -139,17 +142,18 @@ | |||
1027 | 139 | ParseConstants::validation_mode_t theMode; | 142 | ParseConstants::validation_mode_t theMode; |
1028 | 140 | store::Item_t theTypeName; | 143 | store::Item_t theTypeName; |
1029 | 141 | rchandle<TypeManager> theTypeMgr; | 144 | rchandle<TypeManager> theTypeMgr; |
1031 | 142 | expr* theExpr; | 145 | expr * theExpr; |
1032 | 143 | 146 | ||
1033 | 144 | protected: | 147 | protected: |
1034 | 145 | validate_expr( | 148 | validate_expr( |
1042 | 146 | CompilerCB* ccb, | 149 | CompilerCB* ccb, |
1043 | 147 | static_context* sctx, | 150 | static_context* sctx, |
1044 | 148 | const QueryLoc&, | 151 | user_function* udf, |
1045 | 149 | ParseConstants::validation_mode_t, | 152 | const QueryLoc&, |
1046 | 150 | const store::Item_t& aTypeName, | 153 | ParseConstants::validation_mode_t, |
1047 | 151 | expr*, | 154 | const store::Item_t& aTypeName, |
1048 | 152 | rchandle<TypeManager>); | 155 | expr*, |
1049 | 156 | rchandle<TypeManager>); | ||
1050 | 153 | 157 | ||
1051 | 154 | public: | 158 | public: |
1052 | 155 | expr* get_expr() const { return theExpr; } | 159 | expr* get_expr() const { return theExpr; } |
1053 | @@ -162,8 +166,6 @@ | |||
1054 | 162 | 166 | ||
1055 | 163 | void compute_scripting_kind(); | 167 | void compute_scripting_kind(); |
1056 | 164 | 168 | ||
1057 | 165 | expr* cloneImpl(substitution_t& s) const; | ||
1058 | 166 | |||
1059 | 167 | void accept(expr_visitor&); | 169 | void accept(expr_visitor&); |
1060 | 168 | 170 | ||
1061 | 169 | std::ostream& put(std::ostream&) const; | 171 | std::ostream& put(std::ostream&) const; |
1062 | @@ -184,6 +186,7 @@ | |||
1063 | 184 | namespace_context_base_expr( | 186 | namespace_context_base_expr( |
1064 | 185 | CompilerCB* ccb, | 187 | CompilerCB* ccb, |
1065 | 186 | static_context* sctx, | 188 | static_context* sctx, |
1066 | 189 | user_function* udf, | ||
1067 | 187 | const QueryLoc& loc, | 190 | const QueryLoc& loc, |
1068 | 188 | expr_kind_t kind, | 191 | expr_kind_t kind, |
1069 | 189 | const namespace_context* aNSCtx); | 192 | const namespace_context* aNSCtx); |
1070 | @@ -207,12 +210,13 @@ | |||
1071 | 207 | 210 | ||
1072 | 208 | protected: | 211 | protected: |
1073 | 209 | cast_or_castable_base_expr( | 212 | cast_or_castable_base_expr( |
1080 | 210 | CompilerCB* ccb, | 213 | CompilerCB* ccb, |
1081 | 211 | static_context* sctx, | 214 | static_context* sctx, |
1082 | 212 | const QueryLoc& loc, | 215 | user_function* udf, |
1083 | 213 | expr_kind_t kind, | 216 | const QueryLoc& loc, |
1084 | 214 | expr* input, | 217 | expr_kind_t kind, |
1085 | 215 | const xqtref_t& type); | 218 | expr* input, |
1086 | 219 | const xqtref_t& type); | ||
1087 | 216 | 220 | ||
1088 | 217 | public: | 221 | public: |
1089 | 218 | expr* get_input() const { return theInputExpr; } | 222 | expr* get_input() const { return theInputExpr; } |
1090 | @@ -234,12 +238,13 @@ | |||
1091 | 234 | 238 | ||
1092 | 235 | protected: | 239 | protected: |
1093 | 236 | cast_base_expr( | 240 | cast_base_expr( |
1100 | 237 | CompilerCB* ccb, | 241 | CompilerCB* ccb, |
1101 | 238 | static_context* sctx, | 242 | static_context* sctx, |
1102 | 239 | const QueryLoc& loc, | 243 | user_function* udf, |
1103 | 240 | expr_kind_t kind, | 244 | const QueryLoc& loc, |
1104 | 241 | expr* input, | 245 | expr_kind_t kind, |
1105 | 242 | const xqtref_t& type); | 246 | expr* input, |
1106 | 247 | const xqtref_t& type); | ||
1107 | 243 | }; | 248 | }; |
1108 | 244 | 249 | ||
1109 | 245 | 250 | ||
1110 | @@ -258,6 +263,7 @@ | |||
1111 | 258 | cast_expr( | 263 | cast_expr( |
1112 | 259 | CompilerCB* ccb, | 264 | CompilerCB* ccb, |
1113 | 260 | static_context* sctx, | 265 | static_context* sctx, |
1114 | 266 | user_function* udf, | ||
1115 | 261 | const QueryLoc&, | 267 | const QueryLoc&, |
1116 | 262 | expr*, | 268 | expr*, |
1117 | 263 | const xqtref_t&); | 269 | const xqtref_t&); |
1118 | @@ -265,8 +271,6 @@ | |||
1119 | 265 | public: | 271 | public: |
1120 | 266 | bool is_optional() const; | 272 | bool is_optional() const; |
1121 | 267 | 273 | ||
1122 | 268 | expr* cloneImpl(substitution_t& s) const; | ||
1123 | 269 | |||
1124 | 270 | void accept(expr_visitor&); | 274 | void accept(expr_visitor&); |
1125 | 271 | 275 | ||
1126 | 272 | std::ostream& put(std::ostream&) const; | 276 | std::ostream& put(std::ostream&) const; |
1127 | @@ -299,14 +303,15 @@ | |||
1128 | 299 | 303 | ||
1129 | 300 | protected: | 304 | protected: |
1130 | 301 | treat_expr( | 305 | treat_expr( |
1139 | 302 | CompilerCB* ccb, | 306 | CompilerCB* ccb, |
1140 | 303 | static_context* sctx, | 307 | static_context* sctx, |
1141 | 304 | const QueryLoc&, | 308 | user_function* udf, |
1142 | 305 | expr*, | 309 | const QueryLoc&, |
1143 | 306 | const xqtref_t&, | 310 | expr*, |
1144 | 307 | TreatIterator::ErrorKind err, | 311 | const xqtref_t&, |
1145 | 308 | bool check_prime = true, | 312 | TreatIterator::ErrorKind err, |
1146 | 309 | store::Item* qname = NULL); | 313 | bool check_prime = true, |
1147 | 314 | store::Item* qname = NULL); | ||
1148 | 310 | 315 | ||
1149 | 311 | public: | 316 | public: |
1150 | 312 | TreatIterator::ErrorKind get_err() const { return theErrorKind; } | 317 | TreatIterator::ErrorKind get_err() const { return theErrorKind; } |
1151 | @@ -319,8 +324,6 @@ | |||
1152 | 319 | 324 | ||
1153 | 320 | store::Item_t get_qname() const { return theQName; } | 325 | store::Item_t get_qname() const { return theQName; } |
1154 | 321 | 326 | ||
1155 | 322 | expr* cloneImpl(substitution_t& s) const; | ||
1156 | 323 | |||
1157 | 324 | void accept(expr_visitor&); | 327 | void accept(expr_visitor&); |
1158 | 325 | 328 | ||
1159 | 326 | std::ostream& put(std::ostream&) const; | 329 | std::ostream& put(std::ostream&) const; |
1160 | @@ -379,6 +382,7 @@ | |||
1161 | 379 | promote_expr( | 382 | promote_expr( |
1162 | 380 | CompilerCB* ccb, | 383 | CompilerCB* ccb, |
1163 | 381 | static_context* sctx, | 384 | static_context* sctx, |
1164 | 385 | user_function* udf, | ||
1165 | 382 | const QueryLoc& loc, | 386 | const QueryLoc& loc, |
1166 | 383 | expr* input, | 387 | expr* input, |
1167 | 384 | const xqtref_t& type, | 388 | const xqtref_t& type, |
1168 | @@ -386,8 +390,6 @@ | |||
1169 | 386 | store::Item* qname); | 390 | store::Item* qname); |
1170 | 387 | 391 | ||
1171 | 388 | public: | 392 | public: |
1172 | 389 | expr* cloneImpl(substitution_t& s) const; | ||
1173 | 390 | |||
1174 | 391 | PromoteIterator::ErrorKind get_err() const { return theErrorKind; } | 393 | PromoteIterator::ErrorKind get_err() const { return theErrorKind; } |
1175 | 392 | 394 | ||
1176 | 393 | void set_qname(const store::Item_t& qname) { theQName = qname; } | 395 | void set_qname(const store::Item_t& qname) { theQName = qname; } |
1177 | @@ -409,12 +411,13 @@ | |||
1178 | 409 | 411 | ||
1179 | 410 | protected: | 412 | protected: |
1180 | 411 | castable_base_expr( | 413 | castable_base_expr( |
1187 | 412 | CompilerCB* ccb, | 414 | CompilerCB* ccb, |
1188 | 413 | static_context* sctx, | 415 | static_context* sctx, |
1189 | 414 | const QueryLoc&, | 416 | user_function* udf, |
1190 | 415 | expr_kind_t kind, | 417 | const QueryLoc&, |
1191 | 416 | expr*, | 418 | expr_kind_t kind, |
1192 | 417 | const xqtref_t&); | 419 | expr*, |
1193 | 420 | const xqtref_t&); | ||
1194 | 418 | }; | 421 | }; |
1195 | 419 | 422 | ||
1196 | 420 | 423 | ||
1197 | @@ -433,6 +436,7 @@ | |||
1198 | 433 | castable_expr( | 436 | castable_expr( |
1199 | 434 | CompilerCB* ccb, | 437 | CompilerCB* ccb, |
1200 | 435 | static_context* sctx, | 438 | static_context* sctx, |
1201 | 439 | user_function* udf, | ||
1202 | 436 | const QueryLoc&, | 440 | const QueryLoc&, |
1203 | 437 | expr*, | 441 | expr*, |
1204 | 438 | const xqtref_t&); | 442 | const xqtref_t&); |
1205 | @@ -440,8 +444,6 @@ | |||
1206 | 440 | public: | 444 | public: |
1207 | 441 | bool is_optional() const; | 445 | bool is_optional() const; |
1208 | 442 | 446 | ||
1209 | 443 | expr* cloneImpl(substitution_t& s) const; | ||
1210 | 444 | |||
1211 | 445 | void accept(expr_visitor&); | 447 | void accept(expr_visitor&); |
1212 | 446 | 448 | ||
1213 | 447 | std::ostream& put(std::ostream&) const; | 449 | std::ostream& put(std::ostream&) const; |
1214 | @@ -470,6 +472,7 @@ | |||
1215 | 470 | instanceof_expr( | 472 | instanceof_expr( |
1216 | 471 | CompilerCB* ccb, | 473 | CompilerCB* ccb, |
1217 | 472 | static_context* sctx, | 474 | static_context* sctx, |
1218 | 475 | user_function* udf, | ||
1219 | 473 | const QueryLoc&, | 476 | const QueryLoc&, |
1220 | 474 | expr*, | 477 | expr*, |
1221 | 475 | const xqtref_t&, | 478 | const xqtref_t&, |
1222 | @@ -478,8 +481,6 @@ | |||
1223 | 478 | public: | 481 | public: |
1224 | 479 | bool getCheckPrimeOnly() const { return theCheckPrimeOnly; } | 482 | bool getCheckPrimeOnly() const { return theCheckPrimeOnly; } |
1225 | 480 | 483 | ||
1226 | 481 | expr* cloneImpl(substitution_t& s) const; | ||
1227 | 482 | |||
1228 | 483 | void accept(expr_visitor&); | 484 | void accept(expr_visitor&); |
1229 | 484 | 485 | ||
1230 | 485 | std::ostream& put(std::ostream&) const; | 486 | std::ostream& put(std::ostream&) const; |
1231 | @@ -510,6 +511,7 @@ | |||
1232 | 510 | name_cast_expr( | 511 | name_cast_expr( |
1233 | 511 | CompilerCB* ccb, | 512 | CompilerCB* ccb, |
1234 | 512 | static_context* sctx, | 513 | static_context* sctx, |
1235 | 514 | user_function* udf, | ||
1236 | 513 | const QueryLoc&, | 515 | const QueryLoc&, |
1237 | 514 | expr*, | 516 | expr*, |
1238 | 515 | const namespace_context*, | 517 | const namespace_context*, |
1239 | @@ -522,8 +524,6 @@ | |||
1240 | 522 | 524 | ||
1241 | 523 | void compute_scripting_kind(); | 525 | void compute_scripting_kind(); |
1242 | 524 | 526 | ||
1243 | 525 | expr* cloneImpl(substitution_t& s) const; | ||
1244 | 526 | |||
1245 | 527 | void accept(expr_visitor&); | 527 | void accept(expr_visitor&); |
1246 | 528 | 528 | ||
1247 | 529 | std::ostream& put(std::ostream&) const; | 529 | std::ostream& put(std::ostream&) const; |
1248 | @@ -540,11 +540,17 @@ | |||
1249 | 540 | friend class expr; | 540 | friend class expr; |
1250 | 541 | 541 | ||
1251 | 542 | protected: | 542 | protected: |
1254 | 543 | expr* theContent; | 543 | expr * theContent; |
1255 | 544 | bool theCopyInputNodes; | 544 | bool theCopyInputNodes; |
1256 | 545 | 545 | ||
1257 | 546 | protected: | 546 | protected: |
1259 | 547 | doc_expr(CompilerCB* ccb, static_context* sctx, const QueryLoc&, expr* content, bool copyNodes); | 547 | doc_expr( |
1260 | 548 | CompilerCB* ccb, | ||
1261 | 549 | static_context* sctx, | ||
1262 | 550 | user_function* udf, | ||
1263 | 551 | const QueryLoc&, | ||
1264 | 552 | expr* content, | ||
1265 | 553 | bool copyNodes); | ||
1266 | 548 | 554 | ||
1267 | 549 | public: | 555 | public: |
1268 | 550 | expr* getContent() const { return theContent; } | 556 | expr* getContent() const { return theContent; } |
1269 | @@ -555,8 +561,6 @@ | |||
1270 | 555 | 561 | ||
1271 | 556 | void compute_scripting_kind(); | 562 | void compute_scripting_kind(); |
1272 | 557 | 563 | ||
1273 | 558 | expr* cloneImpl(substitution_t& s) const; | ||
1274 | 559 | |||
1275 | 560 | void accept(expr_visitor&); | 564 | void accept(expr_visitor&); |
1276 | 561 | 565 | ||
1277 | 562 | std::ostream& put(std::ostream&) const; | 566 | std::ostream& put(std::ostream&) const; |
1278 | @@ -596,25 +600,27 @@ | |||
1279 | 596 | friend class expr; | 600 | friend class expr; |
1280 | 597 | 601 | ||
1281 | 598 | protected: | 602 | protected: |
1286 | 599 | expr* theQNameExpr; | 603 | expr * theQNameExpr; |
1287 | 600 | expr* theAttrs; | 604 | expr * theAttrs; |
1288 | 601 | expr* theContent; | 605 | expr * theContent; |
1289 | 602 | bool theCopyInputNodes; | 606 | bool theCopyInputNodes; |
1290 | 603 | 607 | ||
1291 | 604 | protected: | 608 | protected: |
1292 | 605 | elem_expr( | 609 | elem_expr( |
1301 | 606 | CompilerCB* ccb, | 610 | CompilerCB* ccb, |
1302 | 607 | static_context* sctx, | 611 | static_context* sctx, |
1303 | 608 | const QueryLoc&, | 612 | user_function* udf, |
1304 | 609 | expr* qnameExpr, | 613 | const QueryLoc&, |
1305 | 610 | expr* attrs, | 614 | expr* qnameExpr, |
1306 | 611 | expr* content, | 615 | expr* attrs, |
1307 | 612 | const namespace_context* nsCtx, | 616 | expr* content, |
1308 | 613 | bool copyNodes); | 617 | const namespace_context* nsCtx, |
1309 | 618 | bool copyNodes); | ||
1310 | 614 | 619 | ||
1311 | 615 | elem_expr( | 620 | elem_expr( |
1312 | 616 | CompilerCB* ccb, | 621 | CompilerCB* ccb, |
1313 | 617 | static_context* sctx, | 622 | static_context* sctx, |
1314 | 623 | user_function* udf, | ||
1315 | 618 | const QueryLoc&, | 624 | const QueryLoc&, |
1316 | 619 | expr* qnameExpr, | 625 | expr* qnameExpr, |
1317 | 620 | expr* content, | 626 | expr* content, |
1318 | @@ -634,8 +640,6 @@ | |||
1319 | 634 | 640 | ||
1320 | 635 | void compute_scripting_kind(); | 641 | void compute_scripting_kind(); |
1321 | 636 | 642 | ||
1322 | 637 | expr* cloneImpl(substitution_t& s) const; | ||
1323 | 638 | |||
1324 | 639 | void accept(expr_visitor&); | 643 | void accept(expr_visitor&); |
1325 | 640 | 644 | ||
1326 | 641 | std::ostream& put(std::ostream&) const; | 645 | std::ostream& put(std::ostream&) const; |
1327 | @@ -673,16 +677,17 @@ | |||
1328 | 673 | friend class expr; | 677 | friend class expr; |
1329 | 674 | 678 | ||
1330 | 675 | protected: | 679 | protected: |
1333 | 676 | expr* theQNameExpr; | 680 | expr * theQNameExpr; |
1334 | 677 | expr* theValueExpr; | 681 | expr * theValueExpr; |
1335 | 678 | 682 | ||
1336 | 679 | protected: | 683 | protected: |
1337 | 680 | attr_expr( | 684 | attr_expr( |
1343 | 681 | CompilerCB* ccb, | 685 | CompilerCB* ccb, |
1344 | 682 | static_context* sctx, | 686 | static_context* sctx, |
1345 | 683 | const QueryLoc& loc, | 687 | user_function* udf, |
1346 | 684 | expr* aQNameExpr, | 688 | const QueryLoc& loc, |
1347 | 685 | expr* aValueExpr); | 689 | expr* aQNameExpr, |
1348 | 690 | expr* aValueExpr); | ||
1349 | 686 | 691 | ||
1350 | 687 | public: | 692 | public: |
1351 | 688 | expr* getQNameExpr() const { return theQNameExpr; } | 693 | expr* getQNameExpr() const { return theQNameExpr; } |
1352 | @@ -693,8 +698,6 @@ | |||
1353 | 693 | 698 | ||
1354 | 694 | void compute_scripting_kind(); | 699 | void compute_scripting_kind(); |
1355 | 695 | 700 | ||
1356 | 696 | expr* cloneImpl(substitution_t& s) const; | ||
1357 | 697 | |||
1358 | 698 | void accept(expr_visitor&); | 701 | void accept(expr_visitor&); |
1359 | 699 | 702 | ||
1360 | 700 | std::ostream& put(std::ostream&) const; | 703 | std::ostream& put(std::ostream&) const; |
1361 | @@ -718,13 +721,14 @@ | |||
1362 | 718 | } text_constructor_type; | 721 | } text_constructor_type; |
1363 | 719 | 722 | ||
1364 | 720 | protected: | 723 | protected: |
1367 | 721 | text_constructor_type type; | 724 | text_constructor_type type; |
1368 | 722 | expr* theContentExpr; | 725 | expr * theContentExpr; |
1369 | 723 | 726 | ||
1370 | 724 | protected: | 727 | protected: |
1371 | 725 | text_expr( | 728 | text_expr( |
1372 | 726 | CompilerCB* ccb, | 729 | CompilerCB* ccb, |
1373 | 727 | static_context* sctx, | 730 | static_context* sctx, |
1374 | 731 | user_function* udf, | ||
1375 | 728 | const QueryLoc&, | 732 | const QueryLoc&, |
1376 | 729 | text_constructor_type, | 733 | text_constructor_type, |
1377 | 730 | expr*); | 734 | expr*); |
1378 | @@ -736,8 +740,6 @@ | |||
1379 | 736 | 740 | ||
1380 | 737 | void compute_scripting_kind(); | 741 | void compute_scripting_kind(); |
1381 | 738 | 742 | ||
1382 | 739 | expr* cloneImpl(substitution_t& s) const; | ||
1383 | 740 | |||
1384 | 741 | void accept(expr_visitor&); | 743 | void accept(expr_visitor&); |
1385 | 742 | 744 | ||
1386 | 743 | std::ostream& put(std::ostream&) const; | 745 | std::ostream& put(std::ostream&) const; |
1387 | @@ -754,11 +756,17 @@ | |||
1388 | 754 | friend class expr; | 756 | friend class expr; |
1389 | 755 | 757 | ||
1390 | 756 | protected: | 758 | protected: |
1393 | 757 | expr* theTargetExpr; | 759 | expr * theTargetExpr; |
1394 | 758 | expr* theContentExpr; | 760 | expr * theContentExpr; |
1395 | 759 | 761 | ||
1396 | 760 | protected: | 762 | protected: |
1398 | 761 | pi_expr(CompilerCB* ccb, static_context* sctx, const QueryLoc&, expr*, expr*); | 763 | pi_expr( |
1399 | 764 | CompilerCB* ccb, | ||
1400 | 765 | static_context* sctx, | ||
1401 | 766 | user_function* udf, | ||
1402 | 767 | const QueryLoc&, | ||
1403 | 768 | expr*, | ||
1404 | 769 | expr*); | ||
1405 | 762 | 770 | ||
1406 | 763 | public: | 771 | public: |
1407 | 764 | expr* get_target_expr() const { return theTargetExpr; } | 772 | expr* get_target_expr() const { return theTargetExpr; } |
1408 | @@ -767,8 +775,6 @@ | |||
1409 | 767 | 775 | ||
1410 | 768 | void compute_scripting_kind(); | 776 | void compute_scripting_kind(); |
1411 | 769 | 777 | ||
1412 | 770 | expr* cloneImpl(substitution_t& s) const; | ||
1413 | 771 | |||
1414 | 772 | void accept(expr_visitor&); | 778 | void accept(expr_visitor&); |
1415 | 773 | 779 | ||
1416 | 774 | std::ostream& put(std::ostream&) const; | 780 | std::ostream& put(std::ostream&) const; |
1417 | @@ -788,31 +794,76 @@ | |||
1418 | 788 | store::Item_t theValue; | 794 | store::Item_t theValue; |
1419 | 789 | 795 | ||
1420 | 790 | protected: | 796 | protected: |
1438 | 791 | const_expr(CompilerCB*, static_context*, const QueryLoc&, zstring& sval); | 797 | const_expr( |
1439 | 792 | 798 | CompilerCB*, | |
1440 | 793 | const_expr(CompilerCB*, static_context*, const QueryLoc&, const std::string& sval); | 799 | static_context*, |
1441 | 794 | 800 | user_function* udf, | |
1442 | 795 | const_expr(CompilerCB*, static_context*, const QueryLoc&, const char* sval); | 801 | const QueryLoc&, |
1443 | 796 | 802 | zstring& sval); | |
1444 | 797 | const_expr(CompilerCB*, static_context*, const QueryLoc&, xs_integer); | 803 | |
1445 | 798 | 804 | const_expr( | |
1446 | 799 | const_expr(CompilerCB*, static_context*, const QueryLoc&, xs_decimal); | 805 | CompilerCB*, |
1447 | 800 | 806 | static_context*, | |
1448 | 801 | const_expr(CompilerCB*, static_context*, const QueryLoc&, xs_double); | 807 | user_function* udf, |
1449 | 802 | 808 | const QueryLoc&, | |
1450 | 803 | const_expr(CompilerCB*, static_context*, const QueryLoc&, xs_boolean); | 809 | const std::string& sval); |
1451 | 804 | 810 | ||
1452 | 805 | const_expr(CompilerCB*, static_context*, const QueryLoc&, const store::Item_t&); | 811 | const_expr( |
1453 | 806 | 812 | CompilerCB*, | |
1454 | 807 | const_expr(CompilerCB*, static_context*, const QueryLoc&, const char* ns, const char* pre, const char* local); | 813 | static_context*, |
1455 | 814 | user_function* udf, | ||
1456 | 815 | const QueryLoc&, | ||
1457 | 816 | const char* sval); | ||
1458 | 817 | |||
1459 | 818 | const_expr( | ||
1460 | 819 | CompilerCB*, | ||
1461 | 820 | static_context*, | ||
1462 | 821 | user_function* udf, | ||
1463 | 822 | const QueryLoc&, | ||
1464 | 823 | xs_integer); | ||
1465 | 824 | |||
1466 | 825 | const_expr( | ||
1467 | 826 | CompilerCB*, | ||
1468 | 827 | static_context*, | ||
1469 | 828 | user_function* udf, | ||
1470 | 829 | const QueryLoc&, | ||
1471 | 830 | xs_decimal); | ||
1472 | 831 | |||
1473 | 832 | const_expr( | ||
1474 | 833 | CompilerCB*, | ||
1475 | 834 | static_context*, | ||
1476 | 835 | user_function* udf, | ||
1477 | 836 | const QueryLoc&, | ||
1478 | 837 | xs_double); | ||
1479 | 838 | |||
1480 | 839 | const_expr( | ||
1481 | 840 | CompilerCB*, | ||
1482 | 841 | static_context*, | ||
1483 | 842 | user_function* udf, | ||
1484 | 843 | const QueryLoc&, | ||
1485 | 844 | xs_boolean); | ||
1486 | 845 | |||
1487 | 846 | const_expr( | ||
1488 | 847 | CompilerCB*, | ||
1489 | 848 | static_context*, | ||
1490 | 849 | user_function* udf, | ||
1491 | 850 | const QueryLoc&, | ||
1492 | 851 | const store::Item_t&); | ||
1493 | 852 | |||
1494 | 853 | const_expr( | ||
1495 | 854 | CompilerCB*, | ||
1496 | 855 | static_context*, | ||
1497 | 856 | user_function* udf, | ||
1498 | 857 | const QueryLoc&, | ||
1499 | 858 | const char* ns, | ||
1500 | 859 | const char* pre, | ||
1501 | 860 | const char* local); | ||
1502 | 808 | 861 | ||
1503 | 809 | public: | 862 | public: |
1504 | 810 | store::Item* get_val() const { return theValue.getp(); } | 863 | store::Item* get_val() const { return theValue.getp(); } |
1505 | 811 | 864 | ||
1506 | 812 | void compute_scripting_kind(); | 865 | void compute_scripting_kind(); |
1507 | 813 | 866 | ||
1508 | 814 | expr* cloneImpl(substitution_t& s) const; | ||
1509 | 815 | |||
1510 | 816 | void accept(expr_visitor&); | 867 | void accept(expr_visitor&); |
1511 | 817 | 868 | ||
1512 | 818 | std::ostream& put(std::ostream&) const; | 869 | std::ostream& put(std::ostream&) const; |
1513 | @@ -829,13 +880,22 @@ | |||
1514 | 829 | friend class expr; | 880 | friend class expr; |
1515 | 830 | 881 | ||
1516 | 831 | protected: | 882 | protected: |
1519 | 832 | std::vector<pragma*> thePragmas; | 883 | std::vector<pragma*> thePragmas; |
1520 | 833 | expr* theExpr; | 884 | expr * theExpr; |
1521 | 834 | 885 | ||
1522 | 835 | protected: | 886 | protected: |
1524 | 836 | extension_expr(CompilerCB* ccb, static_context* sctx, const QueryLoc&); | 887 | extension_expr( |
1525 | 888 | CompilerCB* ccb, | ||
1526 | 889 | static_context* sctx, | ||
1527 | 890 | user_function* udf, | ||
1528 | 891 | const QueryLoc&); | ||
1529 | 837 | 892 | ||
1531 | 838 | extension_expr(CompilerCB* ccb, static_context* sctx, const QueryLoc&, expr*); | 893 | extension_expr( |
1532 | 894 | CompilerCB* ccb, | ||
1533 | 895 | static_context* sctx, | ||
1534 | 896 | user_function* udf, | ||
1535 | 897 | const QueryLoc&, | ||
1536 | 898 | expr*); | ||
1537 | 839 | 899 | ||
1538 | 840 | public: | 900 | public: |
1539 | 841 | void add(pragma* p) { thePragmas.push_back(p); } | 901 | void add(pragma* p) { thePragmas.push_back(p); } |
1540 | @@ -844,8 +904,6 @@ | |||
1541 | 844 | 904 | ||
1542 | 845 | void compute_scripting_kind(); | 905 | void compute_scripting_kind(); |
1543 | 846 | 906 | ||
1544 | 847 | expr* cloneImpl(substitution_t& subst) const; | ||
1545 | 848 | |||
1546 | 849 | void accept(expr_visitor&); | 907 | void accept(expr_visitor&); |
1547 | 850 | 908 | ||
1548 | 851 | std::ostream& put(std::ostream&) const; | 909 | std::ostream& put(std::ostream&) const; |
1549 | @@ -934,7 +992,12 @@ | |||
1550 | 934 | std::vector<catch_clause*> theCatchClauses; | 992 | std::vector<catch_clause*> theCatchClauses; |
1551 | 935 | 993 | ||
1552 | 936 | protected: | 994 | protected: |
1554 | 937 | trycatch_expr(CompilerCB* ccb, static_context* sctx, const QueryLoc&, expr* tryExpr); | 995 | trycatch_expr( |
1555 | 996 | CompilerCB* ccb, | ||
1556 | 997 | static_context* sctx, | ||
1557 | 998 | user_function* udf, | ||
1558 | 999 | const QueryLoc&, | ||
1559 | 1000 | expr* tryExpr); | ||
1560 | 938 | 1001 | ||
1561 | 939 | public: | 1002 | public: |
1562 | 940 | expr* get_try_expr() const { return theTryExpr; } | 1003 | expr* get_try_expr() const { return theTryExpr; } |
1563 | @@ -953,8 +1016,6 @@ | |||
1564 | 953 | 1016 | ||
1565 | 954 | void compute_scripting_kind(); | 1017 | void compute_scripting_kind(); |
1566 | 955 | 1018 | ||
1567 | 956 | expr* cloneImpl(substitution_t& subst) const; | ||
1568 | 957 | |||
1569 | 958 | void accept(expr_visitor&); | 1019 | void accept(expr_visitor&); |
1570 | 959 | 1020 | ||
1571 | 960 | std::ostream& put(std::ostream&) const; | 1021 | std::ostream& put(std::ostream&) const; |
1572 | @@ -979,10 +1040,15 @@ | |||
1573 | 979 | friend class ExprManager; | 1040 | friend class ExprManager; |
1574 | 980 | 1041 | ||
1575 | 981 | protected: | 1042 | protected: |
1577 | 982 | expr* theWrappedExpr; | 1043 | expr * theWrappedExpr; |
1578 | 983 | 1044 | ||
1579 | 984 | protected: | 1045 | protected: |
1581 | 985 | wrapper_expr(CompilerCB* ccb, static_context* sctx, const QueryLoc& loc, expr* wrapped); | 1046 | wrapper_expr( |
1582 | 1047 | CompilerCB* ccb, | ||
1583 | 1048 | static_context* sctx, | ||
1584 | 1049 | user_function* udf, | ||
1585 | 1050 | const QueryLoc& loc, | ||
1586 | 1051 | expr* wrapped); | ||
1587 | 986 | 1052 | ||
1588 | 987 | public: | 1053 | public: |
1589 | 988 | expr* get_expr() const { return theWrappedExpr; } | 1054 | expr* get_expr() const { return theWrappedExpr; } |
1590 | @@ -993,8 +1059,6 @@ | |||
1591 | 993 | 1059 | ||
1592 | 994 | void accept(expr_visitor&); | 1060 | void accept(expr_visitor&); |
1593 | 995 | 1061 | ||
1594 | 996 | expr* cloneImpl(substitution_t& s) const; | ||
1595 | 997 | |||
1596 | 998 | std::ostream& put(std::ostream&) const; | 1062 | std::ostream& put(std::ostream&) const; |
1597 | 999 | }; | 1063 | }; |
1598 | 1000 | 1064 | ||
1599 | @@ -1019,10 +1083,13 @@ | |||
1600 | 1019 | function_trace_expr( | 1083 | function_trace_expr( |
1601 | 1020 | CompilerCB* ccb, | 1084 | CompilerCB* ccb, |
1602 | 1021 | static_context* sctx, | 1085 | static_context* sctx, |
1603 | 1086 | user_function* udf, | ||
1604 | 1022 | const QueryLoc& loc, | 1087 | const QueryLoc& loc, |
1605 | 1023 | expr* aChild); | 1088 | expr* aChild); |
1606 | 1024 | 1089 | ||
1608 | 1025 | function_trace_expr(expr* aExpr); | 1090 | function_trace_expr( |
1609 | 1091 | user_function* udf, | ||
1610 | 1092 | expr* aExpr); | ||
1611 | 1026 | 1093 | ||
1612 | 1027 | public: | 1094 | public: |
1613 | 1028 | virtual ~function_trace_expr(); | 1095 | virtual ~function_trace_expr(); |
1614 | @@ -1031,8 +1098,6 @@ | |||
1615 | 1031 | 1098 | ||
1616 | 1032 | void accept(expr_visitor&); | 1099 | void accept(expr_visitor&); |
1617 | 1033 | 1100 | ||
1618 | 1034 | expr* cloneImpl(substitution_t& s) const; | ||
1619 | 1035 | |||
1620 | 1036 | std::ostream& put(std::ostream&) const; | 1101 | std::ostream& put(std::ostream&) const; |
1621 | 1037 | 1102 | ||
1622 | 1038 | expr* get_expr() const { return theExpr; } | 1103 | expr* get_expr() const { return theExpr; } |
1623 | @@ -1133,6 +1198,7 @@ | |||
1624 | 1133 | eval_expr( | 1198 | eval_expr( |
1625 | 1134 | CompilerCB* ccb, | 1199 | CompilerCB* ccb, |
1626 | 1135 | static_context* sctx, | 1200 | static_context* sctx, |
1627 | 1201 | user_function* udf, | ||
1628 | 1136 | const QueryLoc& loc, | 1202 | const QueryLoc& loc, |
1629 | 1137 | expr* e, | 1203 | expr* e, |
1630 | 1138 | expr_script_kind_t scriptingKind, | 1204 | expr_script_kind_t scriptingKind, |
1631 | @@ -1166,8 +1232,6 @@ | |||
1632 | 1166 | 1232 | ||
1633 | 1167 | void accept(expr_visitor&); | 1233 | void accept(expr_visitor&); |
1634 | 1168 | 1234 | ||
1635 | 1169 | expr* cloneImpl(substitution_t& s) const; | ||
1636 | 1170 | |||
1637 | 1171 | std::ostream& put(std::ostream&) const; | 1235 | std::ostream& put(std::ostream&) const; |
1638 | 1172 | }; | 1236 | }; |
1639 | 1173 | 1237 | ||
1640 | @@ -1205,6 +1269,7 @@ | |||
1641 | 1205 | debugger_expr( | 1269 | debugger_expr( |
1642 | 1206 | CompilerCB* ccb, | 1270 | CompilerCB* ccb, |
1643 | 1207 | static_context* sctx, | 1271 | static_context* sctx, |
1644 | 1272 | user_function* udf, | ||
1645 | 1208 | const QueryLoc& loc, | 1273 | const QueryLoc& loc, |
1646 | 1209 | expr* aChild, | 1274 | expr* aChild, |
1647 | 1210 | namespace_context* nsCtx, | 1275 | namespace_context* nsCtx, |
1648 | 1211 | 1276 | ||
1649 | === modified file 'src/compiler/expression/expr_base.cpp' | |||
1650 | --- src/compiler/expression/expr_base.cpp 2012-10-08 12:09:36 +0000 | |||
1651 | +++ src/compiler/expression/expr_base.cpp 2012-10-09 13:35:26 +0000 | |||
1652 | @@ -19,7 +19,6 @@ | |||
1653 | 19 | #include "compiler/expression/expr.h" | 19 | #include "compiler/expression/expr.h" |
1654 | 20 | #include "compiler/expression/fo_expr.h" | 20 | #include "compiler/expression/fo_expr.h" |
1655 | 21 | #include "compiler/expression/flwor_expr.h" | 21 | #include "compiler/expression/flwor_expr.h" |
1656 | 22 | #include "compiler/expression/script_exprs.h" | ||
1657 | 23 | #include "compiler/expression/path_expr.h" | 22 | #include "compiler/expression/path_expr.h" |
1658 | 24 | #include "compiler/expression/expr_iter.h" | 23 | #include "compiler/expression/expr_iter.h" |
1659 | 25 | #include "compiler/expression/expr_visitor.h" | 24 | #include "compiler/expression/expr_visitor.h" |
1660 | @@ -123,13 +122,19 @@ | |||
1661 | 123 | /******************************************************************************* | 122 | /******************************************************************************* |
1662 | 124 | 123 | ||
1663 | 125 | ********************************************************************************/ | 124 | ********************************************************************************/ |
1665 | 126 | expr::expr(CompilerCB* ccb, static_context* sctx, const QueryLoc& loc, expr_kind_t k) | 125 | expr::expr( |
1666 | 126 | CompilerCB* ccb, | ||
1667 | 127 | static_context* sctx, | ||
1668 | 128 | user_function* udf, | ||
1669 | 129 | const QueryLoc& loc, | ||
1670 | 130 | expr_kind_t k) | ||
1671 | 127 | : | 131 | : |
1672 | 132 | theCCB(ccb), | ||
1673 | 128 | theSctx(sctx), | 133 | theSctx(sctx), |
1674 | 134 | theUDF(udf), | ||
1675 | 129 | theLoc(loc), | 135 | theLoc(loc), |
1676 | 130 | theKind(k), | 136 | theKind(k), |
1679 | 131 | theFlags1(0), | 137 | theFlags1(0) |
1678 | 132 | theCCB(ccb) | ||
1680 | 133 | { | 138 | { |
1681 | 134 | theScriptingKind = UNKNOWN_SCRIPTING_KIND; | 139 | theScriptingKind = UNKNOWN_SCRIPTING_KIND; |
1682 | 135 | 140 | ||
1683 | @@ -239,40 +244,6 @@ | |||
1684 | 239 | /******************************************************************************* | 244 | /******************************************************************************* |
1685 | 240 | 245 | ||
1686 | 241 | ********************************************************************************/ | 246 | ********************************************************************************/ |
1687 | 242 | expr* expr::clone() const | ||
1688 | 243 | { | ||
1689 | 244 | substitution_t subst; | ||
1690 | 245 | return clone(subst); | ||
1691 | 246 | } | ||
1692 | 247 | |||
1693 | 248 | |||
1694 | 249 | expr* expr::clone(substitution_t& subst) const | ||
1695 | 250 | { | ||
1696 | 251 | expr* lNewExpr = cloneImpl(subst); | ||
1697 | 252 | |||
1698 | 253 | if (containsPragma()) | ||
1699 | 254 | { | ||
1700 | 255 | lNewExpr->setContainsPragma(ANNOTATION_TRUE); | ||
1701 | 256 | std::vector<pragma*> lPragmas; | ||
1702 | 257 | theCCB->lookup_pragmas(this, lPragmas); | ||
1703 | 258 | for (size_t i = 0; i < lPragmas.size(); ++i) | ||
1704 | 259 | { | ||
1705 | 260 | theCCB->add_pragma(lNewExpr, lPragmas[i]); | ||
1706 | 261 | } | ||
1707 | 262 | } | ||
1708 | 263 | return lNewExpr; | ||
1709 | 264 | } | ||
1710 | 265 | |||
1711 | 266 | |||
1712 | 267 | expr* expr::cloneImpl(substitution_t& subst) const | ||
1713 | 268 | { | ||
1714 | 269 | throw XQUERY_EXCEPTION(zerr::ZXQP0003_INTERNAL_ERROR, ERROR_LOC(get_loc())); | ||
1715 | 270 | } | ||
1716 | 271 | |||
1717 | 272 | |||
1718 | 273 | /******************************************************************************* | ||
1719 | 274 | |||
1720 | 275 | ********************************************************************************/ | ||
1721 | 276 | void expr::accept_children(expr_visitor& v) | 247 | void expr::accept_children(expr_visitor& v) |
1722 | 277 | { | 248 | { |
1723 | 278 | ExprIterator iter(this); | 249 | ExprIterator iter(this); |
1724 | @@ -1212,13 +1183,18 @@ | |||
1725 | 1212 | ********************************************************************************/ | 1183 | ********************************************************************************/ |
1726 | 1213 | xqtref_t expr::get_return_type_with_empty_input(const expr* input) const | 1184 | xqtref_t expr::get_return_type_with_empty_input(const expr* input) const |
1727 | 1214 | { | 1185 | { |
1731 | 1215 | expr* emptyExpr = theCCB->theEM->create_fo_expr(input->get_sctx(), | 1186 | assert(input->get_udf() == theUDF); |
1732 | 1216 | QueryLoc::null, | 1187 | |
1733 | 1217 | GET_BUILTIN_FUNCTION(OP_CONCATENATE_N)); | 1188 | expr* emptyExpr = theCCB->theEM-> |
1734 | 1189 | create_fo_expr(input->get_sctx(), | ||
1735 | 1190 | theUDF, | ||
1736 | 1191 | QueryLoc::null, | ||
1737 | 1192 | GET_BUILTIN_FUNCTION(OP_CONCATENATE_N)); | ||
1738 | 1193 | |||
1739 | 1218 | expr::substitution_t subst; | 1194 | expr::substitution_t subst; |
1740 | 1219 | subst[input] = emptyExpr; | 1195 | subst[input] = emptyExpr; |
1741 | 1220 | 1196 | ||
1743 | 1221 | expr* cloneExpr = clone(subst); | 1197 | expr* cloneExpr = clone(theUDF, subst); |
1744 | 1222 | 1198 | ||
1745 | 1223 | return cloneExpr->get_return_type(); | 1199 | return cloneExpr->get_return_type(); |
1746 | 1224 | } | 1200 | } |
1747 | 1225 | 1201 | ||
1748 | === modified file 'src/compiler/expression/expr_base.h' | |||
1749 | --- src/compiler/expression/expr_base.h 2012-10-08 12:09:36 +0000 | |||
1750 | +++ src/compiler/expression/expr_base.h 2012-10-09 13:35:26 +0000 | |||
1751 | @@ -173,8 +173,12 @@ | |||
1752 | 173 | static expr* * iter_done; | 173 | static expr* * iter_done; |
1753 | 174 | 174 | ||
1754 | 175 | protected: | 175 | protected: |
1755 | 176 | CompilerCB * const theCCB; | ||
1756 | 177 | |||
1757 | 176 | static_context * theSctx; | 178 | static_context * theSctx; |
1758 | 177 | 179 | ||
1759 | 180 | user_function * theUDF; | ||
1760 | 181 | |||
1761 | 178 | QueryLoc theLoc; | 182 | QueryLoc theLoc; |
1762 | 179 | 183 | ||
1763 | 180 | unsigned short theKind; | 184 | unsigned short theKind; |
1764 | @@ -186,8 +190,6 @@ | |||
1765 | 186 | 190 | ||
1766 | 187 | FreeVars theFreeVars; | 191 | FreeVars theFreeVars; |
1767 | 188 | 192 | ||
1768 | 189 | CompilerCB *const theCCB; | ||
1769 | 190 | |||
1770 | 191 | public: | 193 | public: |
1771 | 192 | static bool is_sequential(unsigned short theScriptingKind); | 194 | static bool is_sequential(unsigned short theScriptingKind); |
1772 | 193 | 195 | ||
1773 | @@ -196,14 +198,20 @@ | |||
1774 | 196 | static void checkNonUpdating(const expr* e); | 198 | static void checkNonUpdating(const expr* e); |
1775 | 197 | 199 | ||
1776 | 198 | protected: | 200 | protected: |
1778 | 199 | expr(CompilerCB*, static_context*, const QueryLoc&, expr_kind_t); | 201 | expr(CompilerCB*, static_context*, user_function*, const QueryLoc&, expr_kind_t); |
1779 | 200 | 202 | ||
1781 | 201 | expr() : theSctx(NULL), theFlags1(0), theCCB(NULL) {} | 203 | expr() : theCCB(NULL), theSctx(NULL), theUDF(NULL), theFlags1(0) {} |
1782 | 202 | 204 | ||
1783 | 203 | public: | 205 | public: |
1784 | 204 | virtual ~expr(); | 206 | virtual ~expr(); |
1785 | 205 | 207 | ||
1787 | 206 | CompilerCB* get_ccb() {return theCCB;} | 208 | CompilerCB* get_ccb() { return theCCB; } |
1788 | 209 | |||
1789 | 210 | static_context* get_sctx() const { return theSctx; } | ||
1790 | 211 | |||
1791 | 212 | TypeManager* get_type_manager() const; | ||
1792 | 213 | |||
1793 | 214 | user_function* get_udf() const { return theUDF; } | ||
1794 | 207 | 215 | ||
1795 | 208 | expr_kind_t get_expr_kind() const { return static_cast<expr_kind_t>(theKind); } | 216 | expr_kind_t get_expr_kind() const { return static_cast<expr_kind_t>(theKind); } |
1796 | 209 | 217 | ||
1797 | @@ -211,10 +219,6 @@ | |||
1798 | 211 | 219 | ||
1799 | 212 | void set_loc(const QueryLoc& loc) { theLoc = loc; } | 220 | void set_loc(const QueryLoc& loc) { theLoc = loc; } |
1800 | 213 | 221 | ||
1801 | 214 | static_context* get_sctx() const { return theSctx; } | ||
1802 | 215 | |||
1803 | 216 | TypeManager* get_type_manager() const; | ||
1804 | 217 | |||
1805 | 218 | uint32_t getFlags() const { return theFlags1; } | 222 | uint32_t getFlags() const { return theFlags1; } |
1806 | 219 | 223 | ||
1807 | 220 | void setFlags(uint32_t flags) { theFlags1 = flags; } | 224 | void setFlags(uint32_t flags) { theFlags1 = flags; } |
1808 | @@ -241,11 +245,9 @@ | |||
1809 | 241 | 245 | ||
1810 | 242 | xqtref_t get_return_type(); | 246 | xqtref_t get_return_type(); |
1811 | 243 | 247 | ||
1817 | 244 | expr* clone() const; | 248 | expr* clone(user_function* udf) const; |
1818 | 245 | 249 | ||
1819 | 246 | expr* clone(substitution_t&) const; | 250 | expr* clone(user_function* udf, substitution_t& subst) const; |
1815 | 247 | |||
1816 | 248 | virtual expr* cloneImpl(substitution_t& substitution) const; | ||
1820 | 249 | 251 | ||
1821 | 250 | virtual void accept(expr_visitor& v) = 0; | 252 | virtual void accept(expr_visitor& v) = 0; |
1822 | 251 | 253 | ||
1823 | 252 | 254 | ||
1824 | === added file 'src/compiler/expression/expr_clone.cpp' | |||
1825 | --- src/compiler/expression/expr_clone.cpp 1970-01-01 00:00:00 +0000 | |||
1826 | +++ src/compiler/expression/expr_clone.cpp 2012-10-09 13:35:26 +0000 | |||
1827 | @@ -0,0 +1,790 @@ | |||
1828 | 1 | /* | ||
1829 | 2 | * Copyright 2006-2008 The FLWOR Foundation. | ||
1830 | 3 | * | ||
1831 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | ||
1832 | 5 | * you may not use this file except in compliance with the License. | ||
1833 | 6 | * You may obtain a copy of the License at | ||
1834 | 7 | * | ||
1835 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
1836 | 9 | * | ||
1837 | 10 | * Unless required by applicable law or agreed to in writing, software | ||
1838 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
1839 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
1840 | 13 | * See the License for the specific language governing permissions and | ||
1841 | 14 | * limitations under the License. | ||
1842 | 15 | */ | ||
1843 | 16 | |||
1844 | 17 | #include "compiler/expression/expr_base.h" | ||
1845 | 18 | #include "compiler/expression/update_exprs.h" | ||
1846 | 19 | #include "compiler/expression/expr.h" | ||
1847 | 20 | #include "compiler/expression/fo_expr.h" | ||
1848 | 21 | #include "compiler/expression/flwor_expr.h" | ||
1849 | 22 | #include "compiler/expression/script_exprs.h" | ||
1850 | 23 | #include "compiler/expression/path_expr.h" | ||
1851 | 24 | #include "compiler/expression/json_exprs.h" | ||
1852 | 25 | #include "compiler/expression/function_item_expr.h" | ||
1853 | 26 | #include "compiler/expression/ft_expr.h" | ||
1854 | 27 | #include "compiler/expression/expr_manager.h" | ||
1855 | 28 | |||
1856 | 29 | #include "compiler/api/compilercb.h" | ||
1857 | 30 | |||
1858 | 31 | #include "functions/function.h" | ||
1859 | 32 | |||
1860 | 33 | #include "diagnostics/xquery_diagnostics.h" | ||
1861 | 34 | #include "diagnostics/util_macros.h" | ||
1862 | 35 | |||
1863 | 36 | namespace zorba | ||
1864 | 37 | { | ||
1865 | 38 | |||
1866 | 39 | #define CLONE(e, udf, subst) ((e) == NULL ? NULL : (e)->clone(udf, subst)) | ||
1867 | 40 | |||
1868 | 41 | |||
1869 | 42 | /******************************************************************************* | ||
1870 | 43 | |||
1871 | 44 | ********************************************************************************/ | ||
1872 | 45 | expr* expr::clone(user_function* udf) const | ||
1873 | 46 | { | ||
1874 | 47 | substitution_t subst; | ||
1875 | 48 | return clone(udf, subst); | ||
1876 | 49 | } | ||
1877 | 50 | |||
1878 | 51 | |||
1879 | 52 | expr* expr::clone(user_function* udf, substitution_t& subst) const | ||
1880 | 53 | { | ||
1881 | 54 | expr* newExpr = NULL; | ||
1882 | 55 | |||
1883 | 56 | switch (get_expr_kind()) | ||
1884 | 57 | { | ||
1885 | 58 | case const_expr_kind: | ||
1886 | 59 | { | ||
1887 | 60 | const const_expr* e = static_cast<const const_expr*>(this); | ||
1888 | 61 | |||
1889 | 62 | newExpr = theCCB->theEM-> | ||
1890 | 63 | create_const_expr(theSctx, udf, theLoc, e->theValue); | ||
1891 | 64 | |||
1892 | 65 | break; | ||
1893 | 66 | } | ||
1894 | 67 | case var_expr_kind: | ||
1895 | 68 | { | ||
1896 | 69 | expr::subst_iter_t i = subst.find(this); | ||
1897 | 70 | |||
1898 | 71 | if (i == subst.end()) | ||
1899 | 72 | newExpr = const_cast<expr*>(this); | ||
1900 | 73 | else | ||
1901 | 74 | newExpr = i->second; | ||
1902 | 75 | |||
1903 | 76 | break; | ||
1904 | 77 | } | ||
1905 | 78 | case doc_expr_kind: | ||
1906 | 79 | { | ||
1907 | 80 | const doc_expr* e = static_cast<const doc_expr*>(this); | ||
1908 | 81 | |||
1909 | 82 | newExpr = theCCB->theEM-> | ||
1910 | 83 | create_doc_expr(theSctx, | ||
1911 | 84 | udf, | ||
1912 | 85 | theLoc, | ||
1913 | 86 | CLONE(e->getContent(), udf, subst), | ||
1914 | 87 | e->theCopyInputNodes); | ||
1915 | 88 | break; | ||
1916 | 89 | } | ||
1917 | 90 | case elem_expr_kind: | ||
1918 | 91 | { | ||
1919 | 92 | const elem_expr* e = static_cast<const elem_expr*>(this); | ||
1920 | 93 | |||
1921 | 94 | newExpr = theCCB->theEM-> | ||
1922 | 95 | create_elem_expr(theSctx, | ||
1923 | 96 | udf, | ||
1924 | 97 | theLoc, | ||
1925 | 98 | CLONE(e->getQNameExpr(), udf, subst), | ||
1926 | 99 | CLONE(e->getAttrs(), udf, subst), | ||
1927 | 100 | CLONE(e->getContent(), udf, subst), | ||
1928 | 101 | e->getNSCtx(), | ||
1929 | 102 | e->theCopyInputNodes); | ||
1930 | 103 | break; | ||
1931 | 104 | } | ||
1932 | 105 | case attr_expr_kind: | ||
1933 | 106 | { | ||
1934 | 107 | const attr_expr* e = static_cast<const attr_expr*>(this); | ||
1935 | 108 | |||
1936 | 109 | newExpr = theCCB->theEM-> | ||
1937 | 110 | create_attr_expr(theSctx, | ||
1938 | 111 | udf, | ||
1939 | 112 | theLoc, | ||
1940 | 113 | CLONE(e->getQNameExpr(), udf, subst), | ||
1941 | 114 | CLONE(e->getValueExpr(), udf, subst)); | ||
1942 | 115 | break; | ||
1943 | 116 | } | ||
1944 | 117 | case text_expr_kind: | ||
1945 | 118 | { | ||
1946 | 119 | const text_expr* e = static_cast<const text_expr*>(this); | ||
1947 | 120 | |||
1948 | 121 | newExpr = theCCB->theEM-> | ||
1949 | 122 | create_text_expr(theSctx, | ||
1950 | 123 | udf, | ||
1951 | 124 | theLoc, | ||
1952 | 125 | e->get_type(), | ||
1953 | 126 | CLONE(e->get_text(), udf, subst)); | ||
1954 | 127 | break; | ||
1955 | 128 | } | ||
1956 | 129 | case pi_expr_kind: | ||
1957 | 130 | { | ||
1958 | 131 | const pi_expr* e = static_cast<const pi_expr*>(this); | ||
1959 | 132 | |||
1960 | 133 | newExpr = theCCB->theEM-> | ||
1961 | 134 | create_pi_expr(theSctx, | ||
1962 | 135 | udf, | ||
1963 | 136 | theLoc, | ||
1964 | 137 | CLONE(e->get_target_expr(), udf, subst), | ||
1965 | 138 | CLONE(e->get_content_expr(), udf, subst)); | ||
1966 | 139 | break; | ||
1967 | 140 | } | ||
1968 | 141 | #ifdef ZORBA_WITH_JSON | ||
1969 | 142 | case json_direct_object_expr_kind: | ||
1970 | 143 | { | ||
1971 | 144 | const json_direct_object_expr* e = static_cast<const json_direct_object_expr*>(this); | ||
1972 | 145 | |||
1973 | 146 | std::vector<expr*> names; | ||
1974 | 147 | std::vector<expr*> values; | ||
1975 | 148 | |||
1976 | 149 | names.reserve(e->theNames.size()); | ||
1977 | 150 | values.reserve(e->theValues.size()); | ||
1978 | 151 | |||
1979 | 152 | std::vector<expr*>::const_iterator ite = e->theNames.begin(); | ||
1980 | 153 | std::vector<expr*>::const_iterator end = e->theNames.end(); | ||
1981 | 154 | for (; ite != end; ++ite) | ||
1982 | 155 | { | ||
1983 | 156 | names.push_back((*ite)->clone(udf, subst)); | ||
1984 | 157 | } | ||
1985 | 158 | |||
1986 | 159 | ite = e->theValues.begin(); | ||
1987 | 160 | end = e->theValues.end(); | ||
1988 | 161 | for (; ite != end; ++ite) | ||
1989 | 162 | { | ||
1990 | 163 | values.push_back((*ite)->clone(udf, subst)); | ||
1991 | 164 | } | ||
1992 | 165 | |||
1993 | 166 | newExpr = theCCB->theEM-> | ||
1994 | 167 | create_json_direct_object_expr(theSctx, udf, theLoc, names, values); | ||
1995 | 168 | |||
1996 | 169 | break; | ||
1997 | 170 | } | ||
1998 | 171 | case json_object_expr_kind: | ||
1999 | 172 | { | ||
2000 | 173 | const json_object_expr* e = static_cast<const json_object_expr*>(this); | ||
2001 | 174 | |||
2002 | 175 | newExpr = theCCB->theEM-> | ||
2003 | 176 | create_json_object_expr(theSctx, | ||
2004 | 177 | udf, | ||
2005 | 178 | theLoc, | ||
2006 | 179 | (e->theContentExpr ? | ||
2007 | 180 | e->theContentExpr->clone(udf, subst) : NULL), | ||
2008 | 181 | e->theAccumulate); | ||
2009 | 182 | |||
2010 | 183 | break; | ||
2011 | 184 | } | ||
2012 | 185 | case json_array_expr_kind: | ||
2013 | 186 | { | ||
2014 | 187 | const json_array_expr* e = static_cast<const json_array_expr*>(this); | ||
2015 | 188 | |||
2016 | 189 | newExpr = theCCB->theEM-> | ||
2017 | 190 | create_json_array_expr(theSctx, | ||
2018 | 191 | udf, | ||
2019 | 192 | theLoc, | ||
2020 | 193 | e->theContentExpr->clone(udf, subst)); | ||
2021 | 194 | |||
2022 | 195 | break; | ||
2023 | 196 | } | ||
2024 | 197 | #endif | ||
2025 | 198 | |||
2026 | 199 | case relpath_expr_kind: | ||
2027 | 200 | { | ||
2028 | 201 | const relpath_expr* e = static_cast<const relpath_expr*>(this); | ||
2029 | 202 | |||
2030 | 203 | relpath_expr* cloneExpr = theCCB->theEM-> | ||
2031 | 204 | create_relpath_expr(theSctx, udf, theLoc); | ||
2032 | 205 | |||
2033 | 206 | for (csize i = 0; i < e->size(); ++i) | ||
2034 | 207 | { | ||
2035 | 208 | cloneExpr->add_back((*e)[i]->clone(udf, subst)); | ||
2036 | 209 | } | ||
2037 | 210 | |||
2038 | 211 | newExpr = cloneExpr; | ||
2039 | 212 | break; | ||
2040 | 213 | } | ||
2041 | 214 | case axis_step_expr_kind: | ||
2042 | 215 | { | ||
2043 | 216 | const axis_step_expr* e = static_cast<const axis_step_expr*>(this); | ||
2044 | 217 | |||
2045 | 218 | axis_step_expr* cloneExpr = theCCB->theEM-> | ||
2046 | 219 | create_axis_step_expr(theSctx, udf, theLoc); | ||
2047 | 220 | |||
2048 | 221 | cloneExpr->setAxis(e->getAxis()); | ||
2049 | 222 | cloneExpr->setTest(static_cast<match_expr*>(CLONE(e->getTest(), udf, subst))); | ||
2050 | 223 | cloneExpr->theReverseOrder = e->theReverseOrder; | ||
2051 | 224 | |||
2052 | 225 | newExpr = cloneExpr; | ||
2053 | 226 | break; | ||
2054 | 227 | } | ||
2055 | 228 | case match_expr_kind: | ||
2056 | 229 | { | ||
2057 | 230 | const match_expr* e = static_cast<const match_expr*>(this); | ||
2058 | 231 | |||
2059 | 232 | match_expr* cloneExpr = theCCB->theEM-> | ||
2060 | 233 | create_match_expr(theSctx, udf, theLoc); | ||
2061 | 234 | |||
2062 | 235 | cloneExpr->setTestKind(e->getTestKind()); | ||
2063 | 236 | cloneExpr->setDocTestKind(e->getDocTestKind()); | ||
2064 | 237 | cloneExpr->setWildName(e->getWildName()); | ||
2065 | 238 | cloneExpr->setWildKind(e->getWildKind()); | ||
2066 | 239 | cloneExpr->setQName(e->getQName()); | ||
2067 | 240 | cloneExpr->setTypeName(e->getTypeName()); | ||
2068 | 241 | cloneExpr->setNilledAllowed(e->getNilledAllowed()); | ||
2069 | 242 | |||
2070 | 243 | newExpr = cloneExpr; | ||
2071 | 244 | break; | ||
2072 | 245 | } | ||
2073 | 246 | |||
2074 | 247 | case flwor_expr_kind: | ||
2075 | 248 | case gflwor_expr_kind: | ||
2076 | 249 | { | ||
2077 | 250 | const flwor_expr* e = static_cast<const flwor_expr*>(this); | ||
2078 | 251 | |||
2079 | 252 | flwor_expr* cloneExpr = theCCB->theEM-> | ||
2080 | 253 | create_flwor_expr(theSctx, udf, theLoc, e->theIsGeneral); | ||
2081 | 254 | |||
2082 | 255 | csize numClauses = e->num_clauses(); | ||
2083 | 256 | |||
2084 | 257 | for (csize i = 0; i < numClauses; ++i) | ||
2085 | 258 | { | ||
2086 | 259 | flwor_clause* cloneClause = e->theClauses[i]->clone(udf, subst); | ||
2087 | 260 | |||
2088 | 261 | cloneExpr->add_clause(cloneClause, false); | ||
2089 | 262 | } | ||
2090 | 263 | |||
2091 | 264 | cloneExpr->set_return_expr(e->theReturnExpr->clone(udf, subst)); | ||
2092 | 265 | |||
2093 | 266 | newExpr = cloneExpr; | ||
2094 | 267 | break; | ||
2095 | 268 | } | ||
2096 | 269 | case if_expr_kind: | ||
2097 | 270 | { | ||
2098 | 271 | const if_expr* e = static_cast<const if_expr*>(this); | ||
2099 | 272 | |||
2100 | 273 | newExpr = theCCB->theEM-> | ||
2101 | 274 | create_if_expr(theSctx, | ||
2102 | 275 | udf, | ||
2103 | 276 | theLoc, | ||
2104 | 277 | e->get_cond_expr()->clone(udf, subst), | ||
2105 | 278 | e->get_then_expr()->clone(udf, subst), | ||
2106 | 279 | e->get_else_expr()->clone(udf, subst)); | ||
2107 | 280 | break; | ||
2108 | 281 | } | ||
2109 | 282 | case trycatch_expr_kind: | ||
2110 | 283 | { | ||
2111 | 284 | const trycatch_expr* e = static_cast<const trycatch_expr*>(this); | ||
2112 | 285 | |||
2113 | 286 | trycatch_expr* cloneExpr = theCCB->theEM-> | ||
2114 | 287 | create_trycatch_expr(theSctx, udf, theLoc, e->theTryExpr->clone(udf, subst)); | ||
2115 | 288 | |||
2116 | 289 | for (std::vector<expr*>::const_iterator ite = e->theCatchExprs.begin(); | ||
2117 | 290 | ite != e->theCatchExprs.end(); | ||
2118 | 291 | ++ite) | ||
2119 | 292 | { | ||
2120 | 293 | cloneExpr->add_catch_expr((*ite)->clone(udf, subst)); | ||
2121 | 294 | } | ||
2122 | 295 | |||
2123 | 296 | for (csize i = 0; i < e->clause_count(); ++i) | ||
2124 | 297 | { | ||
2125 | 298 | cloneExpr->add_clause(e->theCatchClauses[i]->clone(subst)); | ||
2126 | 299 | } | ||
2127 | 300 | |||
2128 | 301 | newExpr = cloneExpr; | ||
2129 | 302 | break; | ||
2130 | 303 | } | ||
2131 | 304 | case fo_expr_kind: | ||
2132 | 305 | { | ||
2133 | 306 | const fo_expr* e = static_cast<const fo_expr*>(this); | ||
2134 | 307 | |||
2135 | 308 | if (e->get_func()->getKind() == FunctionConsts::STATIC_COLLECTIONS_DML_COLLECTION_1) | ||
2136 | 309 | { | ||
2137 | 310 | expr::subst_iter_t i = subst.find(this); | ||
2138 | 311 | |||
2139 | 312 | if (i != subst.end()) | ||
2140 | 313 | { | ||
2141 | 314 | newExpr = i->second; | ||
2142 | 315 | break; | ||
2143 | 316 | } | ||
2144 | 317 | } | ||
2145 | 318 | |||
2146 | 319 | fo_expr* cloneExpr = theCCB->theEM-> | ||
2147 | 320 | create_fo_expr(theSctx, udf, theLoc, e->get_func()); | ||
2148 | 321 | |||
2149 | 322 | cloneExpr->theArgs.reserve(e->theArgs.size()); | ||
2150 | 323 | |||
2151 | 324 | for (csize i = 0; i < e->theArgs.size(); ++i) | ||
2152 | 325 | cloneExpr->theArgs.push_back(e->theArgs[i]->clone(udf, subst)); | ||
2153 | 326 | |||
2154 | 327 | cloneExpr->theScriptingKind = e->theScriptingKind; | ||
2155 | 328 | |||
2156 | 329 | newExpr = cloneExpr; | ||
2157 | 330 | break; | ||
2158 | 331 | } | ||
2159 | 332 | case dynamic_function_invocation_expr_kind: | ||
2160 | 333 | { | ||
2161 | 334 | const dynamic_function_invocation_expr* e = | ||
2162 | 335 | static_cast<const dynamic_function_invocation_expr*>(this); | ||
2163 | 336 | |||
2164 | 337 | checked_vector<expr*> newArgs; | ||
2165 | 338 | for (checked_vector<expr*>::const_iterator ite = e->theArgs.begin(); | ||
2166 | 339 | ite != e->theArgs.end(); | ||
2167 | 340 | ++ite) | ||
2168 | 341 | { | ||
2169 | 342 | newArgs.push_back((*ite)->clone(udf, subst)); | ||
2170 | 343 | } | ||
2171 | 344 | |||
2172 | 345 | newExpr = theCCB->theEM-> | ||
2173 | 346 | create_dynamic_function_invocation_expr(theSctx, | ||
2174 | 347 | udf, | ||
2175 | 348 | theLoc, | ||
2176 | 349 | e->theExpr->clone(udf, subst), | ||
2177 | 350 | newArgs); | ||
2178 | 351 | break; | ||
2179 | 352 | } | ||
2180 | 353 | case function_item_expr_kind: | ||
2181 | 354 | { | ||
2182 | 355 | const function_item_expr* e = static_cast<const function_item_expr*>(this); | ||
2183 | 356 | |||
2184 | 357 | function_item_expr* cloneExpr = theCCB->theEM-> | ||
2185 | 358 | create_function_item_expr(theSctx, | ||
2186 | 359 | udf, | ||
2187 | 360 | theLoc, | ||
2188 | 361 | e->theFunction->getName(), | ||
2189 | 362 | e->theFunction.getp(), | ||
2190 | 363 | e->theArity); | ||
2191 | 364 | |||
2192 | 365 | std::vector<expr*> lNewVariables; | ||
2193 | 366 | for (std::vector<expr*>::const_iterator ite = e->theScopedVariables.begin(); | ||
2194 | 367 | ite != e->theScopedVariables.end(); | ||
2195 | 368 | ++ite) | ||
2196 | 369 | { | ||
2197 | 370 | cloneExpr->add_variable((*ite)->clone(udf, subst)); | ||
2198 | 371 | } | ||
2199 | 372 | |||
2200 | 373 | newExpr = cloneExpr; | ||
2201 | 374 | break; | ||
2202 | 375 | } | ||
2203 | 376 | case castable_expr_kind: | ||
2204 | 377 | { | ||
2205 | 378 | const castable_expr* e = static_cast<const castable_expr*>(this); | ||
2206 | 379 | |||
2207 | 380 | newExpr = theCCB->theEM-> | ||
2208 | 381 | create_castable_expr(theSctx, | ||
2209 | 382 | udf, | ||
2210 | 383 | theLoc, | ||
2211 | 384 | e->get_input()->clone(udf, subst), | ||
2212 | 385 | e->get_target_type()); | ||
2213 | 386 | |||
2214 | 387 | break; | ||
2215 | 388 | } | ||
2216 | 389 | case cast_expr_kind: | ||
2217 | 390 | { | ||
2218 | 391 | const cast_expr* e = static_cast<const cast_expr*>(this); | ||
2219 | 392 | |||
2220 | 393 | newExpr = theCCB->theEM-> | ||
2221 | 394 | create_cast_expr(theSctx, | ||
2222 | 395 | udf, | ||
2223 | 396 | theLoc, | ||
2224 | 397 | e->get_input()->clone(udf, subst), | ||
2225 | 398 | e->get_target_type()); | ||
2226 | 399 | break; | ||
2227 | 400 | } | ||
2228 | 401 | case instanceof_expr_kind: | ||
2229 | 402 | { | ||
2230 | 403 | const instanceof_expr* e = static_cast<const instanceof_expr*>(this); | ||
2231 | 404 | |||
2232 | 405 | newExpr = theCCB->theEM-> | ||
2233 | 406 | create_instanceof_expr(theSctx, | ||
2234 | 407 | udf, | ||
2235 | 408 | theLoc, | ||
2236 | 409 | e->get_input()->clone(udf, subst), | ||
2237 | 410 | e->get_target_type()); | ||
2238 | 411 | break; | ||
2239 | 412 | } | ||
2240 | 413 | case treat_expr_kind: | ||
2241 | 414 | { | ||
2242 | 415 | const treat_expr* e = static_cast<const treat_expr*>(this); | ||
2243 | 416 | |||
2244 | 417 | newExpr = theCCB->theEM-> | ||
2245 | 418 | create_treat_expr(theSctx, | ||
2246 | 419 | udf, | ||
2247 | 420 | theLoc, | ||
2248 | 421 | e->get_input()->clone(udf, subst), | ||
2249 | 422 | e->get_target_type(), | ||
2250 | 423 | e->get_err(), | ||
2251 | 424 | e->get_check_prime(), | ||
2252 | 425 | e->get_qname()); | ||
2253 | 426 | break; | ||
2254 | 427 | } | ||
2255 | 428 | case promote_expr_kind: | ||
2256 | 429 | { | ||
2257 | 430 | const promote_expr* e = static_cast<const promote_expr*>(this); | ||
2258 | 431 | |||
2259 | 432 | newExpr = theCCB->theEM-> | ||
2260 | 433 | create_promote_expr(theSctx, | ||
2261 | 434 | udf, | ||
2262 | 435 | theLoc, | ||
2263 | 436 | e->get_input()->clone(udf, subst), | ||
2264 | 437 | e->get_target_type(), | ||
2265 | 438 | e->theErrorKind, | ||
2266 | 439 | e->theQName.getp()); | ||
2267 | 440 | break; | ||
2268 | 441 | } | ||
2269 | 442 | case name_cast_expr_kind: | ||
2270 | 443 | { | ||
2271 | 444 | const name_cast_expr* e = static_cast<const name_cast_expr*>(this); | ||
2272 | 445 | |||
2273 | 446 | newExpr = theCCB->theEM-> | ||
2274 | 447 | create_name_cast_expr(theSctx, | ||
2275 | 448 | udf, | ||
2276 | 449 | theLoc, | ||
2277 | 450 | e->get_input()->clone(udf, subst), | ||
2278 | 451 | e->getNSCtx(), | ||
2279 | 452 | e->theIsAttrName); | ||
2280 | 453 | break; | ||
2281 | 454 | } | ||
2282 | 455 | case validate_expr_kind: | ||
2283 | 456 | { | ||
2284 | 457 | const validate_expr* e = static_cast<const validate_expr*>(this); | ||
2285 | 458 | |||
2286 | 459 | newExpr = theCCB->theEM-> | ||
2287 | 460 | create_validate_expr(theSctx, | ||
2288 | 461 | udf, | ||
2289 | 462 | theLoc, | ||
2290 | 463 | e->get_valmode(), | ||
2291 | 464 | const_cast<store::Item*>(e->get_type_name()), | ||
2292 | 465 | e->get_expr()->clone(udf, subst), | ||
2293 | 466 | e->get_typemgr()); | ||
2294 | 467 | |||
2295 | 468 | break; | ||
2296 | 469 | } | ||
2297 | 470 | case extension_expr_kind: | ||
2298 | 471 | { | ||
2299 | 472 | const extension_expr* e = static_cast<const extension_expr*>(this); | ||
2300 | 473 | |||
2301 | 474 | extension_expr* cloneExpr; | ||
2302 | 475 | if(e->theExpr == 0) | ||
2303 | 476 | { | ||
2304 | 477 | cloneExpr = theCCB->theEM->create_extension_expr(theSctx, udf, theLoc); | ||
2305 | 478 | } | ||
2306 | 479 | else | ||
2307 | 480 | { | ||
2308 | 481 | cloneExpr = theCCB->theEM-> | ||
2309 | 482 | create_extension_expr(theSctx, udf, theLoc, e->theExpr->clone(udf, subst)); | ||
2310 | 483 | } | ||
2311 | 484 | |||
2312 | 485 | // pragma doesn't contain expressions. Thus, it is not cloned. | ||
2313 | 486 | for (std::vector<pragma*>::const_iterator lIter = e->thePragmas.begin(); | ||
2314 | 487 | lIter != e->thePragmas.end(); | ||
2315 | 488 | ++lIter) | ||
2316 | 489 | { | ||
2317 | 490 | cloneExpr->add(*lIter); | ||
2318 | 491 | } | ||
2319 | 492 | |||
2320 | 493 | newExpr = cloneExpr; | ||
2321 | 494 | break; | ||
2322 | 495 | } | ||
2323 | 496 | case order_expr_kind: | ||
2324 | 497 | { | ||
2325 | 498 | const order_expr* e = static_cast<const order_expr*>(this); | ||
2326 | 499 | |||
2327 | 500 | newExpr = theCCB->theEM-> | ||
2328 | 501 | create_order_expr(theSctx, | ||
2329 | 502 | udf, | ||
2330 | 503 | theLoc, | ||
2331 | 504 | e->get_type(), | ||
2332 | 505 | e->get_expr()->clone(udf, subst)); | ||
2333 | 506 | break; | ||
2334 | 507 | } | ||
2335 | 508 | #ifndef ZORBA_NO_FULL_TEXT | ||
2336 | 509 | case ft_expr_kind: | ||
2337 | 510 | { | ||
2338 | 511 | const ftcontains_expr* e = static_cast<const ftcontains_expr*>(this); | ||
2339 | 512 | |||
2340 | 513 | newExpr = theCCB->theEM-> | ||
2341 | 514 | create_ftcontains_expr(theSctx, | ||
2342 | 515 | udf, | ||
2343 | 516 | theLoc, | ||
2344 | 517 | e->range_->clone(udf, subst), | ||
2345 | 518 | e->ftselection_->clone(udf, subst).release(), | ||
2346 | 519 | (e->ftignore_ == NULL ? 0 : e->ftignore_->clone(udf, subst))); | ||
2347 | 520 | |||
2348 | 521 | break; | ||
2349 | 522 | } | ||
2350 | 523 | #endif /* ZORBA_NO_FULL_TEXT */ | ||
2351 | 524 | |||
2352 | 525 | case delete_expr_kind: | ||
2353 | 526 | { | ||
2354 | 527 | const delete_expr* e = static_cast<const delete_expr*>(this); | ||
2355 | 528 | |||
2356 | 529 | newExpr = theCCB->theEM-> | ||
2357 | 530 | create_delete_expr(theSctx, udf, theLoc, e->getTargetExpr()->clone(udf, subst)); | ||
2358 | 531 | |||
2359 | 532 | break; | ||
2360 | 533 | } | ||
2361 | 534 | case insert_expr_kind: | ||
2362 | 535 | { | ||
2363 | 536 | const insert_expr* e = static_cast<const insert_expr*>(this); | ||
2364 | 537 | |||
2365 | 538 | newExpr = theCCB->theEM-> | ||
2366 | 539 | create_insert_expr(theSctx, | ||
2367 | 540 | udf, | ||
2368 | 541 | theLoc, | ||
2369 | 542 | e->getType(), | ||
2370 | 543 | e->getSourceExpr()->clone(udf, subst), | ||
2371 | 544 | e->getTargetExpr()->clone(udf, subst)); | ||
2372 | 545 | break; | ||
2373 | 546 | } | ||
2374 | 547 | case rename_expr_kind: | ||
2375 | 548 | { | ||
2376 | 549 | const rename_expr* e = static_cast<const rename_expr*>(this); | ||
2377 | 550 | |||
2378 | 551 | newExpr = theCCB->theEM-> | ||
2379 | 552 | create_rename_expr(theSctx, | ||
2380 | 553 | udf, | ||
2381 | 554 | theLoc, | ||
2382 | 555 | e->getTargetExpr()->clone(udf, subst), | ||
2383 | 556 | e->getNameExpr()->clone(udf, subst)); | ||
2384 | 557 | break; | ||
2385 | 558 | } | ||
2386 | 559 | case replace_expr_kind: | ||
2387 | 560 | { | ||
2388 | 561 | const zorba::replace_expr* e = static_cast<const zorba::replace_expr*>(this); | ||
2389 | 562 | |||
2390 | 563 | newExpr = theCCB->theEM-> | ||
2391 | 564 | create_replace_expr(theSctx, | ||
2392 | 565 | udf, | ||
2393 | 566 | theLoc, | ||
2394 | 567 | e->getType(), | ||
2395 | 568 | e->getTargetExpr()->clone(udf, subst), | ||
2396 | 569 | e->getReplaceExpr()->clone(udf, subst)); | ||
2397 | 570 | break; | ||
2398 | 571 | } | ||
2399 | 572 | case transform_expr_kind: | ||
2400 | 573 | { | ||
2401 | 574 | const transform_expr* e = static_cast<const transform_expr*>(this); | ||
2402 | 575 | |||
2403 | 576 | ZORBA_ASSERT(e->theModifyExpr && e->theReturnExpr); | ||
2404 | 577 | |||
2405 | 578 | transform_expr* cloneExpr = theCCB->theEM-> | ||
2406 | 579 | create_transform_expr(theSctx, udf, theLoc); | ||
2407 | 580 | |||
2408 | 581 | for (std::vector<copy_clause*>::const_iterator ite = e->theCopyClauses.begin(); | ||
2409 | 582 | ite != e->theCopyClauses.end(); | ||
2410 | 583 | ++ite) | ||
2411 | 584 | { | ||
2412 | 585 | cloneExpr->add_back((*ite)->clone(udf, subst)); | ||
2413 | 586 | } | ||
2414 | 587 | |||
2415 | 588 | cloneExpr->setModifyExpr(e->theModifyExpr->clone(udf, subst)); | ||
2416 | 589 | cloneExpr->setReturnExpr(e->theReturnExpr->clone(udf, subst)); | ||
2417 | 590 | |||
2418 | 591 | newExpr = cloneExpr; | ||
2419 | 592 | break; | ||
2420 | 593 | } | ||
2421 | 594 | |||
2422 | 595 | case block_expr_kind: | ||
2423 | 596 | { | ||
2424 | 597 | const block_expr* e = static_cast<const block_expr*>(this); | ||
2425 | 598 | |||
2426 | 599 | checked_vector<expr*> seq2; | ||
2427 | 600 | for (csize i = 0; i < e->theArgs.size(); ++i) | ||
2428 | 601 | seq2.push_back(e->theArgs[i]->clone(udf, subst)); | ||
2429 | 602 | |||
2430 | 603 | newExpr = theCCB->theEM-> | ||
2431 | 604 | create_block_expr(theSctx, udf, theLoc, true, seq2, NULL); | ||
2432 | 605 | |||
2433 | 606 | break; | ||
2434 | 607 | } | ||
2435 | 608 | case var_decl_expr_kind: | ||
2436 | 609 | { | ||
2437 | 610 | const var_decl_expr* e = static_cast<const var_decl_expr*>(this); | ||
2438 | 611 | |||
2439 | 612 | var_expr* varCopy = theCCB->theEM->create_var_expr(udf, *e->theVarExpr); | ||
2440 | 613 | subst[e->theVarExpr] = varCopy; | ||
2441 | 614 | |||
2442 | 615 | newExpr = theCCB->theEM-> | ||
2443 | 616 | create_var_decl_expr(theSctx, | ||
2444 | 617 | udf, | ||
2445 | 618 | theLoc, | ||
2446 | 619 | varCopy, | ||
2447 | 620 | (e->theInitExpr ? e->theInitExpr->clone(udf, subst) : NULL)); | ||
2448 | 621 | |||
2449 | 622 | break; | ||
2450 | 623 | } | ||
2451 | 624 | case var_set_expr_kind: | ||
2452 | 625 | { | ||
2453 | 626 | const var_set_expr* e = static_cast<const var_set_expr*>(this); | ||
2454 | 627 | |||
2455 | 628 | expr* varClone = e->theVarExpr->clone(udf, subst); | ||
2456 | 629 | |||
2457 | 630 | ZORBA_ASSERT(varClone->get_expr_kind() == var_expr_kind); | ||
2458 | 631 | |||
2459 | 632 | newExpr = theCCB->theEM-> | ||
2460 | 633 | create_var_set_expr(theSctx, | ||
2461 | 634 | udf, | ||
2462 | 635 | theLoc, | ||
2463 | 636 | static_cast<var_expr*>(varClone), | ||
2464 | 637 | e->theExpr->clone(udf, subst)); | ||
2465 | 638 | break; | ||
2466 | 639 | } | ||
2467 | 640 | case apply_expr_kind: | ||
2468 | 641 | { | ||
2469 | 642 | const apply_expr* e = static_cast<const apply_expr*>(this); | ||
2470 | 643 | |||
2471 | 644 | newExpr = theCCB->theEM-> | ||
2472 | 645 | create_apply_expr(theSctx, | ||
2473 | 646 | udf, | ||
2474 | 647 | theLoc, | ||
2475 | 648 | e->theExpr->clone(udf, subst), | ||
2476 | 649 | e->theDiscardXDM); | ||
2477 | 650 | |||
2478 | 651 | break; | ||
2479 | 652 | } | ||
2480 | 653 | case exit_expr_kind: | ||
2481 | 654 | { | ||
2482 | 655 | const exit_expr* e = static_cast<const exit_expr*>(this); | ||
2483 | 656 | |||
2484 | 657 | newExpr = theCCB->theEM-> | ||
2485 | 658 | create_exit_expr(theSctx, udf, theLoc, e->get_expr()->clone(udf, subst)); | ||
2486 | 659 | |||
2487 | 660 | subst[this] = newExpr; | ||
2488 | 661 | |||
2489 | 662 | break; | ||
2490 | 663 | } | ||
2491 | 664 | case exit_catcher_expr_kind: | ||
2492 | 665 | { | ||
2493 | 666 | const exit_catcher_expr* e = static_cast<const exit_catcher_expr*>(this); | ||
2494 | 667 | |||
2495 | 668 | expr* clonedInput = e->get_expr()->clone(udf, subst); | ||
2496 | 669 | |||
2497 | 670 | std::vector<expr*> clonedExits; | ||
2498 | 671 | std::vector<expr*>::const_iterator ite = e->theExitExprs.begin(); | ||
2499 | 672 | std::vector<expr*>::const_iterator end = e->theExitExprs.end(); | ||
2500 | 673 | for (; ite != end; ++ite) | ||
2501 | 674 | { | ||
2502 | 675 | assert(subst.find(*ite) != subst.end()); | ||
2503 | 676 | |||
2504 | 677 | clonedExits.push_back(subst[*ite]); | ||
2505 | 678 | } | ||
2506 | 679 | |||
2507 | 680 | newExpr = theCCB->theEM-> | ||
2508 | 681 | create_exit_catcher_expr(theSctx, udf, theLoc, clonedInput, clonedExits); | ||
2509 | 682 | |||
2510 | 683 | break; | ||
2511 | 684 | } | ||
2512 | 685 | case flowctl_expr_kind: | ||
2513 | 686 | { | ||
2514 | 687 | const flowctl_expr* e = static_cast<const flowctl_expr*>(this); | ||
2515 | 688 | |||
2516 | 689 | newExpr = theCCB->theEM-> | ||
2517 | 690 | create_flowctl_expr(theSctx, udf, theLoc, e->get_action()); | ||
2518 | 691 | |||
2519 | 692 | break; | ||
2520 | 693 | } | ||
2521 | 694 | case while_expr_kind: | ||
2522 | 695 | { | ||
2523 | 696 | const while_expr* e = static_cast<const while_expr*>(this); | ||
2524 | 697 | |||
2525 | 698 | newExpr = theCCB->theEM-> | ||
2526 | 699 | create_while_expr(theSctx, udf, theLoc, e->get_body()->clone(udf, subst)); | ||
2527 | 700 | |||
2528 | 701 | break; | ||
2529 | 702 | } | ||
2530 | 703 | case eval_expr_kind: | ||
2531 | 704 | { | ||
2532 | 705 | const eval_expr* e = static_cast<const eval_expr*>(this); | ||
2533 | 706 | |||
2534 | 707 | newExpr = theCCB->theEM-> | ||
2535 | 708 | create_eval_expr(theSctx, | ||
2536 | 709 | udf, | ||
2537 | 710 | theLoc, | ||
2538 | 711 | e->theExpr->clone(udf, subst), | ||
2539 | 712 | e->theInnerScriptingKind, | ||
2540 | 713 | e->theNSCtx.getp()); | ||
2541 | 714 | |||
2542 | 715 | eval_expr* newEval = static_cast<eval_expr*>(newExpr); | ||
2543 | 716 | |||
2544 | 717 | newEval->setNodeCopy(e->theDoNodeCopy); | ||
2545 | 718 | |||
2546 | 719 | newEval->theOuterVarNames = e->theOuterVarNames; | ||
2547 | 720 | newEval->theOuterVarTypes = e->theOuterVarTypes; | ||
2548 | 721 | |||
2549 | 722 | csize numVars = e->theOuterVarNames.size(); | ||
2550 | 723 | |||
2551 | 724 | newEval->theArgs.resize(numVars); | ||
2552 | 725 | |||
2553 | 726 | for (csize i = 0; i < numVars; ++i) | ||
2554 | 727 | { | ||
2555 | 728 | newEval->theArgs[i] = e->theArgs[i]->clone(udf, subst); | ||
2556 | 729 | } | ||
2557 | 730 | |||
2558 | 731 | break; | ||
2559 | 732 | } | ||
2560 | 733 | case wrapper_expr_kind: | ||
2561 | 734 | { | ||
2562 | 735 | const wrapper_expr* e = static_cast<const wrapper_expr*>(this); | ||
2563 | 736 | |||
2564 | 737 | expr* wrappedClone = e->theWrappedExpr->clone(udf, subst); | ||
2565 | 738 | |||
2566 | 739 | if (e->theWrappedExpr->get_expr_kind() == var_expr_kind && | ||
2567 | 740 | wrappedClone->get_expr_kind() != var_expr_kind) | ||
2568 | 741 | { | ||
2569 | 742 | newExpr = wrappedClone; | ||
2570 | 743 | } | ||
2571 | 744 | else | ||
2572 | 745 | { | ||
2573 | 746 | newExpr = theCCB->theEM->create_wrapper_expr(theSctx, udf, theLoc, wrappedClone); | ||
2574 | 747 | } | ||
2575 | 748 | |||
2576 | 749 | break; | ||
2577 | 750 | } | ||
2578 | 751 | case function_trace_expr_kind: | ||
2579 | 752 | { | ||
2580 | 753 | const function_trace_expr* e = static_cast<const function_trace_expr*>(this); | ||
2581 | 754 | |||
2582 | 755 | function_trace_expr* cloneExpr = theCCB->theEM-> | ||
2583 | 756 | create_function_trace_expr(udf, e->theExpr->clone(udf, subst)); | ||
2584 | 757 | |||
2585 | 758 | cloneExpr->theFunctionName = e->theFunctionName; | ||
2586 | 759 | cloneExpr->theFunctionLocation = e->theFunctionLocation; | ||
2587 | 760 | cloneExpr->theFunctionCallLocation = e->theFunctionCallLocation; | ||
2588 | 761 | cloneExpr->theFunctionArity = e->theFunctionArity; | ||
2589 | 762 | |||
2590 | 763 | newExpr = cloneExpr; | ||
2591 | 764 | break; | ||
2592 | 765 | } | ||
2593 | 766 | case debugger_expr_kind: | ||
2594 | 767 | default: | ||
2595 | 768 | { | ||
2596 | 769 | RAISE_ERROR(zerr::ZXQP0003_INTERNAL_ERROR, theLoc, | ||
2597 | 770 | ERROR_PARAMS(ZED(CloneNotImplemented))); | ||
2598 | 771 | } | ||
2599 | 772 | } | ||
2600 | 773 | |||
2601 | 774 | if (containsPragma()) | ||
2602 | 775 | { | ||
2603 | 776 | newExpr->setContainsPragma(ANNOTATION_TRUE); | ||
2604 | 777 | |||
2605 | 778 | std::vector<pragma*> pragmas; | ||
2606 | 779 | theCCB->lookup_pragmas(this, pragmas); | ||
2607 | 780 | |||
2608 | 781 | for (csize i = 0; i < pragmas.size(); ++i) | ||
2609 | 782 | { | ||
2610 | 783 | theCCB->add_pragma(newExpr, pragmas[i]); | ||
2611 | 784 | } | ||
2612 | 785 | } | ||
2613 | 786 | |||
2614 | 787 | return newExpr; | ||
2615 | 788 | } | ||
2616 | 789 | |||
2617 | 790 | } | ||
2618 | 0 | 791 | ||
2619 | === modified file 'src/compiler/expression/expr_manager.cpp' | |||
2620 | --- src/compiler/expression/expr_manager.cpp 2012-10-08 12:09:36 +0000 | |||
2621 | +++ src/compiler/expression/expr_manager.cpp 2012-10-09 13:35:26 +0000 | |||
2622 | @@ -35,60 +35,6 @@ | |||
2623 | 35 | namespace zorba | 35 | namespace zorba |
2624 | 36 | { | 36 | { |
2625 | 37 | 37 | ||
2626 | 38 | #if 0 | ||
2627 | 39 | //A simple expression that can just be deallocated without calling the | ||
2628 | 40 | //destructor. | ||
2629 | 41 | class NullExpr : public expr | ||
2630 | 42 | { | ||
2631 | 43 | public: | ||
2632 | 44 | NullExpr() : expr(NULL, NULL, QueryLoc(), unknown_expr_kind) {} | ||
2633 | 45 | |||
2634 | 46 | void accept(expr_visitor& v) {} | ||
2635 | 47 | |||
2636 | 48 | void compute_scripting_kind() {} | ||
2637 | 49 | |||
2638 | 50 | std::ostream& put(std::ostream& stream) const { return stream; } | ||
2639 | 51 | }; | ||
2640 | 52 | |||
2641 | 53 | |||
2642 | 54 | class NullFlworClause : public flwor_clause | ||
2643 | 55 | { | ||
2644 | 56 | public: | ||
2645 | 57 | //it being a let clause is arbitrary, it doesn't matter what type it is. | ||
2646 | 58 | NullFlworClause() :flwor_clause(NULL, NULL, QueryLoc(), flwor_clause::let_clause) {} | ||
2647 | 59 | |||
2648 | 60 | std::ostream& put(std::ostream& stream) const { return stream; } | ||
2649 | 61 | |||
2650 | 62 | flwor_clause* clone(expr::substitution_t &) const { return NULL; } | ||
2651 | 63 | }; | ||
2652 | 64 | |||
2653 | 65 | |||
2654 | 66 | class NullWincond : public flwor_wincond | ||
2655 | 67 | { | ||
2656 | 68 | public: | ||
2657 | 69 | NullWincond() : flwor_wincond(NULL, NULL, false, vars(), vars(), NULL) {} | ||
2658 | 70 | |||
2659 | 71 | std::ostream& put(std::ostream& stream) const { return stream; } | ||
2660 | 72 | }; | ||
2661 | 73 | |||
2662 | 74 | |||
2663 | 75 | class NullCatchClause : public catch_clause | ||
2664 | 76 | { | ||
2665 | 77 | public: | ||
2666 | 78 | NullCatchClause() : catch_clause(NULL) {} | ||
2667 | 79 | |||
2668 | 80 | std::ostream& put(std::ostream& stream) const{return stream;} | ||
2669 | 81 | }; | ||
2670 | 82 | |||
2671 | 83 | |||
2672 | 84 | class NullCopyClause : public copy_clause | ||
2673 | 85 | { | ||
2674 | 86 | public: | ||
2675 | 87 | NullCopyClause() : copy_clause(NULL, NULL, NULL) {} | ||
2676 | 88 | }; | ||
2677 | 89 | #endif | ||
2678 | 90 | |||
2679 | 91 | |||
2680 | 92 | ExprManager::ExprManager(CompilerCB* ccb) | 38 | ExprManager::ExprManager(CompilerCB* ccb) |
2681 | 93 | : | 39 | : |
2682 | 94 | theCCB(ccb) | 40 | theCCB(ccb) |
2683 | @@ -219,49 +165,54 @@ | |||
2684 | 219 | 165 | ||
2685 | 220 | if_expr* ExprManager::create_if_expr( | 166 | if_expr* ExprManager::create_if_expr( |
2686 | 221 | static_context* sctx, | 167 | static_context* sctx, |
2687 | 168 | user_function* udf, | ||
2688 | 222 | const QueryLoc& loc, | 169 | const QueryLoc& loc, |
2689 | 223 | expr* cond_expr, | 170 | expr* cond_expr, |
2690 | 224 | expr* then_expr, | 171 | expr* then_expr, |
2691 | 225 | expr* else_expr) | 172 | expr* else_expr) |
2692 | 226 | { | 173 | { |
2694 | 227 | CREATE_AND_RETURN_EXPR(if_expr, sctx, loc, cond_expr, then_expr, else_expr); | 174 | CREATE_AND_RETURN_EXPR(if_expr, sctx, udf, loc, cond_expr, then_expr, else_expr); |
2695 | 228 | } | 175 | } |
2696 | 229 | 176 | ||
2697 | 230 | 177 | ||
2698 | 231 | order_expr* ExprManager::create_order_expr( | 178 | order_expr* ExprManager::create_order_expr( |
2699 | 232 | static_context* sctx, | 179 | static_context* sctx, |
2700 | 180 | user_function* udf, | ||
2701 | 233 | const QueryLoc& loc, | 181 | const QueryLoc& loc, |
2702 | 234 | order_expr::order_type_t order, | 182 | order_expr::order_type_t order, |
2703 | 235 | expr* exp) | 183 | expr* exp) |
2704 | 236 | { | 184 | { |
2706 | 237 | CREATE_AND_RETURN_EXPR(order_expr, sctx, loc, order, exp); | 185 | CREATE_AND_RETURN_EXPR(order_expr, sctx, udf, loc, order, exp); |
2707 | 238 | } | 186 | } |
2708 | 239 | 187 | ||
2709 | 240 | 188 | ||
2710 | 241 | validate_expr* ExprManager::create_validate_expr( | 189 | validate_expr* ExprManager::create_validate_expr( |
2711 | 242 | static_context* sctx, | 190 | static_context* sctx, |
2712 | 191 | user_function* udf, | ||
2713 | 243 | const QueryLoc& loc, | 192 | const QueryLoc& loc, |
2714 | 244 | ParseConstants::validation_mode_t mode, | 193 | ParseConstants::validation_mode_t mode, |
2715 | 245 | const store::Item_t& aTypeName, | 194 | const store::Item_t& aTypeName, |
2716 | 246 | expr* validated, | 195 | expr* validated, |
2717 | 247 | rchandle<TypeManager> tm) | 196 | rchandle<TypeManager> tm) |
2718 | 248 | { | 197 | { |
2720 | 249 | CREATE_AND_RETURN_EXPR(validate_expr, sctx, loc, mode, aTypeName, validated, tm); | 198 | CREATE_AND_RETURN_EXPR(validate_expr, sctx, udf, loc, mode, aTypeName, validated, tm); |
2721 | 250 | } | 199 | } |
2722 | 251 | 200 | ||
2723 | 252 | 201 | ||
2724 | 253 | cast_expr* ExprManager::create_cast_expr( | 202 | cast_expr* ExprManager::create_cast_expr( |
2725 | 254 | static_context* sctx, | 203 | static_context* sctx, |
2726 | 204 | user_function* udf, | ||
2727 | 255 | const QueryLoc& loc, | 205 | const QueryLoc& loc, |
2728 | 256 | expr* casted, | 206 | expr* casted, |
2729 | 257 | xqtref_t type) | 207 | xqtref_t type) |
2730 | 258 | { | 208 | { |
2732 | 259 | CREATE_AND_RETURN_EXPR(cast_expr, sctx, loc, casted, type); | 209 | CREATE_AND_RETURN_EXPR(cast_expr, sctx, udf, loc, casted, type); |
2733 | 260 | } | 210 | } |
2734 | 261 | 211 | ||
2735 | 262 | 212 | ||
2736 | 263 | treat_expr* ExprManager::create_treat_expr( | 213 | treat_expr* ExprManager::create_treat_expr( |
2737 | 264 | static_context* sctx, | 214 | static_context* sctx, |
2738 | 215 | user_function* udf, | ||
2739 | 265 | const QueryLoc& loc, | 216 | const QueryLoc& loc, |
2740 | 266 | expr* treated, | 217 | expr* treated, |
2741 | 267 | const xqtref_t& type, | 218 | const xqtref_t& type, |
2742 | @@ -270,67 +221,73 @@ | |||
2743 | 270 | store::Item* qname) | 221 | store::Item* qname) |
2744 | 271 | { | 222 | { |
2745 | 272 | CREATE_AND_RETURN_EXPR(treat_expr, | 223 | CREATE_AND_RETURN_EXPR(treat_expr, |
2747 | 273 | sctx, loc, treated, type, err, check_prime, qname); | 224 | sctx, udf, loc, treated, type, err, check_prime, qname); |
2748 | 274 | } | 225 | } |
2749 | 275 | 226 | ||
2750 | 276 | 227 | ||
2751 | 277 | promote_expr* ExprManager::create_promote_expr( | 228 | promote_expr* ExprManager::create_promote_expr( |
2752 | 278 | static_context* sctx, | 229 | static_context* sctx, |
2753 | 230 | user_function* udf, | ||
2754 | 279 | const QueryLoc& loc, | 231 | const QueryLoc& loc, |
2755 | 280 | expr* promoted, | 232 | expr* promoted, |
2756 | 281 | const xqtref_t& type, | 233 | const xqtref_t& type, |
2757 | 282 | PromoteIterator::ErrorKind err, | 234 | PromoteIterator::ErrorKind err, |
2758 | 283 | store::Item* qname) | 235 | store::Item* qname) |
2759 | 284 | { | 236 | { |
2761 | 285 | CREATE_AND_RETURN_EXPR(promote_expr, sctx, loc, promoted, type, err, qname); | 237 | CREATE_AND_RETURN_EXPR(promote_expr, sctx, udf, loc, promoted, type, err, qname); |
2762 | 286 | } | 238 | } |
2763 | 287 | 239 | ||
2764 | 288 | 240 | ||
2765 | 289 | castable_expr* ExprManager::create_castable_expr( | 241 | castable_expr* ExprManager::create_castable_expr( |
2766 | 290 | static_context* sctx, | 242 | static_context* sctx, |
2767 | 243 | user_function* udf, | ||
2768 | 291 | const QueryLoc& loc, | 244 | const QueryLoc& loc, |
2769 | 292 | expr* castable, | 245 | expr* castable, |
2770 | 293 | xqtref_t type) | 246 | xqtref_t type) |
2771 | 294 | { | 247 | { |
2773 | 295 | CREATE_AND_RETURN_EXPR(castable_expr, sctx, loc, castable, type); | 248 | CREATE_AND_RETURN_EXPR(castable_expr, sctx, udf, loc, castable, type); |
2774 | 296 | } | 249 | } |
2775 | 297 | 250 | ||
2776 | 298 | 251 | ||
2777 | 299 | instanceof_expr* ExprManager::create_instanceof_expr( | 252 | instanceof_expr* ExprManager::create_instanceof_expr( |
2778 | 300 | static_context* sctx, | 253 | static_context* sctx, |
2779 | 254 | user_function* udf, | ||
2780 | 301 | const QueryLoc& loc, | 255 | const QueryLoc& loc, |
2781 | 302 | expr* instanced, | 256 | expr* instanced, |
2782 | 303 | xqtref_t type, | 257 | xqtref_t type, |
2783 | 304 | bool checkPrimeOnly) | 258 | bool checkPrimeOnly) |
2784 | 305 | { | 259 | { |
2785 | 306 | CREATE_AND_RETURN_EXPR(instanceof_expr, | 260 | CREATE_AND_RETURN_EXPR(instanceof_expr, |
2787 | 307 | sctx, loc, instanced, type, checkPrimeOnly); | 261 | sctx, udf, loc, instanced, type, checkPrimeOnly); |
2788 | 308 | } | 262 | } |
2789 | 309 | 263 | ||
2790 | 310 | 264 | ||
2791 | 311 | name_cast_expr* ExprManager::create_name_cast_expr( | 265 | name_cast_expr* ExprManager::create_name_cast_expr( |
2792 | 312 | static_context* sctx, | 266 | static_context* sctx, |
2793 | 267 | user_function* udf, | ||
2794 | 313 | const QueryLoc& loc, | 268 | const QueryLoc& loc, |
2795 | 314 | expr* casted, | 269 | expr* casted, |
2796 | 315 | const namespace_context* ns, | 270 | const namespace_context* ns, |
2797 | 316 | bool isAttr) | 271 | bool isAttr) |
2798 | 317 | { | 272 | { |
2800 | 318 | CREATE_AND_RETURN_EXPR(name_cast_expr, sctx, loc, casted, ns, isAttr); | 273 | CREATE_AND_RETURN_EXPR(name_cast_expr, sctx, udf, loc, casted, ns, isAttr); |
2801 | 319 | } | 274 | } |
2802 | 320 | 275 | ||
2803 | 321 | 276 | ||
2804 | 322 | doc_expr* ExprManager::create_doc_expr( | 277 | doc_expr* ExprManager::create_doc_expr( |
2805 | 323 | static_context* sctx, | 278 | static_context* sctx, |
2806 | 279 | user_function* udf, | ||
2807 | 324 | const QueryLoc& loc, | 280 | const QueryLoc& loc, |
2808 | 325 | expr* content, | 281 | expr* content, |
2809 | 326 | bool copyNodes) | 282 | bool copyNodes) |
2810 | 327 | { | 283 | { |
2812 | 328 | CREATE_AND_RETURN_EXPR(doc_expr, sctx, loc, content, copyNodes); | 284 | CREATE_AND_RETURN_EXPR(doc_expr, sctx, udf, loc, content, copyNodes); |
2813 | 329 | } | 285 | } |
2814 | 330 | 286 | ||
2815 | 331 | 287 | ||
2816 | 332 | elem_expr* ExprManager::create_elem_expr( | 288 | elem_expr* ExprManager::create_elem_expr( |
2817 | 333 | static_context* sctx, | 289 | static_context* sctx, |
2818 | 290 | user_function* udf, | ||
2819 | 334 | const QueryLoc& loc, | 291 | const QueryLoc& loc, |
2820 | 335 | expr* qnameExpr, | 292 | expr* qnameExpr, |
2821 | 336 | expr* attrs, | 293 | expr* attrs, |
2822 | @@ -339,12 +296,13 @@ | |||
2823 | 339 | bool copyNodes) | 296 | bool copyNodes) |
2824 | 340 | { | 297 | { |
2825 | 341 | CREATE_AND_RETURN_EXPR(elem_expr, | 298 | CREATE_AND_RETURN_EXPR(elem_expr, |
2827 | 342 | sctx, loc, qnameExpr, attrs, content, nsCtx, copyNodes); | 299 | sctx, udf, loc, qnameExpr, attrs, content, nsCtx, copyNodes); |
2828 | 343 | } | 300 | } |
2829 | 344 | 301 | ||
2830 | 345 | 302 | ||
2831 | 346 | elem_expr* ExprManager::create_elem_expr( | 303 | elem_expr* ExprManager::create_elem_expr( |
2832 | 347 | static_context* sctx, | 304 | static_context* sctx, |
2833 | 305 | user_function* udf, | ||
2834 | 348 | const QueryLoc& loc, | 306 | const QueryLoc& loc, |
2835 | 349 | expr* qnameExpr, | 307 | expr* qnameExpr, |
2836 | 350 | expr* content, | 308 | expr* content, |
2837 | @@ -352,137 +310,151 @@ | |||
2838 | 352 | bool copyNodes) | 310 | bool copyNodes) |
2839 | 353 | { | 311 | { |
2840 | 354 | CREATE_AND_RETURN_EXPR(elem_expr, | 312 | CREATE_AND_RETURN_EXPR(elem_expr, |
2842 | 355 | sctx, loc, qnameExpr, content, nsCtx, copyNodes); | 313 | sctx, udf, loc, qnameExpr, content, nsCtx, copyNodes); |
2843 | 356 | } | 314 | } |
2844 | 357 | 315 | ||
2845 | 358 | 316 | ||
2846 | 359 | attr_expr* ExprManager::create_attr_expr( | 317 | attr_expr* ExprManager::create_attr_expr( |
2847 | 360 | static_context* sctx, | 318 | static_context* sctx, |
2848 | 319 | user_function* udf, | ||
2849 | 361 | const QueryLoc& loc, | 320 | const QueryLoc& loc, |
2850 | 362 | expr* aQNameExpr, | 321 | expr* aQNameExpr, |
2851 | 363 | expr* aValueExpr) | 322 | expr* aValueExpr) |
2852 | 364 | { | 323 | { |
2854 | 365 | CREATE_AND_RETURN_EXPR(attr_expr, sctx, loc, aQNameExpr, aValueExpr); | 324 | CREATE_AND_RETURN_EXPR(attr_expr, sctx, udf, loc, aQNameExpr, aValueExpr); |
2855 | 366 | } | 325 | } |
2856 | 367 | 326 | ||
2857 | 368 | 327 | ||
2858 | 369 | text_expr* ExprManager::create_text_expr( | 328 | text_expr* ExprManager::create_text_expr( |
2859 | 370 | static_context* sctx, | 329 | static_context* sctx, |
2860 | 330 | user_function* udf, | ||
2861 | 371 | const QueryLoc& loc, | 331 | const QueryLoc& loc, |
2862 | 372 | text_expr::text_constructor_type textType, | 332 | text_expr::text_constructor_type textType, |
2863 | 373 | expr* text) | 333 | expr* text) |
2864 | 374 | { | 334 | { |
2866 | 375 | CREATE_AND_RETURN_EXPR(text_expr, sctx, loc, textType, text); | 335 | CREATE_AND_RETURN_EXPR(text_expr, sctx, udf, loc, textType, text); |
2867 | 376 | } | 336 | } |
2868 | 377 | 337 | ||
2869 | 378 | 338 | ||
2870 | 379 | pi_expr* ExprManager::create_pi_expr( | 339 | pi_expr* ExprManager::create_pi_expr( |
2871 | 380 | static_context* sctx, | 340 | static_context* sctx, |
2872 | 341 | user_function* udf, | ||
2873 | 381 | const QueryLoc& loc, | 342 | const QueryLoc& loc, |
2874 | 382 | expr* targetExpr, | 343 | expr* targetExpr, |
2875 | 383 | expr* contentExpr) | 344 | expr* contentExpr) |
2876 | 384 | { | 345 | { |
2878 | 385 | CREATE_AND_RETURN_EXPR(pi_expr, sctx, loc, targetExpr, contentExpr); | 346 | CREATE_AND_RETURN_EXPR(pi_expr, sctx, udf, loc, targetExpr, contentExpr); |
2879 | 386 | } | 347 | } |
2880 | 387 | 348 | ||
2881 | 388 | 349 | ||
2882 | 389 | const_expr* ExprManager::create_const_expr( | 350 | const_expr* ExprManager::create_const_expr( |
2883 | 390 | static_context* sctx, | 351 | static_context* sctx, |
2884 | 352 | user_function* udf, | ||
2885 | 391 | const QueryLoc& loc, | 353 | const QueryLoc& loc, |
2886 | 392 | zstring& sval) | 354 | zstring& sval) |
2887 | 393 | { | 355 | { |
2889 | 394 | CREATE_AND_RETURN_EXPR(const_expr, sctx, loc, sval); | 356 | CREATE_AND_RETURN_EXPR(const_expr, sctx, udf, loc, sval); |
2890 | 395 | } | 357 | } |
2891 | 396 | 358 | ||
2892 | 397 | 359 | ||
2893 | 398 | const_expr* ExprManager::create_const_expr( | 360 | const_expr* ExprManager::create_const_expr( |
2894 | 399 | static_context* sctx, | 361 | static_context* sctx, |
2895 | 362 | user_function* udf, | ||
2896 | 400 | const QueryLoc& loc, | 363 | const QueryLoc& loc, |
2897 | 401 | const std::string& sval) | 364 | const std::string& sval) |
2898 | 402 | { | 365 | { |
2900 | 403 | CREATE_AND_RETURN_EXPR(const_expr, sctx, loc, sval); | 366 | CREATE_AND_RETURN_EXPR(const_expr, sctx, udf, loc, sval); |
2901 | 404 | } | 367 | } |
2902 | 405 | 368 | ||
2903 | 406 | 369 | ||
2904 | 407 | const_expr* ExprManager::create_const_expr( | 370 | const_expr* ExprManager::create_const_expr( |
2905 | 408 | static_context* sctx, | 371 | static_context* sctx, |
2906 | 372 | user_function* udf, | ||
2907 | 409 | const QueryLoc& loc, | 373 | const QueryLoc& loc, |
2908 | 410 | const char* sval) | 374 | const char* sval) |
2909 | 411 | { | 375 | { |
2911 | 412 | CREATE_AND_RETURN_EXPR(const_expr, sctx, loc, sval); | 376 | CREATE_AND_RETURN_EXPR(const_expr, sctx, udf, loc, sval); |
2912 | 413 | } | 377 | } |
2913 | 414 | 378 | ||
2914 | 415 | 379 | ||
2915 | 416 | const_expr* ExprManager::create_const_expr( | 380 | const_expr* ExprManager::create_const_expr( |
2916 | 417 | static_context* sctx, | 381 | static_context* sctx, |
2917 | 382 | user_function* udf, | ||
2918 | 418 | const QueryLoc& loc, | 383 | const QueryLoc& loc, |
2919 | 419 | xs_integer val) | 384 | xs_integer val) |
2920 | 420 | { | 385 | { |
2922 | 421 | CREATE_AND_RETURN_EXPR(const_expr, sctx, loc, val); | 386 | CREATE_AND_RETURN_EXPR(const_expr, sctx, udf, loc, val); |
2923 | 422 | } | 387 | } |
2924 | 423 | 388 | ||
2925 | 424 | 389 | ||
2926 | 425 | const_expr* ExprManager::create_const_expr( | 390 | const_expr* ExprManager::create_const_expr( |
2927 | 426 | static_context* sctx, | 391 | static_context* sctx, |
2928 | 392 | user_function* udf, | ||
2929 | 427 | const QueryLoc& loc, | 393 | const QueryLoc& loc, |
2930 | 428 | xs_decimal val) | 394 | xs_decimal val) |
2931 | 429 | { | 395 | { |
2933 | 430 | CREATE_AND_RETURN_EXPR(const_expr, sctx, loc, val); | 396 | CREATE_AND_RETURN_EXPR(const_expr, sctx, udf, loc, val); |
2934 | 431 | } | 397 | } |
2935 | 432 | 398 | ||
2936 | 433 | 399 | ||
2937 | 434 | const_expr* ExprManager::create_const_expr( | 400 | const_expr* ExprManager::create_const_expr( |
2938 | 435 | static_context* sctx, | 401 | static_context* sctx, |
2939 | 402 | user_function* udf, | ||
2940 | 436 | const QueryLoc& loc, | 403 | const QueryLoc& loc, |
2941 | 437 | xs_double val) | 404 | xs_double val) |
2942 | 438 | { | 405 | { |
2944 | 439 | CREATE_AND_RETURN_EXPR(const_expr, sctx, loc, val); | 406 | CREATE_AND_RETURN_EXPR(const_expr, sctx, udf, loc, val); |
2945 | 440 | } | 407 | } |
2946 | 441 | 408 | ||
2947 | 442 | 409 | ||
2948 | 443 | const_expr* ExprManager::create_const_expr( | 410 | const_expr* ExprManager::create_const_expr( |
2949 | 444 | static_context* sctx, | 411 | static_context* sctx, |
2950 | 412 | user_function* udf, | ||
2951 | 445 | const QueryLoc& loc, | 413 | const QueryLoc& loc, |
2952 | 446 | xs_boolean val) | 414 | xs_boolean val) |
2953 | 447 | { | 415 | { |
2955 | 448 | CREATE_AND_RETURN_EXPR(const_expr, sctx, loc, val); | 416 | CREATE_AND_RETURN_EXPR(const_expr, sctx, udf, loc, val); |
2956 | 449 | } | 417 | } |
2957 | 450 | 418 | ||
2958 | 451 | 419 | ||
2959 | 452 | const_expr* ExprManager::create_const_expr( | 420 | const_expr* ExprManager::create_const_expr( |
2960 | 453 | static_context* sctx, | 421 | static_context* sctx, |
2961 | 422 | user_function* udf, | ||
2962 | 454 | const QueryLoc& loc, | 423 | const QueryLoc& loc, |
2963 | 455 | store::Item_t val) | 424 | store::Item_t val) |
2964 | 456 | { | 425 | { |
2966 | 457 | CREATE_AND_RETURN_EXPR(const_expr, sctx, loc, val); | 426 | CREATE_AND_RETURN_EXPR(const_expr, sctx, udf, loc, val); |
2967 | 458 | } | 427 | } |
2968 | 459 | 428 | ||
2969 | 460 | 429 | ||
2970 | 461 | const_expr* ExprManager::create_const_expr( | 430 | const_expr* ExprManager::create_const_expr( |
2971 | 462 | static_context* sctx, | 431 | static_context* sctx, |
2972 | 432 | user_function* udf, | ||
2973 | 463 | const QueryLoc& loc, | 433 | const QueryLoc& loc, |
2974 | 464 | const char* ns, | 434 | const char* ns, |
2975 | 465 | const char* pre, | 435 | const char* pre, |
2976 | 466 | const char* local) | 436 | const char* local) |
2977 | 467 | { | 437 | { |
2979 | 468 | CREATE_AND_RETURN_EXPR(const_expr, sctx, loc, ns, pre, local); | 438 | CREATE_AND_RETURN_EXPR(const_expr, sctx, udf, loc, ns, pre, local); |
2980 | 469 | } | 439 | } |
2981 | 470 | 440 | ||
2982 | 471 | 441 | ||
2983 | 472 | extension_expr* ExprManager::create_extension_expr( | 442 | extension_expr* ExprManager::create_extension_expr( |
2984 | 473 | static_context* sctx, | 443 | static_context* sctx, |
2985 | 444 | user_function* udf, | ||
2986 | 474 | const QueryLoc& loc) | 445 | const QueryLoc& loc) |
2987 | 475 | { | 446 | { |
2989 | 476 | CREATE_AND_RETURN_EXPR(extension_expr, sctx, loc); | 447 | CREATE_AND_RETURN_EXPR(extension_expr, sctx, udf, loc); |
2990 | 477 | } | 448 | } |
2991 | 478 | 449 | ||
2992 | 479 | 450 | ||
2993 | 480 | extension_expr* ExprManager::create_extension_expr( | 451 | extension_expr* ExprManager::create_extension_expr( |
2994 | 481 | static_context* sctx, | 452 | static_context* sctx, |
2995 | 453 | user_function* udf, | ||
2996 | 482 | const QueryLoc& loc, | 454 | const QueryLoc& loc, |
2997 | 483 | expr* extended) | 455 | expr* extended) |
2998 | 484 | { | 456 | { |
3000 | 485 | CREATE_AND_RETURN_EXPR(extension_expr, sctx, loc, extended); | 457 | CREATE_AND_RETURN_EXPR(extension_expr, sctx, udf, loc, extended); |
3001 | 486 | } | 458 | } |
3002 | 487 | 459 | ||
3003 | 488 | 460 | ||
3004 | @@ -494,35 +466,40 @@ | |||
3005 | 494 | 466 | ||
3006 | 495 | trycatch_expr* ExprManager::create_trycatch_expr( | 467 | trycatch_expr* ExprManager::create_trycatch_expr( |
3007 | 496 | static_context* sctx, | 468 | static_context* sctx, |
3008 | 469 | user_function* udf, | ||
3009 | 497 | const QueryLoc& loc, | 470 | const QueryLoc& loc, |
3010 | 498 | expr* tryExpr) | 471 | expr* tryExpr) |
3011 | 499 | { | 472 | { |
3013 | 500 | CREATE_AND_RETURN_EXPR(trycatch_expr, sctx, loc, tryExpr); | 473 | CREATE_AND_RETURN_EXPR(trycatch_expr, sctx, udf, loc, tryExpr); |
3014 | 501 | } | 474 | } |
3015 | 502 | 475 | ||
3016 | 503 | 476 | ||
3017 | 504 | wrapper_expr* ExprManager::create_wrapper_expr( | 477 | wrapper_expr* ExprManager::create_wrapper_expr( |
3018 | 505 | static_context* sctx, | 478 | static_context* sctx, |
3019 | 479 | user_function* udf, | ||
3020 | 506 | const QueryLoc& loc, | 480 | const QueryLoc& loc, |
3021 | 507 | expr* wrapped) | 481 | expr* wrapped) |
3022 | 508 | { | 482 | { |
3024 | 509 | CREATE_AND_RETURN_EXPR(wrapper_expr, sctx, loc, wrapped); | 483 | CREATE_AND_RETURN_EXPR(wrapper_expr, sctx, udf, loc, wrapped); |
3025 | 510 | } | 484 | } |
3026 | 511 | 485 | ||
3028 | 512 | 486 | #if 0 | |
3029 | 513 | function_trace_expr* ExprManager::create_function_trace_expr( | 487 | function_trace_expr* ExprManager::create_function_trace_expr( |
3030 | 514 | static_context* sctx, | 488 | static_context* sctx, |
3031 | 489 | user_function* udf, | ||
3032 | 515 | const QueryLoc& loc, | 490 | const QueryLoc& loc, |
3033 | 516 | expr* aChild) | 491 | expr* aChild) |
3034 | 517 | { | 492 | { |
3036 | 518 | CREATE_AND_RETURN_EXPR(function_trace_expr, sctx, loc, aChild); | 493 | CREATE_AND_RETURN_EXPR(function_trace_expr, sctx, udf, loc, aChild); |
3037 | 519 | } | 494 | } |
3041 | 520 | 495 | #endif | |
3042 | 521 | 496 | ||
3043 | 522 | function_trace_expr* ExprManager::create_function_trace_expr(expr* aExpr) | 497 | function_trace_expr* ExprManager::create_function_trace_expr( |
3044 | 498 | user_function* udf, | ||
3045 | 499 | expr* aExpr) | ||
3046 | 523 | { | 500 | { |
3047 | 524 | //this function gets the ExprManager from the expression it recieves. | 501 | //this function gets the ExprManager from the expression it recieves. |
3049 | 525 | function_trace_expr* e = new (theMemoryMgr) function_trace_expr(aExpr); | 502 | function_trace_expr* e = new (theMemoryMgr) function_trace_expr(udf, aExpr); |
3050 | 526 | reg(e); | 503 | reg(e); |
3051 | 527 | return e; | 504 | return e; |
3052 | 528 | } | 505 | } |
3053 | @@ -530,25 +507,27 @@ | |||
3054 | 530 | 507 | ||
3055 | 531 | eval_expr* ExprManager::create_eval_expr( | 508 | eval_expr* ExprManager::create_eval_expr( |
3056 | 532 | static_context* sctx, | 509 | static_context* sctx, |
3057 | 510 | user_function* udf, | ||
3058 | 533 | const QueryLoc& loc, | 511 | const QueryLoc& loc, |
3059 | 534 | expr* e, | 512 | expr* e, |
3060 | 535 | expr_script_kind_t scriptingKind, | 513 | expr_script_kind_t scriptingKind, |
3061 | 536 | namespace_context* nsCtx) | 514 | namespace_context* nsCtx) |
3062 | 537 | { | 515 | { |
3064 | 538 | CREATE_AND_RETURN_EXPR(eval_expr, sctx, loc, e, scriptingKind, nsCtx); | 516 | CREATE_AND_RETURN_EXPR(eval_expr, sctx, udf, loc, e, scriptingKind, nsCtx); |
3065 | 539 | } | 517 | } |
3066 | 540 | 518 | ||
3067 | 541 | #ifdef ZORBA_WITH_DEBUGGER | 519 | #ifdef ZORBA_WITH_DEBUGGER |
3068 | 542 | 520 | ||
3069 | 543 | debugger_expr* ExprManager::create_debugger_expr( | 521 | debugger_expr* ExprManager::create_debugger_expr( |
3070 | 544 | static_context* sctx, | 522 | static_context* sctx, |
3071 | 523 | user_function* udf, | ||
3072 | 545 | const QueryLoc& loc, | 524 | const QueryLoc& loc, |
3073 | 546 | expr* aChild, | 525 | expr* aChild, |
3074 | 547 | namespace_context* nsCtx, | 526 | namespace_context* nsCtx, |
3075 | 548 | bool aIsVarDeclaration) | 527 | bool aIsVarDeclaration) |
3076 | 549 | { | 528 | { |
3077 | 550 | CREATE_AND_RETURN_EXPR(debugger_expr, | 529 | CREATE_AND_RETURN_EXPR(debugger_expr, |
3079 | 551 | sctx, loc, aChild, nsCtx, aIsVarDeclaration); | 530 | sctx, udf, loc, aChild, nsCtx, aIsVarDeclaration); |
3080 | 552 | } | 531 | } |
3081 | 553 | 532 | ||
3082 | 554 | #endif | 533 | #endif |
3083 | @@ -557,17 +536,20 @@ | |||
3084 | 557 | 536 | ||
3085 | 558 | var_expr* ExprManager::create_var_expr( | 537 | var_expr* ExprManager::create_var_expr( |
3086 | 559 | static_context* sctx, | 538 | static_context* sctx, |
3087 | 539 | user_function* udf, | ||
3088 | 560 | const QueryLoc& loc, | 540 | const QueryLoc& loc, |
3089 | 561 | var_expr::var_kind k, | 541 | var_expr::var_kind k, |
3090 | 562 | store::Item* name) | 542 | store::Item* name) |
3091 | 563 | { | 543 | { |
3093 | 564 | CREATE_AND_RETURN_EXPR(var_expr, sctx, loc, k, name); | 544 | CREATE_AND_RETURN_EXPR(var_expr, sctx, udf, loc, k, name); |
3094 | 565 | } | 545 | } |
3095 | 566 | 546 | ||
3096 | 567 | 547 | ||
3098 | 568 | var_expr* ExprManager::create_var_expr(const var_expr& source) | 548 | var_expr* ExprManager::create_var_expr( |
3099 | 549 | user_function* udf, | ||
3100 | 550 | const var_expr& source) | ||
3101 | 569 | { | 551 | { |
3103 | 570 | var_expr* e = new (theMemoryMgr) var_expr(source); | 552 | var_expr* e = new (theMemoryMgr) var_expr(udf, source); |
3104 | 571 | reg(e); | 553 | reg(e); |
3105 | 572 | return e; | 554 | return e; |
3106 | 573 | } | 555 | } |
3107 | @@ -580,30 +562,33 @@ | |||
3108 | 580 | 562 | ||
3109 | 581 | json_array_expr* ExprManager::create_json_array_expr( | 563 | json_array_expr* ExprManager::create_json_array_expr( |
3110 | 582 | static_context* sctx, | 564 | static_context* sctx, |
3111 | 565 | user_function* udf, | ||
3112 | 583 | const QueryLoc& loc, | 566 | const QueryLoc& loc, |
3113 | 584 | expr* content) | 567 | expr* content) |
3114 | 585 | { | 568 | { |
3116 | 586 | CREATE_AND_RETURN_EXPR(json_array_expr, sctx, loc, content); | 569 | CREATE_AND_RETURN_EXPR(json_array_expr, sctx, udf, loc, content); |
3117 | 587 | } | 570 | } |
3118 | 588 | 571 | ||
3119 | 589 | 572 | ||
3120 | 590 | json_object_expr* ExprManager::create_json_object_expr( | 573 | json_object_expr* ExprManager::create_json_object_expr( |
3121 | 591 | static_context* sctx, | 574 | static_context* sctx, |
3122 | 575 | user_function* udf, | ||
3123 | 592 | const QueryLoc& loc, | 576 | const QueryLoc& loc, |
3124 | 593 | expr* content, | 577 | expr* content, |
3125 | 594 | bool accumulate) | 578 | bool accumulate) |
3126 | 595 | { | 579 | { |
3128 | 596 | CREATE_AND_RETURN_EXPR(json_object_expr, sctx, loc, content, accumulate); | 580 | CREATE_AND_RETURN_EXPR(json_object_expr, sctx, udf, loc, content, accumulate); |
3129 | 597 | } | 581 | } |
3130 | 598 | 582 | ||
3131 | 599 | 583 | ||
3132 | 600 | json_direct_object_expr* ExprManager::create_json_direct_object_expr( | 584 | json_direct_object_expr* ExprManager::create_json_direct_object_expr( |
3133 | 601 | static_context* sctx, | 585 | static_context* sctx, |
3134 | 586 | user_function* udf, | ||
3135 | 602 | const QueryLoc& loc, | 587 | const QueryLoc& loc, |
3136 | 603 | std::vector<expr*>& names, | 588 | std::vector<expr*>& names, |
3137 | 604 | std::vector<expr*>& values) | 589 | std::vector<expr*>& values) |
3138 | 605 | { | 590 | { |
3140 | 606 | CREATE_AND_RETURN_EXPR(json_direct_object_expr, sctx, loc, names, values); | 591 | CREATE_AND_RETURN_EXPR(json_direct_object_expr, sctx, udf, loc, names, values); |
3141 | 607 | } | 592 | } |
3142 | 608 | 593 | ||
3143 | 609 | 594 | ||
3144 | @@ -614,43 +599,47 @@ | |||
3145 | 614 | 599 | ||
3146 | 615 | insert_expr* ExprManager::create_insert_expr( | 600 | insert_expr* ExprManager::create_insert_expr( |
3147 | 616 | static_context* sctx, | 601 | static_context* sctx, |
3148 | 602 | user_function* udf, | ||
3149 | 617 | const QueryLoc& loc, | 603 | const QueryLoc& loc, |
3150 | 618 | store::UpdateConsts::InsertType insertType, | 604 | store::UpdateConsts::InsertType insertType, |
3151 | 619 | expr* aSourceExpr, | 605 | expr* aSourceExpr, |
3152 | 620 | expr* aTargetExpr) | 606 | expr* aTargetExpr) |
3153 | 621 | { | 607 | { |
3154 | 622 | CREATE_AND_RETURN_EXPR(insert_expr, | 608 | CREATE_AND_RETURN_EXPR(insert_expr, |
3156 | 623 | sctx, loc, insertType, aSourceExpr, aTargetExpr); | 609 | sctx, udf, loc, insertType, aSourceExpr, aTargetExpr); |
3157 | 624 | } | 610 | } |
3158 | 625 | 611 | ||
3159 | 626 | 612 | ||
3160 | 627 | delete_expr* ExprManager::create_delete_expr( | 613 | delete_expr* ExprManager::create_delete_expr( |
3161 | 628 | static_context* sctx, | 614 | static_context* sctx, |
3162 | 615 | user_function* udf, | ||
3163 | 629 | const QueryLoc& loc, | 616 | const QueryLoc& loc, |
3164 | 630 | expr* aTargetExpr) | 617 | expr* aTargetExpr) |
3165 | 631 | { | 618 | { |
3167 | 632 | CREATE_AND_RETURN_EXPR(delete_expr, sctx, loc, aTargetExpr); | 619 | CREATE_AND_RETURN_EXPR(delete_expr, sctx, udf, loc, aTargetExpr); |
3168 | 633 | } | 620 | } |
3169 | 634 | 621 | ||
3170 | 635 | 622 | ||
3171 | 636 | replace_expr* ExprManager::create_replace_expr( | 623 | replace_expr* ExprManager::create_replace_expr( |
3172 | 637 | static_context* sctx, | 624 | static_context* sctx, |
3173 | 625 | user_function* udf, | ||
3174 | 638 | const QueryLoc& loc, | 626 | const QueryLoc& loc, |
3175 | 639 | store::UpdateConsts::ReplaceType aType, | 627 | store::UpdateConsts::ReplaceType aType, |
3176 | 640 | expr* aSourceExpr, | 628 | expr* aSourceExpr, |
3177 | 641 | expr* aTargetExpr) | 629 | expr* aTargetExpr) |
3178 | 642 | { | 630 | { |
3180 | 643 | CREATE_AND_RETURN_EXPR(replace_expr, sctx, loc, aType, aSourceExpr, aTargetExpr); | 631 | CREATE_AND_RETURN_EXPR(replace_expr, sctx, udf, loc, aType, aSourceExpr, aTargetExpr); |
3181 | 644 | } | 632 | } |
3182 | 645 | 633 | ||
3183 | 646 | 634 | ||
3184 | 647 | rename_expr* ExprManager::create_rename_expr( | 635 | rename_expr* ExprManager::create_rename_expr( |
3185 | 648 | static_context* sctx, | 636 | static_context* sctx, |
3186 | 637 | user_function* udf, | ||
3187 | 649 | const QueryLoc& loc, | 638 | const QueryLoc& loc, |
3188 | 650 | expr* aSourceExpr, | 639 | expr* aSourceExpr, |
3189 | 651 | expr* aTargetExpr) | 640 | expr* aTargetExpr) |
3190 | 652 | { | 641 | { |
3192 | 653 | CREATE_AND_RETURN_EXPR(rename_expr, sctx, loc, aSourceExpr, aTargetExpr); | 642 | CREATE_AND_RETURN_EXPR(rename_expr, sctx, udf, loc, aSourceExpr, aTargetExpr); |
3193 | 654 | } | 643 | } |
3194 | 655 | 644 | ||
3195 | 656 | 645 | ||
3196 | @@ -662,112 +651,126 @@ | |||
3197 | 662 | 651 | ||
3198 | 663 | transform_expr* ExprManager::create_transform_expr( | 652 | transform_expr* ExprManager::create_transform_expr( |
3199 | 664 | static_context* sctx, | 653 | static_context* sctx, |
3200 | 654 | user_function* udf, | ||
3201 | 665 | const QueryLoc& loc) | 655 | const QueryLoc& loc) |
3202 | 666 | { | 656 | { |
3204 | 667 | CREATE_AND_RETURN_EXPR(transform_expr, sctx, loc); | 657 | CREATE_AND_RETURN_EXPR(transform_expr, sctx, udf, loc); |
3205 | 668 | } | 658 | } |
3206 | 669 | 659 | ||
3207 | 670 | 660 | ||
3208 | 671 | block_expr* ExprManager::create_block_expr( | 661 | block_expr* ExprManager::create_block_expr( |
3209 | 672 | static_context* sctx, | 662 | static_context* sctx, |
3210 | 663 | user_function* udf, | ||
3211 | 673 | const QueryLoc& loc, | 664 | const QueryLoc& loc, |
3212 | 674 | bool allowLastUpdating, | 665 | bool allowLastUpdating, |
3213 | 675 | std::vector<expr*>& seq, | 666 | std::vector<expr*>& seq, |
3214 | 676 | std::vector<var_expr*>* assignedVars) | 667 | std::vector<var_expr*>* assignedVars) |
3215 | 677 | { | 668 | { |
3216 | 678 | CREATE_AND_RETURN_EXPR(block_expr, | 669 | CREATE_AND_RETURN_EXPR(block_expr, |
3218 | 679 | sctx, loc, allowLastUpdating, seq, assignedVars); | 670 | sctx, udf, loc, allowLastUpdating, seq, assignedVars); |
3219 | 680 | } | 671 | } |
3220 | 681 | 672 | ||
3221 | 682 | 673 | ||
3222 | 683 | apply_expr* ExprManager::create_apply_expr( | 674 | apply_expr* ExprManager::create_apply_expr( |
3223 | 684 | static_context* sctx, | 675 | static_context* sctx, |
3224 | 676 | user_function* udf, | ||
3225 | 685 | const QueryLoc& loc, | 677 | const QueryLoc& loc, |
3226 | 686 | expr* inExpr, | 678 | expr* inExpr, |
3227 | 687 | bool discardXDM) | 679 | bool discardXDM) |
3228 | 688 | { | 680 | { |
3230 | 689 | CREATE_AND_RETURN_EXPR(apply_expr, sctx, loc, inExpr, discardXDM); | 681 | CREATE_AND_RETURN_EXPR(apply_expr, sctx, udf, loc, inExpr, discardXDM); |
3231 | 690 | } | 682 | } |
3232 | 691 | 683 | ||
3233 | 692 | 684 | ||
3234 | 693 | var_decl_expr* ExprManager::create_var_decl_expr( | 685 | var_decl_expr* ExprManager::create_var_decl_expr( |
3235 | 694 | static_context* sctx, | 686 | static_context* sctx, |
3236 | 687 | user_function* udf, | ||
3237 | 695 | const QueryLoc& loc, | 688 | const QueryLoc& loc, |
3238 | 696 | var_expr* varExpr, | 689 | var_expr* varExpr, |
3239 | 697 | expr* initExpr) | 690 | expr* initExpr) |
3240 | 698 | { | 691 | { |
3242 | 699 | CREATE_AND_RETURN_EXPR(var_decl_expr, sctx, loc, varExpr, initExpr); | 692 | CREATE_AND_RETURN_EXPR(var_decl_expr, sctx, udf, loc, varExpr, initExpr); |
3243 | 700 | } | 693 | } |
3244 | 701 | 694 | ||
3245 | 702 | 695 | ||
3246 | 703 | var_set_expr* ExprManager::create_var_set_expr( | 696 | var_set_expr* ExprManager::create_var_set_expr( |
3247 | 704 | static_context* sctx, | 697 | static_context* sctx, |
3248 | 698 | user_function* udf, | ||
3249 | 705 | const QueryLoc& loc, | 699 | const QueryLoc& loc, |
3250 | 706 | var_expr* varExpr, | 700 | var_expr* varExpr, |
3251 | 707 | expr* setExpr) | 701 | expr* setExpr) |
3252 | 708 | { | 702 | { |
3254 | 709 | CREATE_AND_RETURN_EXPR(var_set_expr, sctx, loc, varExpr, setExpr); | 703 | CREATE_AND_RETURN_EXPR(var_set_expr, sctx, udf, loc, varExpr, setExpr); |
3255 | 710 | } | 704 | } |
3256 | 711 | 705 | ||
3257 | 712 | 706 | ||
3258 | 713 | exit_expr* ExprManager::create_exit_expr( | 707 | exit_expr* ExprManager::create_exit_expr( |
3259 | 714 | static_context* sctx, | 708 | static_context* sctx, |
3260 | 709 | user_function* udf, | ||
3261 | 715 | const QueryLoc& loc, | 710 | const QueryLoc& loc, |
3262 | 716 | expr* inExpr) | 711 | expr* inExpr) |
3263 | 717 | { | 712 | { |
3265 | 718 | CREATE_AND_RETURN_EXPR(exit_expr, sctx, loc, inExpr); | 713 | CREATE_AND_RETURN_EXPR(exit_expr, sctx, udf, loc, inExpr); |
3266 | 719 | } | 714 | } |
3267 | 720 | 715 | ||
3268 | 721 | 716 | ||
3269 | 722 | exit_catcher_expr* ExprManager::create_exit_catcher_expr( | 717 | exit_catcher_expr* ExprManager::create_exit_catcher_expr( |
3270 | 723 | static_context* sctx, | 718 | static_context* sctx, |
3271 | 719 | user_function* udf, | ||
3272 | 724 | const QueryLoc& loc, | 720 | const QueryLoc& loc, |
3273 | 725 | expr* inExpr, | 721 | expr* inExpr, |
3274 | 726 | std::vector<expr*>& exitExprs) | 722 | std::vector<expr*>& exitExprs) |
3275 | 727 | { | 723 | { |
3277 | 728 | CREATE_AND_RETURN_EXPR(exit_catcher_expr, sctx, loc, inExpr, exitExprs); | 724 | CREATE_AND_RETURN_EXPR(exit_catcher_expr, sctx, udf, loc, inExpr, exitExprs); |
3278 | 729 | } | 725 | } |
3279 | 730 | 726 | ||
3280 | 731 | 727 | ||
3281 | 732 | flowctl_expr* ExprManager::create_flowctl_expr( | 728 | flowctl_expr* ExprManager::create_flowctl_expr( |
3282 | 733 | static_context* sctx, | 729 | static_context* sctx, |
3283 | 730 | user_function* udf, | ||
3284 | 734 | const QueryLoc& loc, | 731 | const QueryLoc& loc, |
3285 | 735 | flowctl_expr::action action) | 732 | flowctl_expr::action action) |
3286 | 736 | { | 733 | { |
3288 | 737 | CREATE_AND_RETURN_EXPR(flowctl_expr, sctx, loc, action); | 734 | CREATE_AND_RETURN_EXPR(flowctl_expr, sctx, udf, loc, action); |
3289 | 738 | } | 735 | } |
3290 | 739 | 736 | ||
3291 | 740 | 737 | ||
3292 | 741 | while_expr* ExprManager::create_while_expr( | 738 | while_expr* ExprManager::create_while_expr( |
3294 | 742 | static_context* sctx, const QueryLoc& loc, expr* body) | 739 | static_context* sctx, |
3295 | 740 | user_function* udf, | ||
3296 | 741 | const QueryLoc& loc, | ||
3297 | 742 | expr* body) | ||
3298 | 743 | { | 743 | { |
3300 | 744 | CREATE_AND_RETURN_EXPR(while_expr, sctx, loc, body); | 744 | CREATE_AND_RETURN_EXPR(while_expr, sctx, udf, loc, body); |
3301 | 745 | } | 745 | } |
3302 | 746 | 746 | ||
3303 | 747 | 747 | ||
3304 | 748 | //////////////////////////////////////////////////////////////////////////////// | 748 | //////////////////////////////////////////////////////////////////////////////// |
3305 | 749 | 749 | ||
3306 | 750 | relpath_expr* ExprManager::create_relpath_expr( | 750 | relpath_expr* ExprManager::create_relpath_expr( |
3309 | 751 | static_context* sctx, | 751 | static_context* sctx, |
3310 | 752 | const QueryLoc& loc) | 752 | user_function* udf, |
3311 | 753 | const QueryLoc& loc) | ||
3312 | 753 | { | 754 | { |
3314 | 754 | CREATE_AND_RETURN_EXPR(relpath_expr, sctx, loc); | 755 | CREATE_AND_RETURN_EXPR(relpath_expr, sctx, udf, loc); |
3315 | 755 | } | 756 | } |
3316 | 756 | 757 | ||
3317 | 757 | 758 | ||
3318 | 758 | axis_step_expr* ExprManager::create_axis_step_expr( | 759 | axis_step_expr* ExprManager::create_axis_step_expr( |
3319 | 759 | static_context* sctx, | 760 | static_context* sctx, |
3320 | 761 | user_function* udf, | ||
3321 | 760 | const QueryLoc& loc) | 762 | const QueryLoc& loc) |
3322 | 761 | { | 763 | { |
3324 | 762 | CREATE_AND_RETURN_EXPR(axis_step_expr, sctx, loc); | 764 | CREATE_AND_RETURN_EXPR(axis_step_expr, sctx, udf, loc); |
3325 | 763 | } | 765 | } |
3326 | 764 | 766 | ||
3327 | 765 | 767 | ||
3328 | 766 | match_expr* ExprManager::create_match_expr( | 768 | match_expr* ExprManager::create_match_expr( |
3329 | 767 | static_context* sctx, | 769 | static_context* sctx, |
3330 | 770 | user_function* udf, | ||
3331 | 768 | const QueryLoc& loc) | 771 | const QueryLoc& loc) |
3332 | 769 | { | 772 | { |
3334 | 770 | CREATE_AND_RETURN_EXPR(match_expr, sctx, loc); | 773 | CREATE_AND_RETURN_EXPR(match_expr, sctx, udf, loc); |
3335 | 771 | } | 774 | } |
3336 | 772 | 775 | ||
3337 | 773 | 776 | ||
3338 | @@ -776,92 +779,105 @@ | |||
3339 | 776 | dynamic_function_invocation_expr* | 779 | dynamic_function_invocation_expr* |
3340 | 777 | ExprManager::create_dynamic_function_invocation_expr( | 780 | ExprManager::create_dynamic_function_invocation_expr( |
3341 | 778 | static_context* sctx, | 781 | static_context* sctx, |
3342 | 782 | user_function* udf, | ||
3343 | 779 | const QueryLoc& loc, | 783 | const QueryLoc& loc, |
3344 | 780 | expr* anExpr, | 784 | expr* anExpr, |
3345 | 781 | const std::vector<expr*>& args) | 785 | const std::vector<expr*>& args) |
3346 | 782 | { | 786 | { |
3348 | 783 | CREATE_AND_RETURN_EXPR(dynamic_function_invocation_expr, sctx, loc, anExpr, args); | 787 | CREATE_AND_RETURN_EXPR(dynamic_function_invocation_expr, sctx, udf, loc, anExpr, args); |
3349 | 784 | } | 788 | } |
3350 | 785 | 789 | ||
3351 | 786 | 790 | ||
3352 | 787 | function_item_expr* ExprManager::create_function_item_expr( | 791 | function_item_expr* ExprManager::create_function_item_expr( |
3353 | 788 | static_context* sctx, | 792 | static_context* sctx, |
3354 | 793 | user_function* udf, | ||
3355 | 789 | const QueryLoc& loc, | 794 | const QueryLoc& loc, |
3356 | 790 | const store::Item* aQName, | 795 | const store::Item* aQName, |
3357 | 791 | function* f, | 796 | function* f, |
3358 | 792 | uint32_t aArity) | 797 | uint32_t aArity) |
3359 | 793 | { | 798 | { |
3361 | 794 | CREATE_AND_RETURN_EXPR(function_item_expr, sctx, loc, aQName, f, aArity); | 799 | CREATE_AND_RETURN_EXPR(function_item_expr, sctx, udf, loc, aQName, f, aArity); |
3362 | 795 | } | 800 | } |
3363 | 796 | 801 | ||
3364 | 797 | 802 | ||
3365 | 798 | function_item_expr* ExprManager::create_function_item_expr( | 803 | function_item_expr* ExprManager::create_function_item_expr( |
3366 | 799 | static_context* sctx, | 804 | static_context* sctx, |
3367 | 805 | user_function* udf, | ||
3368 | 800 | const QueryLoc& loc) | 806 | const QueryLoc& loc) |
3369 | 801 | { | 807 | { |
3371 | 802 | CREATE_AND_RETURN_EXPR(function_item_expr, sctx, loc); | 808 | CREATE_AND_RETURN_EXPR(function_item_expr, sctx, udf, loc); |
3372 | 803 | } | 809 | } |
3373 | 804 | 810 | ||
3374 | 805 | 811 | ||
3375 | 806 | ftcontains_expr* ExprManager::create_ftcontains_expr( | 812 | ftcontains_expr* ExprManager::create_ftcontains_expr( |
3376 | 807 | static_context* sctx, | 813 | static_context* sctx, |
3377 | 814 | user_function* udf, | ||
3378 | 808 | QueryLoc const& loc, | 815 | QueryLoc const& loc, |
3379 | 809 | expr* range, | 816 | expr* range, |
3380 | 810 | ftnode *ftselection, | 817 | ftnode *ftselection, |
3381 | 811 | expr* ftignore) | 818 | expr* ftignore) |
3382 | 812 | { | 819 | { |
3384 | 813 | CREATE_AND_RETURN_EXPR(ftcontains_expr, sctx, loc, range, ftselection, ftignore); | 820 | CREATE_AND_RETURN_EXPR(ftcontains_expr, sctx, udf, loc, range, ftselection, ftignore); |
3385 | 814 | } | 821 | } |
3386 | 815 | 822 | ||
3387 | 816 | 823 | ||
3388 | 817 | //////////////////////////////////////////////////////////////////////////////// | 824 | //////////////////////////////////////////////////////////////////////////////// |
3389 | 818 | 825 | ||
3390 | 819 | //this calls the static create_seq within fo_expr | 826 | //this calls the static create_seq within fo_expr |
3392 | 820 | fo_expr* ExprManager::create_seq(static_context* sctx, const QueryLoc& loc) | 827 | fo_expr* ExprManager::create_seq( |
3393 | 828 | static_context* sctx, | ||
3394 | 829 | user_function* udf, | ||
3395 | 830 | const QueryLoc& loc) | ||
3396 | 821 | { | 831 | { |
3397 | 822 | //TODO make fo_expr use this factory to generate everything | 832 | //TODO make fo_expr use this factory to generate everything |
3399 | 823 | return fo_expr::create_seq(theCCB, sctx, loc); | 833 | return fo_expr::create_seq(theCCB, sctx, udf, loc); |
3400 | 824 | } | 834 | } |
3401 | 825 | 835 | ||
3402 | 826 | 836 | ||
3403 | 827 | fo_expr* ExprManager::create_fo_expr( | 837 | fo_expr* ExprManager::create_fo_expr( |
3404 | 828 | static_context* sctx, | 838 | static_context* sctx, |
3405 | 839 | user_function* udf, | ||
3406 | 829 | const QueryLoc& loc, | 840 | const QueryLoc& loc, |
3407 | 830 | const function* f, | 841 | const function* f, |
3408 | 831 | expr* arg) | 842 | expr* arg) |
3409 | 832 | { | 843 | { |
3411 | 833 | CREATE_AND_RETURN_EXPR(fo_expr, sctx, loc, f, arg); | 844 | CREATE_AND_RETURN_EXPR(fo_expr, sctx, udf, loc, f, arg); |
3412 | 834 | } | 845 | } |
3413 | 835 | 846 | ||
3414 | 836 | 847 | ||
3415 | 837 | fo_expr* ExprManager::create_fo_expr( | 848 | fo_expr* ExprManager::create_fo_expr( |
3416 | 838 | static_context* sctx, | 849 | static_context* sctx, |
3417 | 850 | user_function* udf, | ||
3418 | 839 | const QueryLoc& loc, | 851 | const QueryLoc& loc, |
3419 | 840 | const function* f, | 852 | const function* f, |
3420 | 841 | expr* arg1, | 853 | expr* arg1, |
3421 | 842 | expr* arg2) | 854 | expr* arg2) |
3422 | 843 | { | 855 | { |
3424 | 844 | CREATE_AND_RETURN_EXPR(fo_expr, sctx, loc, f, arg1, arg2); | 856 | CREATE_AND_RETURN_EXPR(fo_expr, sctx, udf, loc, f, arg1, arg2); |
3425 | 845 | } | 857 | } |
3426 | 846 | 858 | ||
3427 | 847 | 859 | ||
3428 | 848 | fo_expr* ExprManager::create_fo_expr( | 860 | fo_expr* ExprManager::create_fo_expr( |
3429 | 849 | static_context* sctx, | 861 | static_context* sctx, |
3430 | 862 | user_function* udf, | ||
3431 | 850 | const QueryLoc& loc, | 863 | const QueryLoc& loc, |
3432 | 851 | const function* f, | 864 | const function* f, |
3433 | 852 | const std::vector<expr*>& args) | 865 | const std::vector<expr*>& args) |
3434 | 853 | { | 866 | { |
3436 | 854 | CREATE_AND_RETURN_EXPR(fo_expr, sctx, loc, f, args); | 867 | CREATE_AND_RETURN_EXPR(fo_expr, sctx, udf, loc, f, args); |
3437 | 855 | } | 868 | } |
3438 | 856 | 869 | ||
3439 | 870 | |||
3440 | 857 | fo_expr* ExprManager::create_fo_expr( | 871 | fo_expr* ExprManager::create_fo_expr( |
3441 | 858 | static_context* sctx, | 872 | static_context* sctx, |
3442 | 873 | user_function* udf, | ||
3443 | 859 | const QueryLoc& loc, | 874 | const QueryLoc& loc, |
3444 | 860 | const function* f) | 875 | const function* f) |
3445 | 861 | { | 876 | { |
3446 | 862 | 877 | ||
3448 | 863 | CREATE_AND_RETURN_EXPR(fo_expr, sctx, loc, f); | 878 | CREATE_AND_RETURN_EXPR(fo_expr, sctx, udf, loc, f); |
3449 | 864 | } | 879 | } |
3450 | 880 | |||
3451 | 865 | //////////////////////////////////////////////////////////////////////////////// | 881 | //////////////////////////////////////////////////////////////////////////////// |
3452 | 866 | 882 | ||
3453 | 867 | for_clause* ExprManager::create_for_clause( | 883 | for_clause* ExprManager::create_for_clause( |
3454 | @@ -877,6 +893,7 @@ | |||
3455 | 877 | sctx, theCCB, loc, varExpr, domainExpr, posVarExpr, scoreVarExpr, isOuter); | 893 | sctx, theCCB, loc, varExpr, domainExpr, posVarExpr, scoreVarExpr, isOuter); |
3456 | 878 | } | 894 | } |
3457 | 879 | 895 | ||
3458 | 896 | |||
3459 | 880 | let_clause* ExprManager::create_let_clause( | 897 | let_clause* ExprManager::create_let_clause( |
3460 | 881 | static_context* sctx, | 898 | static_context* sctx, |
3461 | 882 | const QueryLoc& loc, | 899 | const QueryLoc& loc, |
3462 | @@ -887,6 +904,7 @@ | |||
3463 | 887 | CREATE_AND_RETURN(let_clause, sctx, theCCB, loc, varExpr, domainExpr, lazy); | 904 | CREATE_AND_RETURN(let_clause, sctx, theCCB, loc, varExpr, domainExpr, lazy); |
3464 | 888 | } | 905 | } |
3465 | 889 | 906 | ||
3466 | 907 | |||
3467 | 890 | window_clause* ExprManager::create_window_clause( | 908 | window_clause* ExprManager::create_window_clause( |
3468 | 891 | static_context* sctx, | 909 | static_context* sctx, |
3469 | 892 | const QueryLoc& loc, | 910 | const QueryLoc& loc, |
3470 | @@ -901,16 +919,18 @@ | |||
3471 | 901 | sctx, theCCB, loc, winKind, varExpr, domainExpr, winStart, winStop, lazy); | 919 | sctx, theCCB, loc, winKind, varExpr, domainExpr, winStart, winStop, lazy); |
3472 | 902 | } | 920 | } |
3473 | 903 | 921 | ||
3474 | 922 | |||
3475 | 904 | flwor_wincond* ExprManager::create_flwor_wincond( | 923 | flwor_wincond* ExprManager::create_flwor_wincond( |
3481 | 905 | static_context* sctx, | 924 | static_context* sctx, |
3482 | 906 | bool isOnly, | 925 | bool isOnly, |
3483 | 907 | const flwor_wincond::vars& in_vars, | 926 | const flwor_wincond::vars& in_vars, |
3484 | 908 | const flwor_wincond::vars& out_vars, | 927 | const flwor_wincond::vars& out_vars, |
3485 | 909 | expr* cond) | 928 | expr* cond) |
3486 | 910 | { | 929 | { |
3487 | 911 | CREATE_AND_RETURN(flwor_wincond, theCCB, sctx, isOnly, in_vars, out_vars, cond); | 930 | CREATE_AND_RETURN(flwor_wincond, theCCB, sctx, isOnly, in_vars, out_vars, cond); |
3488 | 912 | } | 931 | } |
3489 | 913 | 932 | ||
3490 | 933 | |||
3491 | 914 | group_clause* ExprManager::create_group_clause( | 934 | group_clause* ExprManager::create_group_clause( |
3492 | 915 | static_context* sctx, | 935 | static_context* sctx, |
3493 | 916 | const QueryLoc& loc, | 936 | const QueryLoc& loc, |
3494 | @@ -921,40 +941,54 @@ | |||
3495 | 921 | CREATE_AND_RETURN(group_clause, sctx, theCCB, loc, gvars, ngvars, collations); | 941 | CREATE_AND_RETURN(group_clause, sctx, theCCB, loc, gvars, ngvars, collations); |
3496 | 922 | } | 942 | } |
3497 | 923 | 943 | ||
3498 | 944 | |||
3499 | 924 | orderby_clause* ExprManager::create_orderby_clause( | 945 | orderby_clause* ExprManager::create_orderby_clause( |
3505 | 925 | static_context* sctx, | 946 | static_context* sctx, |
3506 | 926 | const QueryLoc& loc, | 947 | const QueryLoc& loc, |
3507 | 927 | bool stable, | 948 | bool stable, |
3508 | 928 | const std::vector<OrderModifier>& modifiers, | 949 | const std::vector<OrderModifier>& modifiers, |
3509 | 929 | const std::vector<expr*>& orderingExprs) | 950 | const std::vector<expr*>& orderingExprs) |
3510 | 930 | { | 951 | { |
3511 | 931 | CREATE_AND_RETURN(orderby_clause, sctx, theCCB, loc, stable, modifiers, orderingExprs); | 952 | CREATE_AND_RETURN(orderby_clause, sctx, theCCB, loc, stable, modifiers, orderingExprs); |
3512 | 932 | } | 953 | } |
3513 | 933 | 954 | ||
3514 | 955 | |||
3515 | 934 | materialize_clause* ExprManager::create_materialize_clause( | 956 | materialize_clause* ExprManager::create_materialize_clause( |
3517 | 935 | static_context* sctx, const QueryLoc& loc) | 957 | static_context* sctx, |
3518 | 958 | const QueryLoc& loc) | ||
3519 | 936 | { | 959 | { |
3520 | 937 | CREATE_AND_RETURN(materialize_clause, sctx, theCCB, loc); | 960 | CREATE_AND_RETURN(materialize_clause, sctx, theCCB, loc); |
3521 | 938 | } | 961 | } |
3522 | 939 | 962 | ||
3523 | 963 | |||
3524 | 940 | count_clause* ExprManager::create_count_clause( | 964 | count_clause* ExprManager::create_count_clause( |
3526 | 941 | static_context* sctx, const QueryLoc& loc, var_expr* var) | 965 | static_context* sctx, |
3527 | 966 | const QueryLoc& loc, | ||
3528 | 967 | var_expr* var) | ||
3529 | 942 | { | 968 | { |
3530 | 943 | CREATE_AND_RETURN(count_clause, sctx, theCCB, loc, var); | 969 | CREATE_AND_RETURN(count_clause, sctx, theCCB, loc, var); |
3531 | 944 | } | 970 | } |
3532 | 945 | 971 | ||
3533 | 972 | |||
3534 | 946 | where_clause* ExprManager::create_where_clause( | 973 | where_clause* ExprManager::create_where_clause( |
3536 | 947 | static_context* sctx, const QueryLoc& loc, expr* where) | 974 | static_context* sctx, |
3537 | 975 | const QueryLoc& loc, | ||
3538 | 976 | expr* where) | ||
3539 | 948 | { | 977 | { |
3540 | 949 | CREATE_AND_RETURN(where_clause, sctx, theCCB, loc, where); | 978 | CREATE_AND_RETURN(where_clause, sctx, theCCB, loc, where); |
3541 | 950 | } | 979 | } |
3542 | 951 | 980 | ||
3543 | 981 | |||
3544 | 952 | flwor_expr* ExprManager::create_flwor_expr( | 982 | flwor_expr* ExprManager::create_flwor_expr( |
3546 | 953 | static_context* sctx, const QueryLoc& loc, bool general) | 983 | static_context* sctx, |
3547 | 984 | user_function* udf, | ||
3548 | 985 | const QueryLoc& loc, | ||
3549 | 986 | bool general) | ||
3550 | 954 | { | 987 | { |
3552 | 955 | CREATE_AND_RETURN_EXPR(flwor_expr, sctx, loc, general); | 988 | CREATE_AND_RETURN_EXPR(flwor_expr, sctx, udf, loc, general); |
3553 | 956 | } | 989 | } |
3554 | 957 | 990 | ||
3555 | 991 | |||
3556 | 958 | pragma* ExprManager::create_pragma( | 992 | pragma* ExprManager::create_pragma( |
3557 | 959 | const store::Item_t& name, | 993 | const store::Item_t& name, |
3558 | 960 | const zstring& lit) | 994 | const zstring& lit) |
3559 | 961 | 995 | ||
3560 | === modified file 'src/compiler/expression/expr_manager.h' | |||
3561 | --- src/compiler/expression/expr_manager.h 2012-10-08 12:09:36 +0000 | |||
3562 | +++ src/compiler/expression/expr_manager.h 2012-10-09 13:35:26 +0000 | |||
3563 | @@ -31,6 +31,7 @@ | |||
3564 | 31 | 31 | ||
3565 | 32 | class CompilerCB; | 32 | class CompilerCB; |
3566 | 33 | 33 | ||
3567 | 34 | |||
3568 | 34 | class ExprManager | 35 | class ExprManager |
3569 | 35 | { | 36 | { |
3570 | 36 | private: | 37 | private: |
3571 | @@ -75,6 +76,7 @@ | |||
3572 | 75 | public: | 76 | public: |
3573 | 76 | if_expr* create_if_expr( | 77 | if_expr* create_if_expr( |
3574 | 77 | static_context* sctx, | 78 | static_context* sctx, |
3575 | 79 | user_function* udf, | ||
3576 | 78 | const QueryLoc& loc, | 80 | const QueryLoc& loc, |
3577 | 79 | expr* cond_expr, | 81 | expr* cond_expr, |
3578 | 80 | expr* then_expr, | 82 | expr* then_expr, |
3579 | @@ -82,12 +84,14 @@ | |||
3580 | 82 | 84 | ||
3581 | 83 | order_expr* create_order_expr( | 85 | order_expr* create_order_expr( |
3582 | 84 | static_context* sctx, | 86 | static_context* sctx, |
3583 | 87 | user_function* udf, | ||
3584 | 85 | const QueryLoc& loc, | 88 | const QueryLoc& loc, |
3585 | 86 | order_expr::order_type_t, | 89 | order_expr::order_type_t, |
3586 | 87 | expr*); | 90 | expr*); |
3587 | 88 | 91 | ||
3588 | 89 | validate_expr* create_validate_expr( | 92 | validate_expr* create_validate_expr( |
3589 | 90 | static_context*, | 93 | static_context*, |
3590 | 94 | user_function* udf, | ||
3591 | 91 | const QueryLoc&, | 95 | const QueryLoc&, |
3592 | 92 | ParseConstants::validation_mode_t, | 96 | ParseConstants::validation_mode_t, |
3593 | 93 | const store::Item_t& aTypeName, | 97 | const store::Item_t& aTypeName, |
3594 | @@ -96,12 +100,14 @@ | |||
3595 | 96 | 100 | ||
3596 | 97 | cast_expr* create_cast_expr( | 101 | cast_expr* create_cast_expr( |
3597 | 98 | static_context* sctx, | 102 | static_context* sctx, |
3598 | 103 | user_function* udf, | ||
3599 | 99 | const QueryLoc&, | 104 | const QueryLoc&, |
3600 | 100 | expr*, | 105 | expr*, |
3601 | 101 | xqtref_t); | 106 | xqtref_t); |
3602 | 102 | 107 | ||
3603 | 103 | treat_expr* create_treat_expr( | 108 | treat_expr* create_treat_expr( |
3604 | 104 | static_context* sctx, | 109 | static_context* sctx, |
3605 | 110 | user_function* udf, | ||
3606 | 105 | const QueryLoc& loc, | 111 | const QueryLoc& loc, |
3607 | 106 | expr* input, | 112 | expr* input, |
3608 | 107 | const xqtref_t& type, | 113 | const xqtref_t& type, |
3609 | @@ -112,6 +118,7 @@ | |||
3610 | 112 | 118 | ||
3611 | 113 | promote_expr* create_promote_expr( | 119 | promote_expr* create_promote_expr( |
3612 | 114 | static_context* sctx, | 120 | static_context* sctx, |
3613 | 121 | user_function* udf, | ||
3614 | 115 | const QueryLoc& loc, | 122 | const QueryLoc& loc, |
3615 | 116 | expr* input, | 123 | expr* input, |
3616 | 117 | const xqtref_t& type, | 124 | const xqtref_t& type, |
3617 | @@ -120,12 +127,14 @@ | |||
3618 | 120 | 127 | ||
3619 | 121 | castable_expr* create_castable_expr( | 128 | castable_expr* create_castable_expr( |
3620 | 122 | static_context* sctx, | 129 | static_context* sctx, |
3621 | 130 | user_function* udf, | ||
3622 | 123 | const QueryLoc&, | 131 | const QueryLoc&, |
3623 | 124 | expr*, | 132 | expr*, |
3624 | 125 | xqtref_t); | 133 | xqtref_t); |
3625 | 126 | 134 | ||
3626 | 127 | instanceof_expr* create_instanceof_expr( | 135 | instanceof_expr* create_instanceof_expr( |
3627 | 128 | static_context* sctx, | 136 | static_context* sctx, |
3628 | 137 | user_function* udf, | ||
3629 | 129 | const QueryLoc&, | 138 | const QueryLoc&, |
3630 | 130 | expr*, | 139 | expr*, |
3631 | 131 | xqtref_t, | 140 | xqtref_t, |
3632 | @@ -133,6 +142,7 @@ | |||
3633 | 133 | 142 | ||
3634 | 134 | name_cast_expr* create_name_cast_expr( | 143 | name_cast_expr* create_name_cast_expr( |
3635 | 135 | static_context* sctx, | 144 | static_context* sctx, |
3636 | 145 | user_function* udf, | ||
3637 | 136 | const QueryLoc&, | 146 | const QueryLoc&, |
3638 | 137 | expr*, | 147 | expr*, |
3639 | 138 | const namespace_context*, | 148 | const namespace_context*, |
3640 | @@ -140,12 +150,14 @@ | |||
3641 | 140 | 150 | ||
3642 | 141 | doc_expr* create_doc_expr( | 151 | doc_expr* create_doc_expr( |
3643 | 142 | static_context* sctx, | 152 | static_context* sctx, |
3644 | 153 | user_function* udf, | ||
3645 | 143 | const QueryLoc&, | 154 | const QueryLoc&, |
3646 | 144 | expr* content, | 155 | expr* content, |
3647 | 145 | bool copyNodes); | 156 | bool copyNodes); |
3648 | 146 | 157 | ||
3649 | 147 | elem_expr* create_elem_expr( | 158 | elem_expr* create_elem_expr( |
3650 | 148 | static_context* sctx, | 159 | static_context* sctx, |
3651 | 160 | user_function* udf, | ||
3652 | 149 | const QueryLoc&, | 161 | const QueryLoc&, |
3653 | 150 | expr* qnameExpr, | 162 | expr* qnameExpr, |
3654 | 151 | expr* attrs, | 163 | expr* attrs, |
3655 | @@ -155,6 +167,7 @@ | |||
3656 | 155 | 167 | ||
3657 | 156 | elem_expr* create_elem_expr( | 168 | elem_expr* create_elem_expr( |
3658 | 157 | static_context* sctx, | 169 | static_context* sctx, |
3659 | 170 | user_function* udf, | ||
3660 | 158 | const QueryLoc&, | 171 | const QueryLoc&, |
3661 | 159 | expr* qnameExpr, | 172 | expr* qnameExpr, |
3662 | 160 | expr* content, | 173 | expr* content, |
3663 | @@ -163,64 +176,76 @@ | |||
3664 | 163 | 176 | ||
3665 | 164 | attr_expr* create_attr_expr( | 177 | attr_expr* create_attr_expr( |
3666 | 165 | static_context* sctx, | 178 | static_context* sctx, |
3667 | 179 | user_function* udf, | ||
3668 | 166 | const QueryLoc& loc, | 180 | const QueryLoc& loc, |
3669 | 167 | expr* aQNameExpr, | 181 | expr* aQNameExpr, |
3670 | 168 | expr* aValueExpr); | 182 | expr* aValueExpr); |
3671 | 169 | 183 | ||
3672 | 170 | text_expr* create_text_expr( | 184 | text_expr* create_text_expr( |
3673 | 171 | static_context* sctx, | 185 | static_context* sctx, |
3674 | 186 | user_function* udf, | ||
3675 | 172 | const QueryLoc&, | 187 | const QueryLoc&, |
3676 | 173 | text_expr::text_constructor_type, | 188 | text_expr::text_constructor_type, |
3677 | 174 | expr*); | 189 | expr*); |
3678 | 175 | 190 | ||
3679 | 176 | pi_expr* create_pi_expr( | 191 | pi_expr* create_pi_expr( |
3680 | 177 | static_context* sctx, | 192 | static_context* sctx, |
3681 | 193 | user_function* udf, | ||
3682 | 178 | const QueryLoc&, | 194 | const QueryLoc&, |
3683 | 179 | expr*, | 195 | expr*, |
3684 | 180 | expr*); | 196 | expr*); |
3685 | 181 | 197 | ||
3686 | 182 | const_expr* create_const_expr( | 198 | const_expr* create_const_expr( |
3687 | 183 | static_context* sctx, | 199 | static_context* sctx, |
3688 | 200 | user_function* udf, | ||
3689 | 184 | const QueryLoc&, | 201 | const QueryLoc&, |
3690 | 185 | zstring& sval); | 202 | zstring& sval); |
3691 | 186 | 203 | ||
3692 | 187 | const_expr* create_const_expr( | 204 | const_expr* create_const_expr( |
3693 | 188 | static_context* sctx, | 205 | static_context* sctx, |
3694 | 206 | user_function* udf, | ||
3695 | 189 | const QueryLoc&, | 207 | const QueryLoc&, |
3696 | 190 | const std::string& sval); | 208 | const std::string& sval); |
3697 | 191 | 209 | ||
3698 | 192 | const_expr* create_const_expr( | 210 | const_expr* create_const_expr( |
3699 | 193 | static_context* sctx, | 211 | static_context* sctx, |
3700 | 212 | user_function* udf, | ||
3701 | 194 | const QueryLoc&, | 213 | const QueryLoc&, |
3702 | 195 | const char* sval); | 214 | const char* sval); |
3703 | 196 | 215 | ||
3704 | 197 | const_expr* create_const_expr( | 216 | const_expr* create_const_expr( |
3705 | 198 | static_context* sctx, | 217 | static_context* sctx, |
3706 | 218 | user_function* udf, | ||
3707 | 199 | const QueryLoc&, | 219 | const QueryLoc&, |
3708 | 200 | xs_integer); | 220 | xs_integer); |
3709 | 201 | 221 | ||
3710 | 202 | const_expr* create_const_expr( | 222 | const_expr* create_const_expr( |
3711 | 203 | static_context* sctx, | 223 | static_context* sctx, |
3712 | 224 | user_function* udf, | ||
3713 | 204 | const QueryLoc&, | 225 | const QueryLoc&, |
3714 | 205 | xs_decimal); | 226 | xs_decimal); |
3715 | 206 | 227 | ||
3716 | 207 | const_expr* create_const_expr( | 228 | const_expr* create_const_expr( |
3717 | 208 | static_context* sctx, | 229 | static_context* sctx, |
3718 | 230 | user_function* udf, | ||
3719 | 209 | const QueryLoc&, | 231 | const QueryLoc&, |
3720 | 210 | xs_double); | 232 | xs_double); |
3721 | 211 | 233 | ||
3722 | 212 | const_expr* create_const_expr( | 234 | const_expr* create_const_expr( |
3723 | 213 | static_context* sctx, | 235 | static_context* sctx, |
3724 | 236 | user_function* udf, | ||
3725 | 214 | const QueryLoc&, | 237 | const QueryLoc&, |
3726 | 215 | xs_boolean); | 238 | xs_boolean); |
3727 | 216 | 239 | ||
3728 | 217 | const_expr* create_const_expr( | 240 | const_expr* create_const_expr( |
3729 | 218 | static_context* sctx, | 241 | static_context* sctx, |
3730 | 242 | user_function* udf, | ||
3731 | 219 | const QueryLoc&, | 243 | const QueryLoc&, |
3732 | 220 | store::Item_t); | 244 | store::Item_t); |
3733 | 221 | 245 | ||
3734 | 222 | const_expr* create_const_expr( | 246 | const_expr* create_const_expr( |
3735 | 223 | static_context* sctx, | 247 | static_context* sctx, |
3736 | 248 | user_function* udf, | ||
3737 | 224 | const QueryLoc&, | 249 | const QueryLoc&, |
3738 | 225 | const char* ns, | 250 | const char* ns, |
3739 | 226 | const char* pre, | 251 | const char* pre, |
3740 | @@ -228,10 +253,12 @@ | |||
3741 | 228 | 253 | ||
3742 | 229 | extension_expr* create_extension_expr( | 254 | extension_expr* create_extension_expr( |
3743 | 230 | static_context* sctx, | 255 | static_context* sctx, |
3744 | 256 | user_function* udf, | ||
3745 | 231 | const QueryLoc&); | 257 | const QueryLoc&); |
3746 | 232 | 258 | ||
3747 | 233 | extension_expr* create_extension_expr( | 259 | extension_expr* create_extension_expr( |
3748 | 234 | static_context* sctx, | 260 | static_context* sctx, |
3749 | 261 | user_function* udf, | ||
3750 | 235 | const QueryLoc&, | 262 | const QueryLoc&, |
3751 | 236 | expr*); | 263 | expr*); |
3752 | 237 | 264 | ||
3753 | @@ -239,23 +266,31 @@ | |||
3754 | 239 | 266 | ||
3755 | 240 | trycatch_expr* create_trycatch_expr( | 267 | trycatch_expr* create_trycatch_expr( |
3756 | 241 | static_context* sctx, | 268 | static_context* sctx, |
3757 | 269 | user_function* udf, | ||
3758 | 242 | const QueryLoc&, | 270 | const QueryLoc&, |
3759 | 243 | expr* tryExpr); | 271 | expr* tryExpr); |
3760 | 244 | 272 | ||
3761 | 245 | wrapper_expr* create_wrapper_expr( | 273 | wrapper_expr* create_wrapper_expr( |
3762 | 246 | static_context* sctx, | 274 | static_context* sctx, |
3763 | 275 | user_function* udf, | ||
3764 | 247 | const QueryLoc& loc, | 276 | const QueryLoc& loc, |
3765 | 248 | expr* wrapped); | 277 | expr* wrapped); |
3766 | 249 | 278 | ||
3767 | 279 | #if 0 | ||
3768 | 250 | function_trace_expr* create_function_trace_expr( | 280 | function_trace_expr* create_function_trace_expr( |
3769 | 251 | static_context* sctx, | 281 | static_context* sctx, |
3770 | 282 | user_function* udf, | ||
3771 | 252 | const QueryLoc& loc, | 283 | const QueryLoc& loc, |
3772 | 253 | expr* aChild); | 284 | expr* aChild); |
3773 | 285 | #endif | ||
3774 | 254 | 286 | ||
3776 | 255 | function_trace_expr* create_function_trace_expr(expr* aExpr); | 287 | function_trace_expr* create_function_trace_expr( |
3777 | 288 | user_function* udf, | ||
3778 | 289 | expr* aExpr); | ||
3779 | 256 | 290 | ||
3780 | 257 | eval_expr* create_eval_expr( | 291 | eval_expr* create_eval_expr( |
3781 | 258 | static_context* sctx, | 292 | static_context* sctx, |
3782 | 293 | user_function* udf, | ||
3783 | 259 | const QueryLoc& loc, | 294 | const QueryLoc& loc, |
3784 | 260 | expr* e, | 295 | expr* e, |
3785 | 261 | expr_script_kind_t scriptingKind, | 296 | expr_script_kind_t scriptingKind, |
3786 | @@ -264,6 +299,7 @@ | |||
3787 | 264 | #ifdef ZORBA_WITH_DEBUGGER | 299 | #ifdef ZORBA_WITH_DEBUGGER |
3788 | 265 | debugger_expr* create_debugger_expr( | 300 | debugger_expr* create_debugger_expr( |
3789 | 266 | static_context* sctx, | 301 | static_context* sctx, |
3790 | 302 | user_function* udf, | ||
3791 | 267 | const QueryLoc& loc, | 303 | const QueryLoc& loc, |
3792 | 268 | expr* aChild, | 304 | expr* aChild, |
3793 | 269 | namespace_context* nsCtx, | 305 | namespace_context* nsCtx, |
3794 | @@ -274,11 +310,12 @@ | |||
3795 | 274 | 310 | ||
3796 | 275 | var_expr* create_var_expr( | 311 | var_expr* create_var_expr( |
3797 | 276 | static_context* sctx, | 312 | static_context* sctx, |
3798 | 313 | user_function* udf, | ||
3799 | 277 | const QueryLoc& loc, | 314 | const QueryLoc& loc, |
3800 | 278 | var_expr::var_kind k, | 315 | var_expr::var_kind k, |
3801 | 279 | store::Item* name); | 316 | store::Item* name); |
3802 | 280 | 317 | ||
3804 | 281 | var_expr* create_var_expr(const var_expr& source); | 318 | var_expr* create_var_expr(user_function* udf, const var_expr& source); |
3805 | 282 | 319 | ||
3806 | 283 | //////////////////////////////////////////////////////////////////////////////// | 320 | //////////////////////////////////////////////////////////////////////////////// |
3807 | 284 | 321 | ||
3808 | @@ -286,17 +323,20 @@ | |||
3809 | 286 | 323 | ||
3810 | 287 | json_array_expr* create_json_array_expr( | 324 | json_array_expr* create_json_array_expr( |
3811 | 288 | static_context* sctx, | 325 | static_context* sctx, |
3812 | 326 | user_function* udf, | ||
3813 | 289 | const QueryLoc& loc, | 327 | const QueryLoc& loc, |
3814 | 290 | expr* content); | 328 | expr* content); |
3815 | 291 | 329 | ||
3816 | 292 | json_object_expr* create_json_object_expr( | 330 | json_object_expr* create_json_object_expr( |
3817 | 293 | static_context* sctx, | 331 | static_context* sctx, |
3818 | 332 | user_function* udf, | ||
3819 | 294 | const QueryLoc& loc, | 333 | const QueryLoc& loc, |
3820 | 295 | expr* content, | 334 | expr* content, |
3821 | 296 | bool accumulate); | 335 | bool accumulate); |
3822 | 297 | 336 | ||
3823 | 298 | json_direct_object_expr* create_json_direct_object_expr( | 337 | json_direct_object_expr* create_json_direct_object_expr( |
3824 | 299 | static_context* sctx, | 338 | static_context* sctx, |
3825 | 339 | user_function* udf, | ||
3826 | 300 | const QueryLoc&, | 340 | const QueryLoc&, |
3827 | 301 | std::vector<expr*>& names, | 341 | std::vector<expr*>& names, |
3828 | 302 | std::vector<expr*>& values); | 342 | std::vector<expr*>& values); |
3829 | @@ -307,6 +347,7 @@ | |||
3830 | 307 | 347 | ||
3831 | 308 | insert_expr* create_insert_expr( | 348 | insert_expr* create_insert_expr( |
3832 | 309 | static_context* sctx, | 349 | static_context* sctx, |
3833 | 350 | user_function* udf, | ||
3834 | 310 | const QueryLoc&, | 351 | const QueryLoc&, |
3835 | 311 | store::UpdateConsts::InsertType, | 352 | store::UpdateConsts::InsertType, |
3836 | 312 | expr* aSourceExpr, | 353 | expr* aSourceExpr, |
3837 | @@ -314,11 +355,13 @@ | |||
3838 | 314 | 355 | ||
3839 | 315 | delete_expr* create_delete_expr( | 356 | delete_expr* create_delete_expr( |
3840 | 316 | static_context* sctx, | 357 | static_context* sctx, |
3841 | 358 | user_function* udf, | ||
3842 | 317 | const QueryLoc&, | 359 | const QueryLoc&, |
3843 | 318 | expr*); | 360 | expr*); |
3844 | 319 | 361 | ||
3845 | 320 | replace_expr* create_replace_expr( | 362 | replace_expr* create_replace_expr( |
3846 | 321 | static_context* sctx, | 363 | static_context* sctx, |
3847 | 364 | user_function* udf, | ||
3848 | 322 | const QueryLoc&, | 365 | const QueryLoc&, |
3849 | 323 | store::UpdateConsts::ReplaceType aType, | 366 | store::UpdateConsts::ReplaceType aType, |
3850 | 324 | expr*, | 367 | expr*, |
3851 | @@ -326,6 +369,7 @@ | |||
3852 | 326 | 369 | ||
3853 | 327 | rename_expr* create_rename_expr( | 370 | rename_expr* create_rename_expr( |
3854 | 328 | static_context* sctx, | 371 | static_context* sctx, |
3855 | 372 | user_function* udf, | ||
3856 | 329 | const QueryLoc&, | 373 | const QueryLoc&, |
3857 | 330 | expr*, | 374 | expr*, |
3858 | 331 | expr*); | 375 | expr*); |
3859 | @@ -334,10 +378,12 @@ | |||
3860 | 334 | 378 | ||
3861 | 335 | transform_expr* create_transform_expr( | 379 | transform_expr* create_transform_expr( |
3862 | 336 | static_context* sctx, | 380 | static_context* sctx, |
3863 | 381 | user_function* udf, | ||
3864 | 337 | const QueryLoc& loc); | 382 | const QueryLoc& loc); |
3865 | 338 | 383 | ||
3866 | 339 | block_expr* create_block_expr( | 384 | block_expr* create_block_expr( |
3867 | 340 | static_context* sctx, | 385 | static_context* sctx, |
3868 | 386 | user_function* udf, | ||
3869 | 341 | const QueryLoc& loc, | 387 | const QueryLoc& loc, |
3870 | 342 | bool allowLastUpdating, | 388 | bool allowLastUpdating, |
3871 | 343 | std::vector<expr*>& seq, | 389 | std::vector<expr*>& seq, |
3872 | @@ -345,61 +391,79 @@ | |||
3873 | 345 | 391 | ||
3874 | 346 | apply_expr* create_apply_expr( | 392 | apply_expr* create_apply_expr( |
3875 | 347 | static_context* sctx, | 393 | static_context* sctx, |
3876 | 394 | user_function* udf, | ||
3877 | 348 | const QueryLoc& loc, | 395 | const QueryLoc& loc, |
3878 | 349 | expr* inExpr, | 396 | expr* inExpr, |
3879 | 350 | bool discardXDM); | 397 | bool discardXDM); |
3880 | 351 | 398 | ||
3881 | 352 | var_decl_expr* create_var_decl_expr( | 399 | var_decl_expr* create_var_decl_expr( |
3882 | 353 | static_context* sctx, | 400 | static_context* sctx, |
3883 | 401 | user_function* udf, | ||
3884 | 354 | const QueryLoc& loc, | 402 | const QueryLoc& loc, |
3885 | 355 | var_expr* varExpr, | 403 | var_expr* varExpr, |
3886 | 356 | expr* initExpr); | 404 | expr* initExpr); |
3887 | 357 | 405 | ||
3888 | 358 | var_set_expr* create_var_set_expr( | 406 | var_set_expr* create_var_set_expr( |
3889 | 359 | static_context* sctx, | 407 | static_context* sctx, |
3890 | 408 | user_function* udf, | ||
3891 | 360 | const QueryLoc& loc, | 409 | const QueryLoc& loc, |
3892 | 361 | var_expr* varExpr, | 410 | var_expr* varExpr, |
3893 | 362 | expr* setExpr); | 411 | expr* setExpr); |
3894 | 363 | 412 | ||
3895 | 364 | exit_expr* create_exit_expr( | 413 | exit_expr* create_exit_expr( |
3896 | 365 | static_context* sctx, | 414 | static_context* sctx, |
3897 | 415 | user_function* udf, | ||
3898 | 366 | const QueryLoc& loc, | 416 | const QueryLoc& loc, |
3899 | 367 | expr* inExpr); | 417 | expr* inExpr); |
3900 | 368 | 418 | ||
3901 | 369 | exit_catcher_expr* create_exit_catcher_expr( | 419 | exit_catcher_expr* create_exit_catcher_expr( |
3902 | 370 | static_context* sctx, | 420 | static_context* sctx, |
3903 | 421 | user_function* udf, | ||
3904 | 371 | const QueryLoc& loc, | 422 | const QueryLoc& loc, |
3905 | 372 | expr* inExpr, | 423 | expr* inExpr, |
3906 | 373 | std::vector<expr*>& exitExprs); | 424 | std::vector<expr*>& exitExprs); |
3907 | 374 | 425 | ||
3908 | 375 | flowctl_expr* create_flowctl_expr( | 426 | flowctl_expr* create_flowctl_expr( |
3909 | 376 | static_context* sctx, | 427 | static_context* sctx, |
3910 | 428 | user_function* udf, | ||
3911 | 377 | const QueryLoc& loc, | 429 | const QueryLoc& loc, |
3912 | 378 | flowctl_expr::action action); | 430 | flowctl_expr::action action); |
3913 | 379 | 431 | ||
3914 | 380 | while_expr* create_while_expr( | 432 | while_expr* create_while_expr( |
3915 | 381 | static_context* sctx, | 433 | static_context* sctx, |
3916 | 434 | user_function* udf, | ||
3917 | 382 | const QueryLoc& loc, | 435 | const QueryLoc& loc, |
3918 | 383 | expr* body); | 436 | expr* body); |
3919 | 384 | 437 | ||
3920 | 385 | //////////////////////////////////////////////////////////////////////////////// | 438 | //////////////////////////////////////////////////////////////////////////////// |
3921 | 386 | 439 | ||
3927 | 387 | relpath_expr* create_relpath_expr(static_context* sctx, const QueryLoc& loc); | 440 | relpath_expr* create_relpath_expr( |
3928 | 388 | 441 | static_context* sctx, | |
3929 | 389 | axis_step_expr* create_axis_step_expr(static_context* sctx, const QueryLoc&); | 442 | user_function* udf, |
3930 | 390 | 443 | const QueryLoc& loc); | |
3931 | 391 | match_expr* create_match_expr(static_context* sctx, const QueryLoc&); | 444 | |
3932 | 445 | axis_step_expr* create_axis_step_expr( | ||
3933 | 446 | static_context* sctx, | ||
3934 | 447 | user_function* udf, | ||
3935 | 448 | const QueryLoc&); | ||
3936 | 449 | |||
3937 | 450 | match_expr* create_match_expr( | ||
3938 | 451 | static_context* sctx, | ||
3939 | 452 | user_function* udf, | ||
3940 | 453 | const QueryLoc&); | ||
3941 | 392 | 454 | ||
3942 | 393 | //////////////////////////////////////////////////////////////////////////////// | 455 | //////////////////////////////////////////////////////////////////////////////// |
3943 | 394 | 456 | ||
3944 | 395 | dynamic_function_invocation_expr* create_dynamic_function_invocation_expr( | 457 | dynamic_function_invocation_expr* create_dynamic_function_invocation_expr( |
3945 | 396 | static_context* sctx, | 458 | static_context* sctx, |
3946 | 459 | user_function* udf, | ||
3947 | 397 | const QueryLoc& loc, | 460 | const QueryLoc& loc, |
3948 | 398 | expr* anExpr, | 461 | expr* anExpr, |
3949 | 399 | const std::vector<expr*>& args); | 462 | const std::vector<expr*>& args); |
3950 | 400 | 463 | ||
3951 | 401 | function_item_expr* create_function_item_expr( | 464 | function_item_expr* create_function_item_expr( |
3952 | 402 | static_context* sctx, | 465 | static_context* sctx, |
3953 | 466 | user_function* udf, | ||
3954 | 403 | const QueryLoc& loc, | 467 | const QueryLoc& loc, |
3955 | 404 | const store::Item* aQName, | 468 | const store::Item* aQName, |
3956 | 405 | function* f, | 469 | function* f, |
3957 | @@ -407,10 +471,12 @@ | |||
3958 | 407 | 471 | ||
3959 | 408 | function_item_expr* create_function_item_expr( | 472 | function_item_expr* create_function_item_expr( |
3960 | 409 | static_context* sctx, | 473 | static_context* sctx, |
3961 | 474 | user_function* udf, | ||
3962 | 410 | const QueryLoc& loc); | 475 | const QueryLoc& loc); |
3963 | 411 | 476 | ||
3964 | 412 | ftcontains_expr* create_ftcontains_expr( | 477 | ftcontains_expr* create_ftcontains_expr( |
3965 | 413 | static_context*, | 478 | static_context*, |
3966 | 479 | user_function* udf, | ||
3967 | 414 | QueryLoc const&, | 480 | QueryLoc const&, |
3968 | 415 | expr* range, | 481 | expr* range, |
3969 | 416 | ftnode *ftselection, | 482 | ftnode *ftselection, |
3970 | @@ -419,16 +485,21 @@ | |||
3971 | 419 | //////////////////////////////////////////////////////////////////////////////// | 485 | //////////////////////////////////////////////////////////////////////////////// |
3972 | 420 | 486 | ||
3973 | 421 | //this calls the static create_seq within fo_expr | 487 | //this calls the static create_seq within fo_expr |
3975 | 422 | fo_expr* create_seq(static_context* sctx, const QueryLoc &); | 488 | fo_expr* create_seq( |
3976 | 489 | static_context* sctx, | ||
3977 | 490 | user_function* udf, | ||
3978 | 491 | const QueryLoc &); | ||
3979 | 423 | 492 | ||
3980 | 424 | fo_expr* create_fo_expr( | 493 | fo_expr* create_fo_expr( |
3981 | 425 | static_context* sctx, | 494 | static_context* sctx, |
3982 | 495 | user_function* udf, | ||
3983 | 426 | const QueryLoc& loc, | 496 | const QueryLoc& loc, |
3984 | 427 | const function* f, | 497 | const function* f, |
3985 | 428 | expr* arg); | 498 | expr* arg); |
3986 | 429 | 499 | ||
3987 | 430 | fo_expr* create_fo_expr( | 500 | fo_expr* create_fo_expr( |
3988 | 431 | static_context* sctx, | 501 | static_context* sctx, |
3989 | 502 | user_function* udf, | ||
3990 | 432 | const QueryLoc& loc, | 503 | const QueryLoc& loc, |
3991 | 433 | const function* f, | 504 | const function* f, |
3992 | 434 | expr* arg1, | 505 | expr* arg1, |
3993 | @@ -436,12 +507,14 @@ | |||
3994 | 436 | 507 | ||
3995 | 437 | fo_expr* create_fo_expr( | 508 | fo_expr* create_fo_expr( |
3996 | 438 | static_context* sctx, | 509 | static_context* sctx, |
3997 | 510 | user_function* udf, | ||
3998 | 439 | const QueryLoc& loc, | 511 | const QueryLoc& loc, |
3999 | 440 | const function* f, | 512 | const function* f, |
4000 | 441 | const std::vector<expr*>& args); | 513 | const std::vector<expr*>& args); |
4001 | 442 | 514 | ||
4002 | 443 | fo_expr* create_fo_expr( | 515 | fo_expr* create_fo_expr( |
4003 | 444 | static_context* sctx, | 516 | static_context* sctx, |
4004 | 517 | user_function* udf, | ||
4005 | 445 | const QueryLoc& loc, | 518 | const QueryLoc& loc, |
4006 | 446 | const function* f); | 519 | const function* f); |
4007 | 447 | 520 | ||
4008 | @@ -510,6 +583,7 @@ | |||
4009 | 510 | 583 | ||
4010 | 511 | flwor_expr* create_flwor_expr( | 584 | flwor_expr* create_flwor_expr( |
4011 | 512 | static_context* sctx, | 585 | static_context* sctx, |
4012 | 586 | user_function* udf, | ||
4013 | 513 | const QueryLoc& loc, | 587 | const QueryLoc& loc, |
4014 | 514 | bool general); | 588 | bool general); |
4015 | 515 | 589 | ||
4016 | @@ -524,17 +598,20 @@ | |||
4017 | 524 | 598 | ||
4018 | 525 | json_array_expr* create_json_array_expr( | 599 | json_array_expr* create_json_array_expr( |
4019 | 526 | static_context* sctx, | 600 | static_context* sctx, |
4020 | 601 | user_function* udf, | ||
4021 | 527 | const QueryLoc& loc, | 602 | const QueryLoc& loc, |
4022 | 528 | expr* content); | 603 | expr* content); |
4023 | 529 | 604 | ||
4024 | 530 | json_object_expr* create_json_object_expr( | 605 | json_object_expr* create_json_object_expr( |
4025 | 531 | static_context* sctx, | 606 | static_context* sctx, |
4026 | 607 | user_function* udf, | ||
4027 | 532 | const QueryLoc& loc, | 608 | const QueryLoc& loc, |
4028 | 533 | expr* content, | 609 | expr* content, |
4029 | 534 | bool accumulate); | 610 | bool accumulate); |
4030 | 535 | 611 | ||
4031 | 536 | json_direct_object_expr* create_json_direct_object_expr( | 612 | json_direct_object_expr* create_json_direct_object_expr( |
4032 | 537 | static_context* sctx, | 613 | static_context* sctx, |
4033 | 614 | user_function* udf, | ||
4034 | 538 | const QueryLoc& loc, | 615 | const QueryLoc& loc, |
4035 | 539 | std::vector<expr*>& names, | 616 | std::vector<expr*>& names, |
4036 | 540 | std::vector<expr*>& values); | 617 | std::vector<expr*>& values); |
4037 | 541 | 618 | ||
4038 | === modified file 'src/compiler/expression/flwor_expr.cpp' | |||
4039 | --- src/compiler/expression/flwor_expr.cpp 2012-10-08 12:09:36 +0000 | |||
4040 | +++ src/compiler/expression/flwor_expr.cpp 2012-10-09 13:35:26 +0000 | |||
4041 | @@ -107,6 +107,7 @@ | |||
4042 | 107 | { | 107 | { |
4043 | 108 | theDomainExpr = theCCB->theEM-> | 108 | theDomainExpr = theCCB->theEM-> |
4044 | 109 | create_treat_expr(theDomainExpr->get_sctx(), | 109 | create_treat_expr(theDomainExpr->get_sctx(), |
4045 | 110 | theDomainExpr->get_udf(), | ||
4046 | 110 | theDomainExpr->get_loc(), | 111 | theDomainExpr->get_loc(), |
4047 | 111 | theDomainExpr, | 112 | theDomainExpr, |
4048 | 112 | varType, | 113 | varType, |
4049 | @@ -173,11 +174,13 @@ | |||
4050 | 173 | *declaredType)); | 174 | *declaredType)); |
4051 | 174 | } | 175 | } |
4052 | 175 | 176 | ||
4058 | 176 | domainExpr = theCCB->theEM->create_treat_expr(sctx, | 177 | domainExpr = theCCB->theEM-> |
4059 | 177 | loc, | 178 | create_treat_expr(sctx, |
4060 | 178 | domainExpr, | 179 | domainExpr->get_udf(), |
4061 | 179 | declaredType, | 180 | loc, |
4062 | 180 | TreatIterator::TYPE_MATCH); | 181 | domainExpr, |
4063 | 182 | declaredType, | ||
4064 | 183 | TreatIterator::TYPE_MATCH); | ||
4065 | 181 | 184 | ||
4066 | 182 | set_expr(domainExpr); | 185 | set_expr(domainExpr); |
4067 | 183 | } | 186 | } |
4068 | @@ -225,18 +228,18 @@ | |||
4069 | 225 | } | 228 | } |
4070 | 226 | 229 | ||
4071 | 227 | 230 | ||
4073 | 228 | flwor_clause* for_clause::clone(expr::substitution_t& subst) const | 231 | flwor_clause* for_clause::clone(user_function* udf, expr::substitution_t& subst) const |
4074 | 229 | { | 232 | { |
4076 | 230 | expr* domainCopy = theDomainExpr->clone(subst); | 233 | expr* domainCopy = theDomainExpr->clone(udf, subst); |
4077 | 231 | 234 | ||
4079 | 232 | var_expr* varCopy = theCCB->theEM->create_var_expr(*theVarExpr); | 235 | var_expr* varCopy = theCCB->theEM->create_var_expr(udf, *theVarExpr); |
4080 | 233 | subst[theVarExpr] = varCopy; | 236 | subst[theVarExpr] = varCopy; |
4081 | 234 | 237 | ||
4082 | 235 | var_expr* posvarCopy = NULL; | 238 | var_expr* posvarCopy = NULL; |
4083 | 236 | var_expr* pos_var_ptr = thePosVarExpr; | 239 | var_expr* pos_var_ptr = thePosVarExpr; |
4084 | 237 | if (pos_var_ptr) | 240 | if (pos_var_ptr) |
4085 | 238 | { | 241 | { |
4087 | 239 | posvarCopy = theCCB->theEM->create_var_expr(*pos_var_ptr); | 242 | posvarCopy = theCCB->theEM->create_var_expr(udf, *pos_var_ptr); |
4088 | 240 | subst[pos_var_ptr] = posvarCopy; | 243 | subst[pos_var_ptr] = posvarCopy; |
4089 | 241 | } | 244 | } |
4090 | 242 | 245 | ||
4091 | @@ -244,17 +247,17 @@ | |||
4092 | 244 | var_expr* score_var_ptr = theScoreVarExpr; | 247 | var_expr* score_var_ptr = theScoreVarExpr; |
4093 | 245 | if (score_var_ptr) | 248 | if (score_var_ptr) |
4094 | 246 | { | 249 | { |
4096 | 247 | scorevarCopy = theCCB->theEM->create_var_expr(*score_var_ptr); | 250 | scorevarCopy = theCCB->theEM->create_var_expr(udf, *score_var_ptr); |
4097 | 248 | subst[score_var_ptr] = scorevarCopy; | 251 | subst[score_var_ptr] = scorevarCopy; |
4098 | 249 | } | 252 | } |
4099 | 250 | 253 | ||
4100 | 251 | return theCCB->theEM->create_for_clause(theContext, | 254 | return theCCB->theEM->create_for_clause(theContext, |
4107 | 252 | get_loc(), | 255 | get_loc(), |
4108 | 253 | varCopy, | 256 | varCopy, |
4109 | 254 | domainCopy, | 257 | domainCopy, |
4110 | 255 | posvarCopy, | 258 | posvarCopy, |
4111 | 256 | scorevarCopy, | 259 | scorevarCopy, |
4112 | 257 | theAllowingEmpty); | 260 | theAllowingEmpty); |
4113 | 258 | } | 261 | } |
4114 | 259 | 262 | ||
4115 | 260 | 263 | ||
4116 | @@ -298,11 +301,13 @@ | |||
4117 | 298 | ERROR_PARAMS(ZED(BadType_23o), *domainType, ZED(NoTreatAs_4), *declaredType)); | 301 | ERROR_PARAMS(ZED(BadType_23o), *domainType, ZED(NoTreatAs_4), *declaredType)); |
4118 | 299 | } | 302 | } |
4119 | 300 | 303 | ||
4125 | 301 | domainExpr = theCCB->theEM->create_treat_expr(sctx, | 304 | domainExpr = theCCB->theEM-> |
4126 | 302 | loc, | 305 | create_treat_expr(sctx, |
4127 | 303 | domainExpr, | 306 | domainExpr->get_udf(), |
4128 | 304 | declaredType, | 307 | loc, |
4129 | 305 | TreatIterator::TYPE_MATCH); | 308 | domainExpr, |
4130 | 309 | declaredType, | ||
4131 | 310 | TreatIterator::TYPE_MATCH); | ||
4132 | 306 | 311 | ||
4133 | 307 | set_expr(domainExpr); | 312 | set_expr(domainExpr); |
4134 | 308 | } | 313 | } |
4135 | @@ -332,11 +337,11 @@ | |||
4136 | 332 | } | 337 | } |
4137 | 333 | 338 | ||
4138 | 334 | 339 | ||
4140 | 335 | flwor_clause* let_clause::clone(expr::substitution_t& subst) const | 340 | flwor_clause* let_clause::clone(user_function* udf, expr::substitution_t& subst) const |
4141 | 336 | { | 341 | { |
4143 | 337 | expr* domainCopy = theDomainExpr->clone(subst); | 342 | expr* domainCopy = theDomainExpr->clone(udf, subst); |
4144 | 338 | 343 | ||
4146 | 339 | var_expr* varCopy = theCCB->theEM->create_var_expr(*theVarExpr); | 344 | var_expr* varCopy = theCCB->theEM->create_var_expr(udf, *theVarExpr); |
4147 | 340 | subst[theVarExpr] = varCopy; | 345 | subst[theVarExpr] = varCopy; |
4148 | 341 | 346 | ||
4149 | 342 | #if 0 | 347 | #if 0 |
4150 | @@ -350,10 +355,10 @@ | |||
4151 | 350 | #endif | 355 | #endif |
4152 | 351 | 356 | ||
4153 | 352 | return theCCB->theEM->create_let_clause(theContext, | 357 | return theCCB->theEM->create_let_clause(theContext, |
4158 | 353 | get_loc(), | 358 | get_loc(), |
4159 | 354 | varCopy, | 359 | varCopy, |
4160 | 355 | domainCopy, | 360 | domainCopy, |
4161 | 356 | theLazyEval); | 361 | theLazyEval); |
4162 | 357 | } | 362 | } |
4163 | 358 | 363 | ||
4164 | 359 | 364 | ||
4165 | @@ -403,6 +408,7 @@ | |||
4166 | 403 | { | 408 | { |
4167 | 404 | domainExpr = theCCB->theEM-> | 409 | domainExpr = theCCB->theEM-> |
4168 | 405 | create_treat_expr(sctx, | 410 | create_treat_expr(sctx, |
4169 | 411 | domainExpr->get_udf(), | ||
4170 | 406 | loc, | 412 | loc, |
4171 | 407 | domainExpr, | 413 | domainExpr, |
4172 | 408 | varType, | 414 | varType, |
4173 | @@ -441,21 +447,23 @@ | |||
4174 | 441 | } | 447 | } |
4175 | 442 | 448 | ||
4176 | 443 | 449 | ||
4178 | 444 | flwor_clause* window_clause::clone(expr::substitution_t& subst) const | 450 | flwor_clause* window_clause::clone( |
4179 | 451 | user_function* udf, | ||
4180 | 452 | expr::substitution_t& subst) const | ||
4181 | 445 | { | 453 | { |
4183 | 446 | expr* domainCopy = theDomainExpr->clone(subst); | 454 | expr* domainCopy = theDomainExpr->clone(udf, subst); |
4184 | 447 | 455 | ||
4186 | 448 | var_expr* varCopy = theCCB->theEM->create_var_expr(*theVarExpr); | 456 | var_expr* varCopy = theCCB->theEM->create_var_expr(udf, *theVarExpr); |
4187 | 449 | subst[theVarExpr] = varCopy; | 457 | subst[theVarExpr] = varCopy; |
4188 | 450 | 458 | ||
4189 | 451 | flwor_wincond* cloneStartCond = NULL; | 459 | flwor_wincond* cloneStartCond = NULL; |
4190 | 452 | flwor_wincond* cloneStopCond = NULL; | 460 | flwor_wincond* cloneStopCond = NULL; |
4191 | 453 | 461 | ||
4192 | 454 | if (theWinStartCond != NULL) | 462 | if (theWinStartCond != NULL) |
4194 | 455 | cloneStartCond = theWinStartCond->clone(subst); | 463 | cloneStartCond = theWinStartCond->clone(udf, subst); |
4195 | 456 | 464 | ||
4196 | 457 | if (theWinStopCond != NULL) | 465 | if (theWinStopCond != NULL) |
4198 | 458 | cloneStopCond = theWinStopCond->clone(subst); | 466 | cloneStopCond = theWinStopCond->clone(udf, subst); |
4199 | 459 | 467 | ||
4200 | 460 | return theCCB->theEM->create_window_clause(theContext, | 468 | return theCCB->theEM->create_window_clause(theContext, |
4201 | 461 | get_loc(), | 469 | get_loc(), |
4202 | @@ -493,15 +501,17 @@ | |||
4203 | 493 | 501 | ||
4204 | 494 | xqtref_t condType = theCondExpr->get_return_type(); | 502 | xqtref_t condType = theCondExpr->get_return_type(); |
4205 | 495 | 503 | ||
4207 | 496 | if(!TypeOps::is_equal(tm, | 504 | if (!TypeOps::is_equal(tm, |
4208 | 497 | *condType, | 505 | *condType, |
4209 | 498 | *GENV_TYPESYSTEM.BOOLEAN_TYPE_ONE, | 506 | *GENV_TYPESYSTEM.BOOLEAN_TYPE_ONE, |
4210 | 499 | theCondExpr->get_loc())) | 507 | theCondExpr->get_loc())) |
4211 | 500 | { | 508 | { |
4216 | 501 | theCondExpr = theCCB->theEM->create_fo_expr(theCondExpr->get_sctx(), | 509 | theCondExpr = theCCB->theEM-> |
4217 | 502 | theCondExpr->get_loc(), | 510 | create_fo_expr(theCondExpr->get_sctx(), |
4218 | 503 | GET_BUILTIN_FUNCTION(FN_BOOLEAN_1), | 511 | theCondExpr->get_udf(), |
4219 | 504 | theCondExpr); | 512 | theCondExpr->get_loc(), |
4220 | 513 | GET_BUILTIN_FUNCTION(FN_BOOLEAN_1), | ||
4221 | 514 | theCondExpr); | ||
4222 | 505 | } | 515 | } |
4223 | 506 | } | 516 | } |
4224 | 507 | } | 517 | } |
4225 | @@ -514,14 +524,15 @@ | |||
4226 | 514 | 524 | ||
4227 | 515 | 525 | ||
4228 | 516 | flwor_wincond::vars::vars() | 526 | flwor_wincond::vars::vars() |
4234 | 517 | : | 527 | : |
4235 | 518 | posvar(NULL), | 528 | posvar(NULL), |
4236 | 519 | curr(NULL), | 529 | curr(NULL), |
4237 | 520 | prev(NULL), | 530 | prev(NULL), |
4238 | 521 | next(NULL) | 531 | next(NULL) |
4239 | 522 | { | 532 | { |
4240 | 523 | } | 533 | } |
4241 | 524 | 534 | ||
4242 | 535 | |||
4243 | 525 | flwor_wincond::vars::~vars() | 536 | flwor_wincond::vars::~vars() |
4244 | 526 | { | 537 | { |
4245 | 527 | // set_flwor_clause(NULL); | 538 | // set_flwor_clause(NULL); |
4246 | @@ -539,33 +550,34 @@ | |||
4247 | 539 | 550 | ||
4248 | 540 | void flwor_wincond::vars::clone( | 551 | void flwor_wincond::vars::clone( |
4249 | 541 | ExprManager* mgr, | 552 | ExprManager* mgr, |
4250 | 553 | user_function* udf, | ||
4251 | 542 | flwor_wincond::vars& cloneVars, | 554 | flwor_wincond::vars& cloneVars, |
4252 | 543 | expr::substitution_t& subst) const | 555 | expr::substitution_t& subst) const |
4253 | 544 | { | 556 | { |
4254 | 545 | if (posvar != NULL) | 557 | if (posvar != NULL) |
4255 | 546 | { | 558 | { |
4257 | 547 | var_expr* varCopy = mgr->create_var_expr(*posvar); | 559 | var_expr* varCopy = mgr->create_var_expr(udf, *posvar); |
4258 | 548 | subst[posvar] = varCopy; | 560 | subst[posvar] = varCopy; |
4259 | 549 | cloneVars.posvar = varCopy; | 561 | cloneVars.posvar = varCopy; |
4260 | 550 | } | 562 | } |
4261 | 551 | 563 | ||
4262 | 552 | if (curr != NULL) | 564 | if (curr != NULL) |
4263 | 553 | { | 565 | { |
4265 | 554 | var_expr* varCopy = mgr->create_var_expr(*curr); | 566 | var_expr* varCopy = mgr->create_var_expr(udf, *curr); |
4266 | 555 | subst[curr] = varCopy; | 567 | subst[curr] = varCopy; |
4267 | 556 | cloneVars.curr = varCopy; | 568 | cloneVars.curr = varCopy; |
4268 | 557 | } | 569 | } |
4269 | 558 | 570 | ||
4270 | 559 | if (prev != NULL) | 571 | if (prev != NULL) |
4271 | 560 | { | 572 | { |
4273 | 561 | var_expr* varCopy = mgr->create_var_expr(*prev); | 573 | var_expr* varCopy = mgr->create_var_expr(udf, *prev); |
4274 | 562 | subst[prev] = varCopy; | 574 | subst[prev] = varCopy; |
4275 | 563 | cloneVars.prev = varCopy; | 575 | cloneVars.prev = varCopy; |
4276 | 564 | } | 576 | } |
4277 | 565 | 577 | ||
4278 | 566 | if (next != NULL) | 578 | if (next != NULL) |
4279 | 567 | { | 579 | { |
4281 | 568 | var_expr* varCopy = mgr->create_var_expr(*next); | 580 | var_expr* varCopy = mgr->create_var_expr(udf, *next); |
4282 | 569 | subst[next] = varCopy; | 581 | subst[next] = varCopy; |
4283 | 570 | cloneVars.next = varCopy; | 582 | cloneVars.next = varCopy; |
4284 | 571 | } | 583 | } |
4285 | @@ -579,21 +591,23 @@ | |||
4286 | 579 | } | 591 | } |
4287 | 580 | 592 | ||
4288 | 581 | 593 | ||
4290 | 582 | flwor_wincond* flwor_wincond::clone(expr::substitution_t& subst) const | 594 | flwor_wincond* flwor_wincond::clone( |
4291 | 595 | user_function* udf, | ||
4292 | 596 | expr::substitution_t& subst) const | ||
4293 | 583 | { | 597 | { |
4294 | 584 | flwor_wincond::vars cloneInVars; | 598 | flwor_wincond::vars cloneInVars; |
4295 | 585 | flwor_wincond::vars cloneOutVars; | 599 | flwor_wincond::vars cloneOutVars; |
4296 | 586 | 600 | ||
4299 | 587 | theInputVars.clone(theCCB->theEM, cloneInVars, subst); | 601 | theInputVars.clone(theCCB->theEM, udf, cloneInVars, subst); |
4300 | 588 | theOutputVars.clone(theCCB->theEM, cloneOutVars, subst); | 602 | theOutputVars.clone(theCCB->theEM, udf, cloneOutVars, subst); |
4301 | 589 | 603 | ||
4303 | 590 | expr* cloneCondExpr = theCondExpr->clone(subst); | 604 | expr* cloneCondExpr = theCondExpr->clone(udf, subst); |
4304 | 591 | 605 | ||
4305 | 592 | return theCCB->theEM->create_flwor_wincond(NULL, | 606 | return theCCB->theEM->create_flwor_wincond(NULL, |
4310 | 593 | theIsOnly, | 607 | theIsOnly, |
4311 | 594 | cloneInVars, | 608 | cloneInVars, |
4312 | 595 | cloneOutVars, | 609 | cloneOutVars, |
4313 | 596 | cloneCondExpr); | 610 | cloneCondExpr); |
4314 | 597 | } | 611 | } |
4315 | 598 | 612 | ||
4316 | 599 | 613 | ||
4317 | @@ -663,7 +677,9 @@ | |||
4318 | 663 | } | 677 | } |
4319 | 664 | 678 | ||
4320 | 665 | 679 | ||
4322 | 666 | flwor_clause* group_clause::clone(expr::substitution_t& subst) const | 680 | flwor_clause* group_clause::clone( |
4323 | 681 | user_function* udf, | ||
4324 | 682 | expr::substitution_t& subst) const | ||
4325 | 667 | { | 683 | { |
4326 | 668 | csize numGroupVars = theGroupVars.size(); | 684 | csize numGroupVars = theGroupVars.size(); |
4327 | 669 | csize numNonGroupVars = theNonGroupVars.size(); | 685 | csize numNonGroupVars = theNonGroupVars.size(); |
4328 | @@ -680,23 +696,29 @@ | |||
4329 | 680 | 696 | ||
4330 | 681 | for (csize i = 0; i < numGroupVars; ++i) | 697 | for (csize i = 0; i < numGroupVars; ++i) |
4331 | 682 | { | 698 | { |
4334 | 683 | cloneGroupVars[i].first = theGroupVars[i].first->clone(subst); | 699 | cloneGroupVars[i].first = theGroupVars[i].first->clone(udf, subst); |
4335 | 684 | cloneGroupVars[i].second = exprMgr->create_var_expr(*theGroupVars[i].second); | 700 | |
4336 | 701 | cloneGroupVars[i].second = exprMgr-> | ||
4337 | 702 | create_var_expr(udf, *theGroupVars[i].second); | ||
4338 | 703 | |||
4339 | 685 | subst[theGroupVars[i].second] = cloneGroupVars[i].second; | 704 | subst[theGroupVars[i].second] = cloneGroupVars[i].second; |
4340 | 686 | } | 705 | } |
4341 | 687 | 706 | ||
4342 | 688 | for (csize i = 0; i < numNonGroupVars; ++i) | 707 | for (csize i = 0; i < numNonGroupVars; ++i) |
4343 | 689 | { | 708 | { |
4346 | 690 | cloneNonGroupVars[i].first = theNonGroupVars[i].first->clone(subst); | 709 | cloneNonGroupVars[i].first = theNonGroupVars[i].first->clone(udf, subst); |
4347 | 691 | cloneNonGroupVars[i].second = exprMgr->create_var_expr(*theNonGroupVars[i].second); | 710 | |
4348 | 711 | cloneNonGroupVars[i].second = exprMgr-> | ||
4349 | 712 | create_var_expr(udf, *theNonGroupVars[i].second); | ||
4350 | 713 | |||
4351 | 692 | subst[theNonGroupVars[i].second] = cloneNonGroupVars[i].second; | 714 | subst[theNonGroupVars[i].second] = cloneNonGroupVars[i].second; |
4352 | 693 | } | 715 | } |
4353 | 694 | 716 | ||
4354 | 695 | return theCCB->theEM->create_group_clause(theContext, | 717 | return theCCB->theEM->create_group_clause(theContext, |
4359 | 696 | get_loc(), | 718 | get_loc(), |
4360 | 697 | cloneGroupVars, | 719 | cloneGroupVars, |
4361 | 698 | cloneNonGroupVars, | 720 | cloneNonGroupVars, |
4362 | 699 | theCollations); | 721 | theCollations); |
4363 | 700 | } | 722 | } |
4364 | 701 | 723 | ||
4365 | 702 | 724 | ||
4366 | @@ -726,7 +748,9 @@ | |||
4367 | 726 | } | 748 | } |
4368 | 727 | 749 | ||
4369 | 728 | 750 | ||
4371 | 729 | flwor_clause* orderby_clause::clone(expr::substitution_t& subst) const | 751 | flwor_clause* orderby_clause::clone( |
4372 | 752 | user_function* udf, | ||
4373 | 753 | expr::substitution_t& subst) const | ||
4374 | 730 | { | 754 | { |
4375 | 731 | csize numColumns = num_columns(); | 755 | csize numColumns = num_columns(); |
4376 | 732 | 756 | ||
4377 | @@ -734,14 +758,14 @@ | |||
4378 | 734 | 758 | ||
4379 | 735 | for (csize i = 0; i < numColumns; ++i) | 759 | for (csize i = 0; i < numColumns; ++i) |
4380 | 736 | { | 760 | { |
4382 | 737 | cloneExprs[i] = theOrderingExprs[i]->clone(subst); | 761 | cloneExprs[i] = theOrderingExprs[i]->clone(udf, subst); |
4383 | 738 | } | 762 | } |
4384 | 739 | 763 | ||
4385 | 740 | return theCCB->theEM->create_orderby_clause(theContext, | 764 | return theCCB->theEM->create_orderby_clause(theContext, |
4390 | 741 | get_loc(), | 765 | get_loc(), |
4391 | 742 | theStableOrder, | 766 | theStableOrder, |
4392 | 743 | theModifiers, | 767 | theModifiers, |
4393 | 744 | cloneExprs); | 768 | cloneExprs); |
4394 | 745 | } | 769 | } |
4395 | 746 | 770 | ||
4396 | 747 | 771 | ||
4397 | @@ -758,7 +782,9 @@ | |||
4398 | 758 | } | 782 | } |
4399 | 759 | 783 | ||
4400 | 760 | 784 | ||
4402 | 761 | flwor_clause* materialize_clause::clone(expr::substitution_t& subst) const | 785 | flwor_clause* materialize_clause::clone( |
4403 | 786 | user_function* udf, | ||
4404 | 787 | expr::substitution_t& subst) const | ||
4405 | 762 | { | 788 | { |
4406 | 763 | // we will reach here under the following scenario: | 789 | // we will reach here under the following scenario: |
4407 | 764 | // 1. We do plan seriazation | 790 | // 1. We do plan seriazation |
4408 | @@ -792,11 +818,13 @@ | |||
4409 | 792 | } | 818 | } |
4410 | 793 | 819 | ||
4411 | 794 | 820 | ||
4413 | 795 | flwor_clause* count_clause::clone(expr::substitution_t& subst) const | 821 | flwor_clause* count_clause::clone( |
4414 | 822 | user_function* udf, | ||
4415 | 823 | expr::substitution_t& subst) const | ||
4416 | 796 | { | 824 | { |
4417 | 797 | ExprManager* exprMgr = theVarExpr->get_ccb()->theEM; | 825 | ExprManager* exprMgr = theVarExpr->get_ccb()->theEM; |
4418 | 798 | 826 | ||
4420 | 799 | var_expr* cloneVar = exprMgr->create_var_expr(*theVarExpr); | 827 | var_expr* cloneVar = exprMgr->create_var_expr(udf, *theVarExpr); |
4421 | 800 | subst[theVarExpr] = cloneVar; | 828 | subst[theVarExpr] = cloneVar; |
4422 | 801 | 829 | ||
4423 | 802 | return theCCB->theEM->create_count_clause(theContext, get_loc(), cloneVar); | 830 | return theCCB->theEM->create_count_clause(theContext, get_loc(), cloneVar); |
4424 | @@ -825,9 +853,11 @@ | |||
4425 | 825 | } | 853 | } |
4426 | 826 | 854 | ||
4427 | 827 | 855 | ||
4429 | 828 | flwor_clause* where_clause::clone(expr::substitution_t& subst) const | 856 | flwor_clause* where_clause::clone( |
4430 | 857 | user_function* udf, | ||
4431 | 858 | expr::substitution_t& subst) const | ||
4432 | 829 | { | 859 | { |
4434 | 830 | expr* cloneExpr = theWhereExpr->clone(subst); | 860 | expr* cloneExpr = theWhereExpr->clone(udf, subst); |
4435 | 831 | 861 | ||
4436 | 832 | return theCCB->theEM->create_where_clause(theContext, get_loc(), cloneExpr); | 862 | return theCCB->theEM->create_where_clause(theContext, get_loc(), cloneExpr); |
4437 | 833 | } | 863 | } |
4438 | @@ -839,10 +869,11 @@ | |||
4439 | 839 | flwor_expr::flwor_expr( | 869 | flwor_expr::flwor_expr( |
4440 | 840 | CompilerCB* ccb, | 870 | CompilerCB* ccb, |
4441 | 841 | static_context* sctx, | 871 | static_context* sctx, |
4442 | 872 | user_function* udf, | ||
4443 | 842 | const QueryLoc& loc, | 873 | const QueryLoc& loc, |
4444 | 843 | bool general) | 874 | bool general) |
4445 | 844 | : | 875 | : |
4447 | 845 | expr(ccb, sctx, loc, (general ? gflwor_expr_kind : flwor_expr_kind)), | 876 | expr(ccb, sctx, udf, loc, (general ? gflwor_expr_kind : flwor_expr_kind)), |
4448 | 846 | theIsGeneral(general), | 877 | theIsGeneral(general), |
4449 | 847 | theHasSequentialClauses(false), | 878 | theHasSequentialClauses(false), |
4450 | 848 | theReturnExpr(NULL) | 879 | theReturnExpr(NULL) |
4451 | @@ -1167,27 +1198,5 @@ | |||
4452 | 1167 | } | 1198 | } |
4453 | 1168 | 1199 | ||
4454 | 1169 | 1200 | ||
4455 | 1170 | /******************************************************************************* | ||
4456 | 1171 | |||
4457 | 1172 | ********************************************************************************/ | ||
4458 | 1173 | expr* flwor_expr::cloneImpl(substitution_t& subst) const | ||
4459 | 1174 | { | ||
4460 | 1175 | ulong numClauses = num_clauses(); | ||
4461 | 1176 | |||
4462 | 1177 | flwor_expr* cloneFlwor = theCCB->theEM->create_flwor_expr(theSctx, get_loc(), theIsGeneral); | ||
4463 | 1178 | |||
4464 | 1179 | for (ulong i = 0; i < numClauses; ++i) | ||
4465 | 1180 | { | ||
4466 | 1181 | flwor_clause* cloneClause = theClauses[i]->clone(subst); | ||
4467 | 1182 | |||
4468 | 1183 | cloneFlwor->add_clause(cloneClause, false); | ||
4469 | 1184 | } | ||
4470 | 1185 | |||
4471 | 1186 | cloneFlwor->set_return_expr(theReturnExpr->clone(subst)); | ||
4472 | 1187 | |||
4473 | 1188 | return cloneFlwor; | ||
4474 | 1189 | } | ||
4475 | 1190 | |||
4476 | 1191 | |||
4477 | 1192 | } // namespace zorba | 1201 | } // namespace zorba |
4478 | 1193 | /* vim:set et sw=2 ts=2: */ | 1202 | /* vim:set et sw=2 ts=2: */ |
4479 | 1194 | 1203 | ||
4480 | === modified file 'src/compiler/expression/flwor_expr.h' | |||
4481 | --- src/compiler/expression/flwor_expr.h 2012-10-08 12:09:36 +0000 | |||
4482 | +++ src/compiler/expression/flwor_expr.h 2012-10-09 13:35:26 +0000 | |||
4483 | @@ -105,7 +105,9 @@ | |||
4484 | 105 | 105 | ||
4485 | 106 | virtual var_expr* get_score_var() const { return NULL; } | 106 | virtual var_expr* get_score_var() const { return NULL; } |
4486 | 107 | 107 | ||
4488 | 108 | virtual flwor_clause* clone(expr::substitution_t& substitution) const = 0; | 108 | virtual flwor_clause* clone( |
4489 | 109 | user_function* udf, | ||
4490 | 110 | expr::substitution_t& substitution) const = 0; | ||
4491 | 109 | }; | 111 | }; |
4492 | 110 | 112 | ||
4493 | 111 | 113 | ||
4494 | @@ -207,7 +209,7 @@ | |||
4495 | 207 | 209 | ||
4496 | 208 | void set_score_var(var_expr* v); | 210 | void set_score_var(var_expr* v); |
4497 | 209 | 211 | ||
4499 | 210 | flwor_clause* clone(expr::substitution_t& substitution) const; | 212 | flwor_clause* clone(user_function* udf, expr::substitution_t& substitution) const; |
4500 | 211 | 213 | ||
4501 | 212 | std::ostream& put(std::ostream&) const; | 214 | std::ostream& put(std::ostream&) const; |
4502 | 213 | }; | 215 | }; |
4503 | @@ -247,7 +249,7 @@ | |||
4504 | 247 | 249 | ||
4505 | 248 | bool lazyEval() const { return theLazyEval; } | 250 | bool lazyEval() const { return theLazyEval; } |
4506 | 249 | 251 | ||
4508 | 250 | flwor_clause* clone(expr::substitution_t& substitution) const; | 252 | flwor_clause* clone(user_function* udf, expr::substitution_t& substitution) const; |
4509 | 251 | 253 | ||
4510 | 252 | std::ostream& put(std::ostream&) const; | 254 | std::ostream& put(std::ostream&) const; |
4511 | 253 | }; | 255 | }; |
4512 | @@ -303,7 +305,7 @@ | |||
4513 | 303 | 305 | ||
4514 | 304 | bool lazyEval() const { return theLazyEval; } | 306 | bool lazyEval() const { return theLazyEval; } |
4515 | 305 | 307 | ||
4517 | 306 | flwor_clause* clone(expr::substitution_t& substitution) const; | 308 | flwor_clause* clone(user_function* udf, expr::substitution_t& substitution) const; |
4518 | 307 | 309 | ||
4519 | 308 | std::ostream& put(std::ostream&) const; | 310 | std::ostream& put(std::ostream&) const; |
4520 | 309 | }; | 311 | }; |
4521 | @@ -354,10 +356,16 @@ | |||
4522 | 354 | var_expr* next; | 356 | var_expr* next; |
4523 | 355 | 357 | ||
4524 | 356 | vars(); | 358 | vars(); |
4525 | 359 | |||
4526 | 357 | ~vars(); | 360 | ~vars(); |
4527 | 361 | |||
4528 | 358 | void set_flwor_clause(flwor_clause* c); | 362 | void set_flwor_clause(flwor_clause* c); |
4529 | 359 | 363 | ||
4531 | 360 | void clone(ExprManager* mgr, vars& cloneVars, expr::substitution_t& subst) const; | 364 | void clone( |
4532 | 365 | ExprManager* mgr, | ||
4533 | 366 | user_function* udf, | ||
4534 | 367 | vars& cloneVars, | ||
4535 | 368 | expr::substitution_t& subst) const; | ||
4536 | 361 | 369 | ||
4537 | 362 | std::ostream& put(std::ostream&) const; | 370 | std::ostream& put(std::ostream&) const; |
4538 | 363 | }; | 371 | }; |
4539 | @@ -394,7 +402,7 @@ | |||
4540 | 394 | 402 | ||
4541 | 395 | void set_flwor_clause(flwor_clause *); | 403 | void set_flwor_clause(flwor_clause *); |
4542 | 396 | 404 | ||
4544 | 397 | flwor_wincond* clone(expr::substitution_t& substitution) const; | 405 | flwor_wincond* clone(user_function* udf, expr::substitution_t& substitution) const; |
4545 | 398 | 406 | ||
4546 | 399 | std::ostream& put(std::ostream&) const; | 407 | std::ostream& put(std::ostream&) const; |
4547 | 400 | }; | 408 | }; |
4548 | @@ -484,7 +492,7 @@ | |||
4549 | 484 | 492 | ||
4550 | 485 | expr* get_input_for_nongroup_var(const var_expr* var); | 493 | expr* get_input_for_nongroup_var(const var_expr* var); |
4551 | 486 | 494 | ||
4553 | 487 | flwor_clause* clone(expr::substitution_t& substitution) const; | 495 | flwor_clause* clone(user_function* udf, expr::substitution_t& substitution) const; |
4554 | 488 | 496 | ||
4555 | 489 | std::ostream& put(std::ostream&) const; | 497 | std::ostream& put(std::ostream&) const; |
4556 | 490 | }; | 498 | }; |
4557 | @@ -552,7 +560,7 @@ | |||
4558 | 552 | 560 | ||
4559 | 553 | void set_column_expr(csize i, expr* e) { theOrderingExprs[i] = e; } | 561 | void set_column_expr(csize i, expr* e) { theOrderingExprs[i] = e; } |
4560 | 554 | 562 | ||
4562 | 555 | flwor_clause* clone(expr::substitution_t& substitution) const; | 563 | flwor_clause* clone(user_function* udf, expr::substitution_t& substitution) const; |
4563 | 556 | 564 | ||
4564 | 557 | std::ostream& put(std::ostream&) const; | 565 | std::ostream& put(std::ostream&) const; |
4565 | 558 | }; | 566 | }; |
4566 | @@ -572,7 +580,7 @@ | |||
4567 | 572 | materialize_clause(static_context* sctx, CompilerCB* ccb, const QueryLoc& loc); | 580 | materialize_clause(static_context* sctx, CompilerCB* ccb, const QueryLoc& loc); |
4568 | 573 | 581 | ||
4569 | 574 | public: | 582 | public: |
4571 | 575 | flwor_clause* clone(expr::substitution_t& substitution) const; | 583 | flwor_clause* clone(user_function* udf, expr::substitution_t& substitution) const; |
4572 | 576 | 584 | ||
4573 | 577 | std::ostream& put(std::ostream&) const; | 585 | std::ostream& put(std::ostream&) const; |
4574 | 578 | }; | 586 | }; |
4575 | @@ -597,7 +605,7 @@ | |||
4576 | 597 | 605 | ||
4577 | 598 | var_expr* get_var() const { return theVarExpr; } | 606 | var_expr* get_var() const { return theVarExpr; } |
4578 | 599 | 607 | ||
4580 | 600 | flwor_clause* clone(expr::substitution_t& substitution) const; | 608 | flwor_clause* clone(user_function* udf, expr::substitution_t& substitution) const; |
4581 | 601 | }; | 609 | }; |
4582 | 602 | 610 | ||
4583 | 603 | 611 | ||
4584 | @@ -619,7 +627,7 @@ | |||
4585 | 619 | 627 | ||
4586 | 620 | void set_expr(expr* where); | 628 | void set_expr(expr* where); |
4587 | 621 | 629 | ||
4589 | 622 | flwor_clause* clone(expr::substitution_t& substitution) const; | 630 | flwor_clause* clone(user_function* udf, expr::substitution_t& substitution) const; |
4590 | 623 | }; | 631 | }; |
4591 | 624 | 632 | ||
4592 | 625 | 633 | ||
4593 | @@ -665,7 +673,12 @@ | |||
4594 | 665 | expr * theReturnExpr; | 673 | expr * theReturnExpr; |
4595 | 666 | 674 | ||
4596 | 667 | protected: | 675 | protected: |
4598 | 668 | flwor_expr(CompilerCB* ccb, static_context* sctx, const QueryLoc& loc, bool general); | 676 | flwor_expr( |
4599 | 677 | CompilerCB* ccb, | ||
4600 | 678 | static_context* sctx, | ||
4601 | 679 | user_function* udf, | ||
4602 | 680 | const QueryLoc& loc, | ||
4603 | 681 | bool general); | ||
4604 | 669 | 682 | ||
4605 | 670 | public: | 683 | public: |
4606 | 671 | bool is_general() const { return theIsGeneral; } | 684 | bool is_general() const { return theIsGeneral; } |
4607 | @@ -704,8 +717,6 @@ | |||
4608 | 704 | 717 | ||
4609 | 705 | void get_vars_defined(std::vector<var_expr*>& varExprs) const; | 718 | void get_vars_defined(std::vector<var_expr*>& varExprs) const; |
4610 | 706 | 719 | ||
4611 | 707 | expr* cloneImpl(substitution_t& substitution) const; | ||
4612 | 708 | |||
4613 | 709 | // The following 5 methods are for the simple flwor only. They should be | 720 | // The following 5 methods are for the simple flwor only. They should be |
4614 | 710 | // removed eventually. | 721 | // removed eventually. |
4615 | 711 | expr* get_where() const; | 722 | expr* get_where() const; |
4616 | 712 | 723 | ||
4617 | === modified file 'src/compiler/expression/fo_expr.cpp' | |||
4618 | --- src/compiler/expression/fo_expr.cpp 2012-10-08 12:09:36 +0000 | |||
4619 | +++ src/compiler/expression/fo_expr.cpp 2012-10-09 13:35:26 +0000 | |||
4620 | @@ -55,11 +55,15 @@ | |||
4621 | 55 | UnionExpr, and IntersectExceptExpr. | 55 | UnionExpr, and IntersectExceptExpr. |
4622 | 56 | ********************************************************************************/ | 56 | ********************************************************************************/ |
4623 | 57 | 57 | ||
4625 | 58 | fo_expr* fo_expr::create_seq(CompilerCB* ccb, static_context* sctx, const QueryLoc& loc) | 58 | fo_expr* fo_expr::create_seq( |
4626 | 59 | CompilerCB* ccb, | ||
4627 | 60 | static_context* sctx, | ||
4628 | 61 | user_function* udf, | ||
4629 | 62 | const QueryLoc& loc) | ||
4630 | 59 | { | 63 | { |
4631 | 60 | function* f = BuiltinFunctionLibrary::getFunction(FunctionConsts::OP_CONCATENATE_N); | 64 | function* f = BuiltinFunctionLibrary::getFunction(FunctionConsts::OP_CONCATENATE_N); |
4632 | 61 | 65 | ||
4634 | 62 | std::auto_ptr<fo_expr> fo(ccb->theEM->create_fo_expr(sctx, loc, f)); | 66 | std::auto_ptr<fo_expr> fo(ccb->theEM->create_fo_expr(sctx, udf, loc, f)); |
4635 | 63 | 67 | ||
4636 | 64 | return fo.release(); | 68 | return fo.release(); |
4637 | 65 | } | 69 | } |
4638 | @@ -68,10 +72,11 @@ | |||
4639 | 68 | fo_expr::fo_expr( | 72 | fo_expr::fo_expr( |
4640 | 69 | CompilerCB* ccb, | 73 | CompilerCB* ccb, |
4641 | 70 | static_context* sctx, | 74 | static_context* sctx, |
4642 | 75 | user_function* udf, | ||
4643 | 71 | const QueryLoc& loc, | 76 | const QueryLoc& loc, |
4644 | 72 | const function* f) | 77 | const function* f) |
4645 | 73 | : | 78 | : |
4647 | 74 | expr(ccb, sctx, loc, fo_expr_kind), | 79 | expr(ccb, sctx, udf, loc, fo_expr_kind), |
4648 | 75 | theFunction(const_cast<function*>(f)) | 80 | theFunction(const_cast<function*>(f)) |
4649 | 76 | { | 81 | { |
4650 | 77 | // This method is private and it is to be used only by the clone method | 82 | // This method is private and it is to be used only by the clone method |
4651 | @@ -83,11 +88,12 @@ | |||
4652 | 83 | fo_expr::fo_expr( | 88 | fo_expr::fo_expr( |
4653 | 84 | CompilerCB* ccb, | 89 | CompilerCB* ccb, |
4654 | 85 | static_context* sctx, | 90 | static_context* sctx, |
4655 | 91 | user_function* udf, | ||
4656 | 86 | const QueryLoc& loc, | 92 | const QueryLoc& loc, |
4657 | 87 | const function* f, | 93 | const function* f, |
4658 | 88 | expr* arg) | 94 | expr* arg) |
4659 | 89 | : | 95 | : |
4661 | 90 | expr(ccb, sctx, loc, fo_expr_kind), | 96 | expr(ccb, sctx, udf, loc, fo_expr_kind), |
4662 | 91 | theFunction(const_cast<function*>(f)) | 97 | theFunction(const_cast<function*>(f)) |
4663 | 92 | { | 98 | { |
4664 | 93 | assert(f != NULL); | 99 | assert(f != NULL); |
4665 | @@ -101,12 +107,13 @@ | |||
4666 | 101 | fo_expr::fo_expr( | 107 | fo_expr::fo_expr( |
4667 | 102 | CompilerCB* ccb, | 108 | CompilerCB* ccb, |
4668 | 103 | static_context* sctx, | 109 | static_context* sctx, |
4669 | 110 | user_function* udf, | ||
4670 | 104 | const QueryLoc& loc, | 111 | const QueryLoc& loc, |
4671 | 105 | const function* f, | 112 | const function* f, |
4672 | 106 | expr* arg1, | 113 | expr* arg1, |
4673 | 107 | expr* arg2) | 114 | expr* arg2) |
4674 | 108 | : | 115 | : |
4676 | 109 | expr(ccb, sctx, loc, fo_expr_kind), | 116 | expr(ccb, sctx, udf, loc, fo_expr_kind), |
4677 | 110 | theFunction(const_cast<function*>(f)) | 117 | theFunction(const_cast<function*>(f)) |
4678 | 111 | { | 118 | { |
4679 | 112 | assert(f != NULL); | 119 | assert(f != NULL); |
4680 | @@ -121,11 +128,12 @@ | |||
4681 | 121 | fo_expr::fo_expr( | 128 | fo_expr::fo_expr( |
4682 | 122 | CompilerCB* ccb, | 129 | CompilerCB* ccb, |
4683 | 123 | static_context* sctx, | 130 | static_context* sctx, |
4684 | 131 | user_function* udf, | ||
4685 | 124 | const QueryLoc& loc, | 132 | const QueryLoc& loc, |
4686 | 125 | const function* f, | 133 | const function* f, |
4687 | 126 | const std::vector<expr*>& args) | 134 | const std::vector<expr*>& args) |
4688 | 127 | : | 135 | : |
4690 | 128 | expr(ccb, sctx, loc, fo_expr_kind), | 136 | expr(ccb, sctx, udf, loc, fo_expr_kind), |
4691 | 129 | theArgs(args), | 137 | theArgs(args), |
4692 | 130 | theFunction(const_cast<function*>(f)) | 138 | theFunction(const_cast<function*>(f)) |
4693 | 131 | { | 139 | { |
4694 | @@ -273,29 +281,6 @@ | |||
4695 | 273 | } | 281 | } |
4696 | 274 | 282 | ||
4697 | 275 | 283 | ||
4698 | 276 | expr* fo_expr::cloneImpl(substitution_t& subst) const | ||
4699 | 277 | { | ||
4700 | 278 | if (get_func()->getKind() == FunctionConsts::STATIC_COLLECTIONS_DML_COLLECTION_1) | ||
4701 | 279 | { | ||
4702 | 280 | expr::subst_iter_t i = subst.find(this); | ||
4703 | 281 | |||
4704 | 282 | if (i != subst.end()) | ||
4705 | 283 | return i->second; | ||
4706 | 284 | } | ||
4707 | 285 | |||
4708 | 286 | std::auto_ptr<fo_expr> fo(theCCB->theEM->create_fo_expr(theSctx, | ||
4709 | 287 | get_loc(), | ||
4710 | 288 | get_func())); | ||
4711 | 289 | |||
4712 | 290 | for (csize i = 0; i < theArgs.size(); ++i) | ||
4713 | 291 | fo->theArgs.push_back(theArgs[i]->clone(subst)); | ||
4714 | 292 | |||
4715 | 293 | fo->theScriptingKind = theScriptingKind; | ||
4716 | 294 | |||
4717 | 295 | return fo.release(); | ||
4718 | 296 | } | ||
4719 | 297 | |||
4720 | 298 | |||
4721 | 299 | } | 284 | } |
4722 | 300 | 285 | ||
4723 | 301 | /* vim:set et sw=2 ts=2: */ | 286 | /* vim:set et sw=2 ts=2: */ |
4724 | 302 | 287 | ||
4725 | === modified file 'src/compiler/expression/fo_expr.h' | |||
4726 | --- src/compiler/expression/fo_expr.h 2012-10-08 12:09:36 +0000 | |||
4727 | +++ src/compiler/expression/fo_expr.h 2012-10-09 13:35:26 +0000 | |||
4728 | @@ -45,12 +45,24 @@ | |||
4729 | 45 | public: | 45 | public: |
4730 | 46 | 46 | ||
4731 | 47 | protected: | 47 | protected: |
4733 | 48 | static fo_expr* create_seq(CompilerCB* ccb, static_context* sctx, const QueryLoc&); | 48 | static fo_expr* create_seq( |
4734 | 49 | CompilerCB* ccb, | ||
4735 | 50 | static_context* sctx, | ||
4736 | 51 | user_function* udf, | ||
4737 | 52 | const QueryLoc&); | ||
4738 | 49 | 53 | ||
4739 | 50 | protected: | 54 | protected: |
4740 | 51 | fo_expr( | 55 | fo_expr( |
4741 | 52 | CompilerCB* ccb, | 56 | CompilerCB* ccb, |
4742 | 53 | static_context* sctx, | 57 | static_context* sctx, |
4743 | 58 | user_function* udf, | ||
4744 | 59 | const QueryLoc& loc, | ||
4745 | 60 | const function* f); | ||
4746 | 61 | |||
4747 | 62 | fo_expr( | ||
4748 | 63 | CompilerCB* ccb, | ||
4749 | 64 | static_context* sctx, | ||
4750 | 65 | user_function* udf, | ||
4751 | 54 | const QueryLoc& loc, | 66 | const QueryLoc& loc, |
4752 | 55 | const function* f, | 67 | const function* f, |
4753 | 56 | expr* arg); | 68 | expr* arg); |
4754 | @@ -58,6 +70,7 @@ | |||
4755 | 58 | fo_expr( | 70 | fo_expr( |
4756 | 59 | CompilerCB* ccb, | 71 | CompilerCB* ccb, |
4757 | 60 | static_context* sctx, | 72 | static_context* sctx, |
4758 | 73 | user_function* udf, | ||
4759 | 61 | const QueryLoc& loc, | 74 | const QueryLoc& loc, |
4760 | 62 | const function* f, | 75 | const function* f, |
4761 | 63 | expr* arg1, | 76 | expr* arg1, |
4762 | @@ -66,6 +79,7 @@ | |||
4763 | 66 | fo_expr( | 79 | fo_expr( |
4764 | 67 | CompilerCB* ccb, | 80 | CompilerCB* ccb, |
4765 | 68 | static_context* sctx, | 81 | static_context* sctx, |
4766 | 82 | user_function* udf, | ||
4767 | 69 | const QueryLoc& loc, | 83 | const QueryLoc& loc, |
4768 | 70 | const function* f, | 84 | const function* f, |
4769 | 71 | const std::vector<expr*>& args); | 85 | const std::vector<expr*>& args); |
4770 | @@ -95,8 +109,6 @@ | |||
4771 | 95 | 109 | ||
4772 | 96 | void compute_scripting_kind(); | 110 | void compute_scripting_kind(); |
4773 | 97 | 111 | ||
4774 | 98 | expr* cloneImpl(substitution_t& s) const; | ||
4775 | 99 | |||
4776 | 100 | void accept(expr_visitor&); | 112 | void accept(expr_visitor&); |
4777 | 101 | 113 | ||
4778 | 102 | std::ostream& put(std::ostream&) const; | 114 | std::ostream& put(std::ostream&) const; |
4779 | 103 | 115 | ||
4780 | === modified file 'src/compiler/expression/ft_expr.cpp' | |||
4781 | --- src/compiler/expression/ft_expr.cpp 2012-10-08 12:09:36 +0000 | |||
4782 | +++ src/compiler/expression/ft_expr.cpp 2012-10-09 13:35:26 +0000 | |||
4783 | @@ -35,12 +35,13 @@ | |||
4784 | 35 | ftcontains_expr::ftcontains_expr( | 35 | ftcontains_expr::ftcontains_expr( |
4785 | 36 | CompilerCB* ccb, | 36 | CompilerCB* ccb, |
4786 | 37 | static_context* sctx, | 37 | static_context* sctx, |
4787 | 38 | user_function* udf, | ||
4788 | 38 | QueryLoc const &loc, | 39 | QueryLoc const &loc, |
4789 | 39 | expr* range, | 40 | expr* range, |
4790 | 40 | ftnode *ftselection, | 41 | ftnode *ftselection, |
4791 | 41 | expr* ftignore | 42 | expr* ftignore |
4792 | 42 | ) : | 43 | ) : |
4794 | 43 | expr(ccb, sctx, loc, ft_expr_kind ), | 44 | expr(ccb, sctx, udf, loc, ft_expr_kind ), |
4795 | 44 | range_( range ), | 45 | range_( range ), |
4796 | 45 | ftselection_( ftselection ), | 46 | ftselection_( ftselection ), |
4797 | 46 | ftignore_( ftignore ) | 47 | ftignore_( ftignore ) |
4798 | @@ -50,6 +51,7 @@ | |||
4799 | 50 | compute_scripting_kind(); | 51 | compute_scripting_kind(); |
4800 | 51 | } | 52 | } |
4801 | 52 | 53 | ||
4802 | 54 | |||
4803 | 53 | void ftcontains_expr::accept( expr_visitor &v ) { | 55 | void ftcontains_expr::accept( expr_visitor &v ) { |
4804 | 54 | if ( v.begin_visit( *this ) ) { | 56 | if ( v.begin_visit( *this ) ) { |
4805 | 55 | EV_ACCEPT( range_, v ); | 57 | EV_ACCEPT( range_, v ); |
4806 | @@ -59,16 +61,9 @@ | |||
4807 | 59 | v.end_visit( *this ); | 61 | v.end_visit( *this ); |
4808 | 60 | } | 62 | } |
4809 | 61 | 63 | ||
4810 | 62 | expr* ftcontains_expr::cloneImpl( substitution_t &s ) const { | ||
4811 | 63 | return theCCB->theEM->create_ftcontains_expr( | ||
4812 | 64 | theSctx, get_loc(), | ||
4813 | 65 | range_->clone( s ), | ||
4814 | 66 | ftselection_->clone( s ).release(), | ||
4815 | 67 | ftignore_ == NULL ? 0 : ftignore_->clone( s ) | ||
4816 | 68 | ); | ||
4817 | 69 | } | ||
4818 | 70 | 64 | ||
4820 | 71 | void ftcontains_expr::compute_scripting_kind() { | 65 | void ftcontains_expr::compute_scripting_kind() |
4821 | 66 | { | ||
4822 | 72 | checkSimpleExpr(range_); | 67 | checkSimpleExpr(range_); |
4823 | 73 | 68 | ||
4824 | 74 | theScriptingKind = SIMPLE_EXPR; | 69 | theScriptingKind = SIMPLE_EXPR; |
4825 | 75 | 70 | ||
4826 | === modified file 'src/compiler/expression/ft_expr.h' | |||
4827 | --- src/compiler/expression/ft_expr.h 2012-10-08 12:09:36 +0000 | |||
4828 | +++ src/compiler/expression/ft_expr.h 2012-10-09 13:35:26 +0000 | |||
4829 | @@ -29,6 +29,7 @@ | |||
4830 | 29 | */ | 29 | */ |
4831 | 30 | class ftcontains_expr : public expr | 30 | class ftcontains_expr : public expr |
4832 | 31 | { | 31 | { |
4833 | 32 | friend class expr; | ||
4834 | 32 | friend class ExprIterator; | 33 | friend class ExprIterator; |
4835 | 33 | friend class ExprManager; | 34 | friend class ExprManager; |
4836 | 34 | 35 | ||
4837 | @@ -36,6 +37,7 @@ | |||
4838 | 36 | ftcontains_expr( | 37 | ftcontains_expr( |
4839 | 37 | CompilerCB* ccb, | 38 | CompilerCB* ccb, |
4840 | 38 | static_context*, | 39 | static_context*, |
4841 | 40 | user_function*, | ||
4842 | 39 | QueryLoc const&, | 41 | QueryLoc const&, |
4843 | 40 | expr* range, | 42 | expr* range, |
4844 | 41 | ftnode *ftselection, | 43 | ftnode *ftselection, |
4845 | @@ -43,8 +45,6 @@ | |||
4846 | 43 | ); | 45 | ); |
4847 | 44 | 46 | ||
4848 | 45 | public: | 47 | public: |
4849 | 46 | expr* cloneImpl( substitution_t& ) const; | ||
4850 | 47 | |||
4851 | 48 | void compute_scripting_kind(); | 48 | void compute_scripting_kind(); |
4852 | 49 | 49 | ||
4853 | 50 | expr* get_range() const { return range_; } | 50 | expr* get_range() const { return range_; } |
4854 | 51 | 51 | ||
4855 | === modified file 'src/compiler/expression/ftnode.cpp' | |||
4856 | --- src/compiler/expression/ftnode.cpp 2012-09-19 21:16:15 +0000 | |||
4857 | +++ src/compiler/expression/ftnode.cpp 2012-10-09 13:35:26 +0000 | |||
4858 | @@ -171,37 +171,60 @@ | |||
4859 | 171 | /////////////////////////////////////////////////////////////////////////////// | 171 | /////////////////////////////////////////////////////////////////////////////// |
4860 | 172 | 172 | ||
4861 | 173 | template<typename PointerType> | 173 | template<typename PointerType> |
4864 | 174 | inline PointerType clone_ptr( PointerType p, expr::substitution_t &s ) { | 174 | inline PointerType clone_ptr( |
4865 | 175 | return static_cast<PointerType>( p->clone( s ).release() ); | 175 | PointerType p, |
4866 | 176 | user_function* udf, | ||
4867 | 177 | expr::substitution_t &s ) | ||
4868 | 178 | { | ||
4869 | 179 | return static_cast<PointerType>( p->clone( udf, s ).release() ); | ||
4870 | 176 | } | 180 | } |
4871 | 177 | 181 | ||
4872 | 182 | |||
4873 | 178 | template<> | 183 | template<> |
4876 | 179 | inline expr* clone_ptr( expr* p, expr::substitution_t &s ) { | 184 | inline expr* clone_ptr( expr* p, user_function* udf, expr::substitution_t &s ) { |
4877 | 180 | return static_cast<expr*>( p->clone( s ) ); | 185 | return static_cast<expr*>( p->clone(udf, s) ); |
4878 | 181 | } | 186 | } |
4879 | 182 | 187 | ||
4880 | 188 | |||
4881 | 183 | template<class RCHandleValueType> | 189 | template<class RCHandleValueType> |
4885 | 184 | inline RCHandleValueType* clone_ptr( rchandle<RCHandleValueType> const &p, | 190 | inline RCHandleValueType* clone_ptr( |
4886 | 185 | expr::substitution_t &s ) { | 191 | rchandle<RCHandleValueType> const &p, |
4887 | 186 | return static_cast<RCHandleValueType*>( p->clone( s ).release() ); | 192 | user_function* udf, |
4888 | 193 | expr::substitution_t &s ) | ||
4889 | 194 | { | ||
4890 | 195 | return static_cast<RCHandleValueType*>( p->clone(udf, s).release() ); | ||
4891 | 187 | } | 196 | } |
4892 | 188 | 197 | ||
4893 | 198 | |||
4894 | 189 | template<typename PointerType> | 199 | template<typename PointerType> |
4897 | 190 | inline PointerType clone_ptr_if( PointerType p, expr::substitution_t &s ) { | 200 | inline PointerType clone_ptr_if( |
4898 | 191 | return p ? clone_ptr( p, s ) : nullptr; | 201 | PointerType p, |
4899 | 202 | user_function* udf, | ||
4900 | 203 | expr::substitution_t &s ) | ||
4901 | 204 | { | ||
4902 | 205 | return p ? clone_ptr( p, udf, s ) : nullptr; | ||
4903 | 192 | } | 206 | } |
4904 | 193 | 207 | ||
4905 | 208 | |||
4906 | 194 | template<class RCHandleValueType> | 209 | template<class RCHandleValueType> |
4910 | 195 | inline RCHandleValueType* clone_ptr_if( rchandle<RCHandleValueType> const &p, | 210 | inline RCHandleValueType* clone_ptr_if( |
4911 | 196 | expr::substitution_t &s ) { | 211 | rchandle<RCHandleValueType> const &p, |
4912 | 197 | return p.isNull() ? nullptr : clone_ptr( p, s ); | 212 | user_function* udf, |
4913 | 213 | expr::substitution_t &s ) | ||
4914 | 214 | { | ||
4915 | 215 | return p.isNull() ? nullptr : clone_ptr( p, udf, s ); | ||
4916 | 198 | } | 216 | } |
4917 | 199 | 217 | ||
4918 | 218 | |||
4919 | 200 | template<class ContainerType> | 219 | template<class ContainerType> |
4922 | 201 | void clone_list( ContainerType const &from, ContainerType *to, | 220 | void clone_list( |
4923 | 202 | expr::substitution_t &s ) { | 221 | ContainerType const &from, |
4924 | 222 | ContainerType *to, | ||
4925 | 223 | user_function* udf, | ||
4926 | 224 | expr::substitution_t &s ) | ||
4927 | 225 | { | ||
4928 | 203 | FOR_EACH( typename ContainerType, i, from ) | 226 | FOR_EACH( typename ContainerType, i, from ) |
4930 | 204 | to->push_back( clone_ptr( *i, s ) ); | 227 | to->push_back( clone_ptr( *i, udf, s ) ); |
4931 | 205 | } | 228 | } |
4932 | 206 | 229 | ||
4933 | 207 | /////////////////////////////////////////////////////////////////////////////// | 230 | /////////////////////////////////////////////////////////////////////////////// |
4934 | @@ -221,9 +244,9 @@ | |||
4935 | 221 | END_VISIT( v ); | 244 | END_VISIT( v ); |
4936 | 222 | } | 245 | } |
4937 | 223 | 246 | ||
4939 | 224 | ftnode_t ftand::clone( expr::substitution_t &s ) const { | 247 | ftnode_t ftand::clone(user_function* udf, expr::substitution_t &s ) const { |
4940 | 225 | ftnode_list_t copy; | 248 | ftnode_list_t copy; |
4942 | 226 | clone_list( get_node_list(), ©, s ); | 249 | clone_list( get_node_list(), ©, udf, s ); |
4943 | 227 | return new ftand( get_loc(), copy ); | 250 | return new ftand( get_loc(), copy ); |
4944 | 228 | } | 251 | } |
4945 | 229 | 252 | ||
4946 | @@ -251,7 +274,7 @@ | |||
4947 | 251 | END_VISIT( v ); | 274 | END_VISIT( v ); |
4948 | 252 | } | 275 | } |
4949 | 253 | 276 | ||
4951 | 254 | ftnode_t ftcase_option::clone( expr::substitution_t& ) const { | 277 | ftnode_t ftcase_option::clone(user_function* udf, expr::substitution_t& ) const { |
4952 | 255 | return new ftcase_option( get_loc(), mode_ ); | 278 | return new ftcase_option( get_loc(), mode_ ); |
4953 | 256 | } | 279 | } |
4954 | 257 | 280 | ||
4955 | @@ -279,7 +302,7 @@ | |||
4956 | 279 | END_VISIT( v ); | 302 | END_VISIT( v ); |
4957 | 280 | } | 303 | } |
4958 | 281 | 304 | ||
4960 | 282 | ftnode_t ftcontent_filter::clone( expr::substitution_t &s ) const { | 305 | ftnode_t ftcontent_filter::clone(user_function* udf, expr::substitution_t &s ) const { |
4961 | 283 | return new ftcontent_filter( get_loc(), mode_ ); | 306 | return new ftcontent_filter( get_loc(), mode_ ); |
4962 | 284 | } | 307 | } |
4963 | 285 | 308 | ||
4964 | @@ -308,7 +331,7 @@ | |||
4965 | 308 | END_VISIT( v ); | 331 | END_VISIT( v ); |
4966 | 309 | } | 332 | } |
4967 | 310 | 333 | ||
4969 | 311 | ftnode_t ftdiacritics_option::clone( expr::substitution_t& ) const { | 334 | ftnode_t ftdiacritics_option::clone(user_function* udf, expr::substitution_t& ) const { |
4970 | 312 | return new ftdiacritics_option( get_loc(), mode_ ); | 335 | return new ftdiacritics_option( get_loc(), mode_ ); |
4971 | 313 | } | 336 | } |
4972 | 314 | 337 | ||
4973 | @@ -345,8 +368,8 @@ | |||
4974 | 345 | END_VISIT( v ); | 368 | END_VISIT( v ); |
4975 | 346 | } | 369 | } |
4976 | 347 | 370 | ||
4979 | 348 | ftnode_t ftdistance_filter::clone( expr::substitution_t &s ) const { | 371 | ftnode_t ftdistance_filter::clone(user_function* udf, expr::substitution_t &s ) const { |
4980 | 349 | return new ftdistance_filter( get_loc(), clone_ptr_if( range_, s ), unit_ ); | 372 | return new ftdistance_filter( get_loc(), clone_ptr_if( range_, udf, s ), unit_ ); |
4981 | 350 | } | 373 | } |
4982 | 351 | 374 | ||
4983 | 352 | ostream& ftdistance_filter::put( ostream &o ) const { | 375 | ostream& ftdistance_filter::put( ostream &o ) const { |
4984 | @@ -384,9 +407,9 @@ | |||
4985 | 384 | END_VISIT( v ); | 407 | END_VISIT( v ); |
4986 | 385 | } | 408 | } |
4987 | 386 | 409 | ||
4989 | 387 | ftnode_t ftextension_selection::clone( expr::substitution_t &s ) const { | 410 | ftnode_t ftextension_selection::clone(user_function* udf, expr::substitution_t &s ) const { |
4990 | 388 | return new ftextension_selection( | 411 | return new ftextension_selection( |
4992 | 389 | get_loc(), pragmas_, clone_ptr_if( ftselection_, s ) | 412 | get_loc(), pragmas_, clone_ptr_if( ftselection_, udf, s ) |
4993 | 390 | ); | 413 | ); |
4994 | 391 | } | 414 | } |
4995 | 392 | 415 | ||
4996 | @@ -418,7 +441,7 @@ | |||
4997 | 418 | END_VISIT( v ); | 441 | END_VISIT( v ); |
4998 | 419 | } | 442 | } |
4999 | 420 | 443 | ||
5000 | 421 | ftnode_t ftextension_option::clone( expr::substitution_t& ) const { |
The diff has been truncated for viewing.
Validation queue starting for merge proposal. zorbatest. lambda. nu:8080/ remotequeue/ markos- scratch- 2012-10- 09T13-39- 57.923Z/ log.html
Log at: http://