Markos Zaharioudakis has proposed merging lp:~zorba-coders/zorba/markos-scratch into lp:zorba.
Commit message: cleanup + new test Requested reviews: Markos Zaharioudakis (markos-za) For more details, see: https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/185216 cleanup + new test -- https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/185216 Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/compiler/expression/expr.cpp' --- src/compiler/expression/expr.cpp 2013-05-15 23:22:01 +0000 +++ src/compiler/expression/expr.cpp 2013-09-12 08:26:43 +0000 @@ -806,6 +806,9 @@ theInput(input) { compute_scripting_kind(); + + if (theInput->get_expr_kind() == var_expr_kind) + static_cast<var_expr*>(theInput)->add_ref(); } === modified file 'src/compiler/translator/translator.cpp' --- src/compiler/translator/translator.cpp 2013-09-12 07:54:03 +0000 +++ src/compiler/translator/translator.cpp 2013-09-12 08:26:43 +0000 @@ -1669,13 +1669,10 @@ argVars.push_back(argVar); expr* arg = CREATE(wrapper)(theRootSctx, theUDF, loc, argVar); - argVar->add_ref(); arg = normalize_fo_arg(i, arg, inlineUDF.get(), loc); arguments.push_back(arg); } - fiSubstVar->add_ref(); - expr* body = CREATE(dynamic_function_invocation)(theRootSctx, theUDF, @@ -1938,8 +1935,6 @@ // compute the size of the input seq expr* varWrapper = CREATE(wrapper)(theRootSctx, theUDF, loc, lcInputVar); - lcInputVar->add_ref(); - fo_expr* countExpr = CREATE(fo)(theRootSctx, theUDF, loc, @@ -6617,18 +6612,12 @@ expr* valueExpr = pop_nodestack(); if (varType != NULL) - valueExpr = theExprManager->create_treat_expr(theRootSctx, - theUDF, - loc, - valueExpr, - varType, - TREAT_TYPE_MATCH); + valueExpr = CREATE(treat)(theRootSctx, theUDF, loc, + valueExpr, + varType, + TREAT_TYPE_MATCH); - push_nodestack(theExprManager->create_var_set_expr(theRootSctx, - theUDF, - loc, - ve, - valueExpr)); + push_nodestack(CREATE(var_set)(theRootSctx, theUDF, loc, ve, valueExpr)); theAssignedVars.back().push_back(ve); } @@ -7636,8 +7625,6 @@ inputExpr = CREATE(wrapper)(theRootSctx, theUDF, specLoc, inputExpr); - var->getVar()->add_ref(); - inputExpr = wrap_in_atomization(inputExpr); inputExpr = wrap_in_type_match(inputExpr, @@ -7687,10 +7674,7 @@ bind_var(ngVar, theSctx); - expr* inputExpr = - theExprManager->create_wrapper_expr(theRootSctx, theUDF, loc, inputVar); - - inputVar->add_ref(); + expr* inputExpr = CREATE(wrapper)(theRootSctx, theUDF, loc, inputVar); nongrouping_rebind.push_back(std::pair<expr*, var_expr*>(inputExpr, ngVar)); } @@ -10357,8 +10341,6 @@ relpath_expr* predPathExpr = CREATE(relpath)(theRootSctx, theUDF, loc); predPathExpr->add_back(CREATE(wrapper)(theRootSctx, theUDF, loc, fcOuterDot->get_var())); - fcOuterDot->get_var()->add_ref(); - predPathExpr->add_back(axisExpr); expr* predInputExpr = predPathExpr; @@ -11331,8 +11313,6 @@ throw; } - ve->add_ref(); - if (ve->get_kind() == var_expr::prolog_var) { TypeManager* tm = CTX_TM; @@ -11405,8 +11385,6 @@ } } - dotVar->add_ref(); - return CREATE(wrapper)(theRootSctx, theUDF, loc, dotVar); } @@ -11426,8 +11404,6 @@ } } - posVar->add_ref(); - return CREATE(wrapper)(theRootSctx, theUDF, loc, posVar); } @@ -11447,8 +11423,6 @@ } } - sizeVar->add_ref(); - return CREATE(wrapper)(theRootSctx, theUDF, loc, sizeVar); } @@ -12353,8 +12327,6 @@ std::vector<expr*> fncall_args; fncall_args.push_back(CREATE(wrapper)(theRootSctx, theUDF, loc, seq_fc->get_var())); - seq_fc->get_var()->add_ref(); - expr* dynamic_fncall = CREATE(dynamic_function_invocation)(theRootSctx, theUDF, loc, arguments[1], @@ -12384,8 +12356,6 @@ std::vector<expr*> fncall_args; fncall_args.push_back(CREATE(wrapper)(theRootSctx, theUDF, loc, seq_fc->get_var())); - seq_fc->get_var()->add_ref(); - expr* dynamic_fncall = CREATE(dynamic_function_invocation)(theRootSctx, theUDF, loc, arguments[1], @@ -12568,8 +12538,6 @@ sourceExpr = CREATE(wrapper)(theRootSctx, theUDF, loc, fc->get_var()); - fc->get_var()->add_ref(); - expr* dynFuncInvocation = CREATE(dynamic_function_invocation)(theRootSctx, theUDF, loc, sourceExpr, @@ -12832,8 +12800,6 @@ flworBody->add_clause(lc); foArgs[1] = CREATE(wrapper)(theRootSctx, theUDF, loc, lc->get_var()); - lc->get_var()->add_ref(); - flworBody->set_return_expr(generate_fn_body(func, foArgs, loc)); body = flworBody; break; === added file 'test/rbkt/ExpCompilerResults/IterPlan/zorba/optim/var_elim_01.iter' --- test/rbkt/ExpCompilerResults/IterPlan/zorba/optim/var_elim_01.iter 1970-01-01 00:00:00 +0000 +++ test/rbkt/ExpCompilerResults/IterPlan/zorba/optim/var_elim_01.iter 2013-09-12 08:26:43 +0000 @@ -0,0 +1,5 @@ +Iterator tree for main query: +<ElementIterator> + <SingletonIterator value="xs:QName(,,a)"/> +</ElementIterator> + === added file 'test/rbkt/ExpQueryResults/zorba/optim/var_elim_01.xml.res' --- test/rbkt/ExpQueryResults/zorba/optim/var_elim_01.xml.res 1970-01-01 00:00:00 +0000 +++ test/rbkt/ExpQueryResults/zorba/optim/var_elim_01.xml.res 2013-09-12 08:26:43 +0000 @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<a/> === added file 'test/rbkt/Queries/zorba/optim/var_elim_01.xq' --- test/rbkt/Queries/zorba/optim/var_elim_01.xq 1970-01-01 00:00:00 +0000 +++ test/rbkt/Queries/zorba/optim/var_elim_01.xq 2013-09-12 08:26:43 +0000 @@ -0,0 +1,13 @@ + +import module namespace file = "http://expath.org/ns/file"; +import module namespace x = "http://zorba.io/modules/xml"; +import schema namespace opt = "http://zorba.io/modules/xml-options"; + +let $xml-frags1 := x:parse(file:read-text(fn:resolve-uri("levels.xml")), +<opt:options> +<opt:parse-external-parsed-entity/> +</opt:options>) + +let $xml-frags2 := <a></a> + +return $xml-frags2
-- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp