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

"Cannot read property 'next' of undefined" error when calling an updating function in array:for-each #227

Open
JosVerburg opened this issue Mar 20, 2020 · 4 comments
Assignees

Comments

@JosVerburg
Copy link
Member

Can be reproduced with:

<p>This is a paragraph <b>for</b> testing <b>and</b> such.</p>
declare %private %updating function Q{x}nuke-it($x) {
  delete node $x
};
let $bolds := //b, $arr := array {$bolds[1], $bolds[2]} return
array:for-each($arr, Q{x}nuke-it#1)

This now results in the error "Cannot read property 'next' of undefined".
The same works fine with a non-updating function e.g. trace#1

@DrRataplan DrRataplan self-assigned this Mar 25, 2020
@DrRataplan
Copy link
Collaborator

Funnily enough, the spec does not say anything about this. I think in this case we are not able to statically determine whether the array function will 'turn' updating depending on its arguments. I think we should disallow this. @JosVerburg , what do you think?

@JosVerburg
Copy link
Member Author

Would it not allow updating expressions to be inserted in it like here https://github.com/LeoWoerteler/XQUTS/blob/master/Queries/XQuery/FunctionCall/id-function-call-01.xq

@DrRataplan
Copy link
Collaborator

that is an updating function argument. the bug we have now is an updating function that is executed as a hicher order function, without the invoke updating function stuff you'd normally use

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants