Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature request] inspect:inspect-module should include calls to variables #1388

Open
duncdrum opened this issue Mar 31, 2017 · 0 comments
Open
Assignees
Labels
enhancement new features, suggestions, etc.

Comments

@duncdrum
Copy link
Contributor

duncdrum commented Mar 31, 2017

What is the problem

When using inspect:inspect-module() the xml report scans a module's functions to see where the function is called by other functions. The generated report includes this information inside a <calls/> element. However, it doesn't do that for variables. At least I couldn't get it to do that using the existing documentation.

What did you expect

It would be very handy if the same behaviour applied to variables, which seems to have been the idea behind xqDocs originally, see here note the section: "Internal Functions that reference this Variable".

Describe how to reproduce or add a test

Save this MWE module in exist as mwe.xq:

xquery version "3.1";
(:~
: This module is a minimal working example.
:
: @author duncdrum
: @see https://github.com/eXist-db/exist/issues/1388
:
: @return test stuff:)

module namespace mwe="http://mwe";

declare variable $mwe:answer := 42;

(:~
: dummy function calling variable
: @param $num a number :)
declare function mwe:question ($num as xs:integer) as xs:string {
let $dt := $mwe:answer div 42
for $n in 1 to $dt
return
 "is it " || $n || "?"    
};

(:~
: dummy function calling other function
: @param $in input processed by other function :)
declare function mwe:another-function ($in as xs:integer) as xs:integer {
for $n in 1 to $in
return
    mwe:question($n)
};

(:~
: generate documentation via inspect
: @param $path to mwe :)
declare function mwe:doc($path as xs:string) as item()* {
for $n in $path
return
    inspect:inspect-module(xs:anyURI($path))
};

then call mwe:doc("*PATH-TO-MWE.XQ*")

note the two lines from the result:

…
<variable name="mwe:answer"/>
...
<calls>
    <function name="mwe:question" module="http://mwe" arity="1"/>
</calls>

wouldn't it be more consistent and helpful to add:

<variable name="mwe:answer">
    <called>
        <function name="mwe:question" module="http://mwe" arity="1"/>
    </called>
</variable>
...
<calls>
    <variable name="mwe:answer" module="http://mwe"/>
</calls>

Context information

Please always add the following information

  • eXist-db version eXist-db 3.1.1
  • Java version (e.g. Java8u121)
  • Operating system (MacOs) 10.12.4
  • 64 bit
@duncdrum duncdrum changed the title [feature request] inspect:inspect-module should return calls for variables [feature request] inspect:inspect-module should include calls to variables Mar 31, 2017
@adamretter adamretter added the enhancement new features, suggestions, etc. label Mar 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement new features, suggestions, etc.
Projects
None yet
Development

No branches or pull requests

3 participants