Markos Zaharioudakis has proposed merging lp:~zorba-coders/zorba/markos-scratch 
into lp:zorba.

Requested reviews:
  Markos Zaharioudakis (markos-za)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/102356

fix for bug #980526
-- 
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/102356
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'ChangeLog'
--- ChangeLog	2012-04-16 20:56:43 +0000
+++ ChangeLog	2012-04-17 17:00:30 +0000
@@ -23,6 +23,7 @@
   * Fixed bug #906494 (default compile with D_FILE_OFFSET_BITS=64)
   * Fixed bug #912586, #912593 and #912722 (assertion failures with lax validation)
   * Fixed bug #921458 (file:read-text-lines() blocking)
+  * Fixed bug #980526 (no-copy rule bug due to global var being set in "distant" udf)
   * Fixed bug #949910 (has-children may be invoked on all nodes). Internally, zorba::store::Item::getChildren() now returns NULL on node classes without offspring (instead of raising an error).
 
 

=== modified file 'src/compiler/rewriter/tools/dataflow_annotations.cpp'
--- src/compiler/rewriter/tools/dataflow_annotations.cpp	2012-04-16 20:56:43 +0000
+++ src/compiler/rewriter/tools/dataflow_annotations.cpp	2012-04-17 17:00:30 +0000
@@ -834,12 +834,15 @@
       sources.erase(sources.begin() + i);
       --i;
 
-      // If this method is called to find the sources of an expr within the
+      // Note: If this method is called to find the sources of an expr within the
       // body of a function_item, then udfCaller->theFo will be NULL. 
+      while(udfCaller->theFo && varExpr->get_udf() != udfCaller->theFo->get_func())
+      {
+        udfCaller = udfCaller->thePrev;
+      }
+
       if (udfCaller->theFo)
-      {
-        ZORBA_ASSERT(varExpr->get_udf() == udfCaller->theFo->get_func());
-
+      {  
         fo_expr* foExpr = udfCaller->theFo;
         expr* foArg = foExpr->get_arg(varExpr->get_param_pos());
         std::vector<expr*> argSources;

=== modified file 'src/runtime/eval/eval.cpp'
--- src/runtime/eval/eval.cpp	2012-04-16 20:56:43 +0000
+++ src/runtime/eval/eval.cpp	2012-04-17 17:00:30 +0000
@@ -62,20 +62,6 @@
 {
 }
 
-/****************************************************************************//**
-
-********************************************************************************/
-void
-EvalIteratorState::reset(PlanState& aPlanState) 
-{
-  PlanIteratorState::reset(aPlanState);
-  // When an exception is thrown during an EvalIterator::nextImpl invocation
-  // or when the EvalIterator doesn't return all resulting items of an other reason,
-  // the PlanWrapper is not properly destroyed. Therefore, we destroy it in the reset
-  // to prevent troubles the next time the EvalIterator is used.
-  thePlanWrapper = 0;
-}
-
 
 /****************************************************************************//**
 
@@ -116,6 +102,7 @@
 void EvalIterator::serialize(::zorba::serialization::Archiver& ar)
 {
   ar.set_serialize_everything();
+
   serialize_baseclass(ar,
   (NaryBaseIterator<EvalIterator, EvalIteratorState>*)this);
 

=== modified file 'src/runtime/eval/eval.h'
--- src/runtime/eval/eval.h	2012-04-16 20:56:43 +0000
+++ src/runtime/eval/eval.h	2012-04-17 17:00:30 +0000
@@ -34,11 +34,10 @@
   std::auto_ptr<CompilerCB>      ccb;
   std::auto_ptr<dynamic_context> dctx;
 
+public:
   EvalIteratorState();
 
   ~EvalIteratorState();
-
-  void reset(PlanState&);
 };
 
 

=== added file 'test/rbkt/ExpQueryResults/zorba/no-copy/q21.xml.res'
=== added file 'test/rbkt/Queries/zorba/no-copy/q21.xq'
--- test/rbkt/Queries/zorba/no-copy/q21.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/no-copy/q21.xq	2012-04-17 17:00:30 +0000
@@ -0,0 +1,86 @@
+import module namespace refl = "http://www.zorba-xquery.com/modules/reflection";;
+
+declare namespace ann = "http://www.zorba-xquery.com/annotations";;
+
+declare variable $serialization-params as element():=
+<serialization-parameters/>;
+
+
+declare %ann:sequential function 
+local:set-serialization-parameters($params as element()) as empty-sequence()
+{
+  $serialization-params := $params;
+};
+
+
+declare %ann:sequential function local:set-redirect($url as xs:string) as xs:integer
+{
+  1
+};
+
+
+declare %ann:sequential function local:save()
+{
+  variable $tmp := $serialization-params/..;
+  local:set-redirect("/wiki");
+};
+
+
+local:save()
+
+
+
+
+(:
+
+module namespace resp = "http://www.28msec.com/modules/response";;
+
+declare namespace ann = "http://www.zorba-xquery.com/annotations";;
+
+declare variable 
+$resp:serialization-params as element(serialization-parameters) :=
+resp:serializer-defaults-xml();
+
+
+declare function 
+resp:serializer-defaults-xml() as element(serialization-parameters)
+{
+  <serialization-parameters/>
+};
+
+
+declare %ann:sequential function 
+resp:set-serialization-parameters($params as element(serialization-parameters)) as 
+empty-sequence()
+{
+  $resp:serialization-params := $params;
+};
+
+
+declare %ann:sequential function resp:set-redirect($url as xs:string) as xs:integer
+{
+  1
+};
+
+
+----------------------------------------
+
+
+import module namespace refl = "http://www.zorba-xquery.com/modules/reflection";;
+
+import module namespace res = "http://www.28msec.com/modules/response"; at "q21.xqlib";
+
+declare namespace ann = "http://www.zorba-xquery.com/annotations";;
+
+
+declare %ann:sequential function local:save()
+{
+  variable $tmp := refl:eval-s('"blub"');
+  res:set-redirect("/wiki");
+};
+
+
+local:save()
+
+
+:)

-- 
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

Reply via email to