← Back to team overview

zorba-coders team mailing list archive

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

 

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

Commit message:
fixed bug in new array navigation

Requested reviews:
  Markos Zaharioudakis (markos-za)

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

fixed bug in new array navigation
-- 
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/170037
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/api/serialization/serializer.cpp'
--- src/api/serialization/serializer.cpp	2013-06-17 20:05:21 +0000
+++ src/api/serialization/serializer.cpp	2013-06-18 10:31:46 +0000
@@ -1002,18 +1002,12 @@
   // top-level item. JSON rules for simple types apply here.
   if (item->isObject())
   {
-    if (thePreviousItemKind == PREVIOUS_ITEM_WAS_TEXT)
-      tr << " ";
-
     emit_json_object(item, depth);
 
     thePreviousItemKind = PREVIOUS_ITEM_WAS_NODE;
   }
   else if (item->isArray())
   {
-    if (thePreviousItemKind == PREVIOUS_ITEM_WAS_TEXT)
-      tr << " ";
-
     emit_json_array(item, depth);
 
     thePreviousItemKind = PREVIOUS_ITEM_WAS_NODE;

=== modified file 'src/compiler/translator/translator.cpp'
--- src/compiler/translator/translator.cpp	2013-06-17 18:00:35 +0000
+++ src/compiler/translator/translator.cpp	2013-06-18 10:31:46 +0000
@@ -10839,9 +10839,11 @@
     expr* flworVarExpr = 
     CREATE(wrapper)(theRootSctx, theUDF, loc, sourceClause->get_var());
 
+    expr* selectorExpr = static_cast<json_array_expr*>(predExpr)->get_expr();
+
     std::vector<expr*> args(2);
     args[0] = flworVarExpr;
-    args[1] = predExpr;
+    args[1] = selectorExpr;
 
     expr* accessorExpr =
     generate_fn_body(BUILTIN_FUNC(FN_JSONIQ_MEMBER_2), args, loc);
@@ -10850,6 +10852,7 @@
 
     flworExpr->set_return_expr(accessorExpr);
 
+    push_nodestack(flworExpr);
     pop_scope();
 
     return;

=== modified file 'test/rbkt/ExpQueryResults/zorba/jsoniq/nav_03.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsoniq/nav_03.xml.res	2013-06-17 19:10:21 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsoniq/nav_03.xml.res	2013-06-18 10:31:46 +0000
@@ -1,2 +1,2 @@
 3 40 
- 1 { "foo" : 3 } 4 10 { "foo" : 30 } 40
+ 1{ "foo" : 3 }4 10{ "foo" : 30 }40

=== added file 'test/rbkt/ExpQueryResults/zorba/jsoniq/nav_04.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsoniq/nav_04.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsoniq/nav_04.xml.res	2013-06-18 10:31:46 +0000
@@ -0,0 +1,3 @@
+3 30 
+ 
+ 1{ "foo" : 3 }4 10{ "foo" : 30 }40

=== added file 'test/rbkt/Queries/zorba/jsoniq/nav_04.jq'
--- test/rbkt/Queries/zorba/jsoniq/nav_04.jq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/jsoniq/nav_04.jq	2013-06-18 10:31:46 +0000
@@ -0,0 +1,11 @@
+declare variable $o1 := { "array" : [1, {"foo" : 3} , 4] };
+
+declare variable $o2 := { "array" : [10, {"foo" : 30}, 40] };
+
+($o1, $o2)."array"[[2]].foo,
+"
+",
+($o1, $o2)."array"[[6]],
+"
+",
+($o1, $o2)."array"[]


Follow ups