Skip to content

Commit 7da2ecd

Browse files
line-oJuri Leino
authored andcommitted
[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.
1 parent 20944c6 commit 7da2ecd

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

exist-core/src/main/java/org/exist/xquery/ContextItemExpression.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929

3030
public class ContextItemExpression extends LocationStep {
3131

32-
private int returnType = Type.ITEM;
33-
3432
public ContextItemExpression(final XQueryContext context) {
3533
// TODO: create class AnyItemTest (one private implementation found in saxon)
3634
super(context, Constants.SELF_AXIS, new AnyNodeTest());
@@ -40,7 +38,7 @@ public ContextItemExpression(final XQueryContext context) {
4038
public void analyze(AnalyzeContextInfo contextInfo) throws XPathException {
4139
contextInfo.addFlag(DOT_TEST);
4240
// set return type to static type to allow for index use in optimization step
43-
returnType = contextInfo.getStaticType();
41+
staticReturnType = contextInfo.getStaticType();
4442

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

7068
@Override
7169
public int returnsType() {
72-
return returnType;
70+
// "." will have the same type as the parent expression
71+
return staticReturnType;
7372
}
7473

7574
@Override

0 commit comments

Comments
 (0)