Skip to content

allow static type mismatches in XPath expressions #3653

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

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
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
Next Next commit
[refactor] ContextItemExpression uses staticReturnType
Turns out, a property for the static return type is already defined by
the Step super class.
ContextItemExpression uses this now and its own returnType property is
removed.
  • Loading branch information
line-o committed Jul 6, 2021
commit d8c911102afd6b0da8119c5f9ae4c598712780c1
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@

public class ContextItemExpression extends LocationStep {

private int returnType = Type.ITEM;

public ContextItemExpression(final XQueryContext context) {
// TODO: create class AnyItemTest (one private implementation found in saxon)
super(context, Constants.SELF_AXIS, new AnyNodeTest());
Expand All @@ -40,7 +38,7 @@ public ContextItemExpression(final XQueryContext context) {
public void analyze(AnalyzeContextInfo contextInfo) throws XPathException {
contextInfo.addFlag(DOT_TEST);
// set return type to static type to allow for index use in optimization step
returnType = contextInfo.getStaticType();
staticReturnType = contextInfo.getStaticType();

super.analyze(contextInfo);
}
Expand Down Expand Up @@ -69,7 +67,8 @@ public Sequence eval(final Sequence contextSequence, final Item contextItem) thr

@Override
public int returnsType() {
return returnType;
// "." will have the same type as the parent expression
return staticReturnType;
}

@Override
Expand Down