Sorin Marian Nasoi has proposed merging lp:~zorba-coders/zorba/fix_bug_987830 
into lp:zorba.

Requested reviews:
  Zorba Coders (zorba-coders)
Related bugs:
  Bug #987830 in Zorba: "dismiss adding of the functions that do not have a 
return type"
  https://bugs.launchpad.net/zorba/+bug/987830

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/fix_bug_987830/+merge/103370

fix for lp:987830.
-- 
https://code.launchpad.net/~zorba-coders/zorba/fix_bug_987830/+merge/103370
Your team Zorba Coders is requested to review the proposed merge of 
lp:~zorba-coders/zorba/fix_bug_987830 into lp:zorba.
=== modified file 'modules/com/zorba-xquery/www/modules/debugger/dbgp-message-handler.xq'
--- modules/com/zorba-xquery/www/modules/debugger/dbgp-message-handler.xq	2012-04-24 12:39:38 +0000
+++ modules/com/zorba-xquery/www/modules/debugger/dbgp-message-handler.xq	2012-04-24 20:33:22 +0000
@@ -258,7 +258,7 @@
  : @param $message the message.
  : @return ().
  :)
-declare function dmh:process($message as element())
+declare function dmh:process($message as element()) as xs:anyAtomicType*
 {
   let $nodeName := fn:local-name($message)
   let $id := fn:data($message/@transaction_id)

=== modified file 'modules/com/zorba-xquery/www/modules/project_xqdoc.xq'
--- modules/com/zorba-xquery/www/modules/project_xqdoc.xq	2012-04-24 12:39:38 +0000
+++ modules/com/zorba-xquery/www/modules/project_xqdoc.xq	2012-04-24 20:33:22 +0000
@@ -59,7 +59,7 @@
  : @return empty sequence.
  :)
 declare %an:sequential function pxqdoc:delete-XML-dir(
-  $xqdocPath as xs:string)
+  $xqdocPath as xs:string) as empty
 {
   variable $xqdocXMLPath  := fn:concat( $xqdocPath,
                                         file:directory-separator(),
@@ -92,7 +92,7 @@
  :)
 declare %an:sequential function pxqdoc:generate-xqdoc-XML(
   $zorbaManifestPath as xs:string,
-  $xqdocPath as xs:string)
+  $xqdocPath as xs:string) as empty
 {
   (: Note: only the modules that are configured in the Zorba version you are using will be build :)                                      
   variable $xqdocXMLPath := concat($xqdocPath, file:directory-separator(), "xml");

=== modified file 'modules/com/zorba-xquery/www/modules/xqdoc2xhtml/index.xq'
--- modules/com/zorba-xquery/www/modules/xqdoc2xhtml/index.xq	2012-04-24 12:39:38 +0000
+++ modules/com/zorba-xquery/www/modules/xqdoc2xhtml/index.xq	2012-04-24 20:33:22 +0000
@@ -268,7 +268,7 @@
  :)
 declare %an:sequential function xqdoc2html:copy-xhtml-requisites(
   $xhtmlRequisitesPath  as xs:string,
-  $xqdocBuildPath       as xs:string)
+  $xqdocBuildPath       as xs:string) as empty
 {
   let $xhtmlPath      := fn:concat($xqdocBuildPath, file:directory-separator(), "xhtml"),
       $xmlPath        := fn:concat($xqdocBuildPath, file:directory-separator(), "xml"),
@@ -370,7 +370,7 @@
   $xqdocBuildPath as xs:string,
   $indexHtmlPath  as xs:string,
   $zorbaVersion   as xs:string,
-  $xhtmlRequisitesPath as xs:string)
+  $xhtmlRequisitesPath as xs:string) as empty
 {
   (: fill out $xqdoc2html:ZorbaManifest :)
   xqdoc2html:collectZorbaManifestEntries($zorbaManifestPath, $xqdocBuildPath);

=== modified file 'modules/org/expath/ns/file.xq'
--- modules/org/expath/ns/file.xq	2012-04-24 12:39:38 +0000
+++ modules/org/expath/ns/file.xq	2012-04-24 20:33:22 +0000
@@ -619,7 +619,7 @@
  :)
 declare function file:glob-to-regex(
   $pattern as xs:string
-) {
+) as xs:string {
   let $pattern := fn:replace($pattern, '(\.|\[|\]|\\|/|\||\-|\^|\$|\?|\*|\+|\{|\}|\(|\))','\\$1')
   let $pattern := fn:replace($pattern, '\\\?', '.')
   let $pattern := fn:replace($pattern, '\\\*', '.*')

=== modified file 'src/compiler/translator/translator.cpp'
--- src/compiler/translator/translator.cpp	2012-04-24 12:39:38 +0000
+++ src/compiler/translator/translator.cpp	2012-04-24 20:33:22 +0000
@@ -11746,7 +11746,19 @@
   store::Item_t qnameItem;
   expand_elem_qname(qnameItem, qname, loc);
 
-  xqtref_t t = CTX_TM->create_named_atomic_type(qnameItem, TypeConstants::QUANT_ONE);
+  xqtref_t t;
+  if (qnameItem->getStringValue() == "empty")
+  {
+    t = CTX_TM->create_empty_type();
+  }
+  else if (qnameItem->getStringValue() == "none")
+  {
+    t = CTX_TM->create_none_type();
+  }
+  else
+  {
+    t = CTX_TM->create_named_atomic_type(qnameItem, TypeConstants::QUANT_ONE);
+  }
 
   // some types that should never be parsed, like xs:untyped, are;
   // we catch them with is_simple()

=== modified file 'test/rbkt/Queries/zorba/xqdoc/moduleDocumentation.xq'
--- test/rbkt/Queries/zorba/xqdoc/moduleDocumentation.xq	2012-04-24 12:39:38 +0000
+++ test/rbkt/Queries/zorba/xqdoc/moduleDocumentation.xq	2012-04-24 20:33:22 +0000
@@ -138,7 +138,9 @@
     let $docParamCount := count($params)
     let $missing := $paramCount - $docParamCount  
     let $hasDescr := exists($function/xqdoc:comment/xqdoc:description)
-    let $hasReturn := exists($function/xqdoc:comment/xqdoc:return)
+    let $hasReturn := exists($function/xqdoc:return)
+    let $isUpdating := contains($signature, "updating")
+    let $isReturnDocumented := exists($function/xqdoc:comment/xqdoc:return)
     return string-join((
         (: Test for function description :)
         if (not($hasDescr)) then
@@ -158,8 +160,17 @@
     Arity: ", $paramCount)
         else
             (),
+        (: Test for existing return value in function signature:)
+        if (not($hasReturn) and not($isUpdating)) then
+            concat("
+    ERROR: Return value for the function not stated explicitly in the function signature;
+    Module: ", $module/xqdoc:uri, "
+    Function: ", $function/xqdoc:name, "
+    Arity: ", $paramCount)
+        else
+            (),
         (: Test for documented return value :)
-        if (not($hasReturn)) then
+        if (not($isReturnDocumented)) then
             concat("
     ERROR: Return value not documented;
     Module: ", $module/xqdoc:uri, "

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