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

[6.x.x] Named Function References can have Postfix Expressions #5115

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions exist-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,7 @@
<exclude>src/test/java/org/exist/xquery/value/SubSequenceRangeTest.java</exclude>
<exclude>src/test/java/org/exist/xquery/value/SubSequenceTest.java</exclude>
<exclude>src/test/xquery/binary-value.xqm</exclude>
<exclude>src/test/xquery/xquery3/postfix-expr.xqm</exclude>

<!--
Derivative work licensed under dbXML 1.0 and LGPL 2.1
Expand Down Expand Up @@ -876,6 +877,7 @@ The original license statement is also included below.]]></preamble>
<include>src/test/java/org/exist/xquery/value/SubSequenceRangeTest.java</include>
<include>src/test/java/org/exist/xquery/value/SubSequenceTest.java</include>
<include>src/test/xquery/binary-value.xqm</include>
<include>src/test/xquery/xquery3/postfix-expr.xqm</include>
</includes>

</licenseSet>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2228,6 +2228,7 @@ throws PermissionDeniedException, EXistException, XPathException
{ path.add(step); }
|
step=functionReference [path]
step=postfixExpr [step]
{ path.add(step); }
|
step=inlineFunctionDecl [path]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ public void dump(ExpressionDumper dumper) {
dumper.display(Integer.toString(arity));
}

@Override
public String toString() {
return qname.toString() + '#' + arity;
}

@Override
public Sequence eval(Sequence contextSequence, Item contextItem)
throws XPathException {
Expand Down
49 changes: 49 additions & 0 deletions exist-core/src/test/xquery/xquery3/postfix-expr.xqm
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
(:
: Copyright (C) 2014, Evolved Binary Ltd
:
: This file was originally ported from FusionDB to eXist-db by
: Evolved Binary, for the benefit of the eXist-db Open Source community.
: Only the ported code as it appears in this file, at the time that
: it was contributed to eXist-db, was re-licensed under The GNU
: Lesser General Public License v2.1 only for use in eXist-db.
:
: This license grant applies only to a snapshot of the code as it
: appeared when ported, it does not offer or infer any rights to either
: updates of this source code or access to the original source code.
:
: The GNU Lesser General Public License v2.1 only license follows.
:
: ---------------------------------------------------------------------
:
: Copyright (C) 2014, Evolved Binary Ltd
:
: This library is free software; you can redistribute it and/or
: modify it under the terms of the GNU Lesser General Public
: License as published by the Free Software Foundation; version 2.1.
:
: This library is distributed in the hope that it will be useful,
: but WITHOUT ANY WARRANTY; without even the implied warranty of
: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
: Lesser General Public License for more details.
:
: You should have received a copy of the GNU Lesser General Public
: License along with this library; if not, write to the Free Software
: Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
:)
xquery version "3.1";

module namespace tpe = "http://exist-db.org/xquery/test/postfix-expr";

declare namespace test = "http://exist-db.org/xquery/xqsuite";

declare
%test:assertEquals("test123")
function tpe:named-function-ref-postfix() {
xs:string#1("test123")
};

declare
%test:assertEquals("test456")
function tpe:include-function-expr-postfix() {
function($x) { $x }("test456")
};
Loading