You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by mo...@apache.org on 2001/09/19 19:54:15 UTC
cvs commit: xml-xalan/java/src/org/apache/xalan/xsltc/compiler LastCall.java ParameterRef.java PositionCall.java Predicate.java RoundCall.java VariableRefBase.java
morten 01/09/19 10:54:15
Modified: java/src/org/apache/xalan/xsltc/compiler LastCall.java
ParameterRef.java PositionCall.java Predicate.java
RoundCall.java VariableRefBase.java
Log:
Fix for combination of wildcards and position predicates in match patterns.
PR: bugzilla 1532
Obtained from: n/a
Submitted by: morten@xml.apache.org
Reviewed by: morten@xml.apache.org
Revision Changes Path
1.3 +3 -1 xml-xalan/java/src/org/apache/xalan/xsltc/compiler/LastCall.java
Index: LastCall.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/LastCall.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- LastCall.java 2001/08/27 09:07:19 1.2
+++ LastCall.java 2001/09/19 17:54:15 1.3
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: LastCall.java,v 1.2 2001/08/27 09:07:19 morten Exp $
+ * @(#)$Id: LastCall.java,v 1.3 2001/09/19 17:54:15 morten Exp $
*
* The Apache Software License, Version 1.1
*
@@ -95,6 +95,7 @@
if (getParent().getParent() instanceof Predicate) {
Predicate pred = (Predicate)getParent().getParent();
_type = pred.getPosType();
+ if ((_type==DOM.ELEMENT) || (_type==DOM.ATTRIBUTE)) _type = -1;
}
}
@@ -102,6 +103,7 @@
// current node's children and not the last in the current iterator.
if (getParent() instanceof Predicate) {
_type = ((Predicate)getParent()).getPosType();
+ if ((_type==DOM.ELEMENT) || (_type==DOM.ATTRIBUTE)) _type = -1;
if (getParent().getParent() instanceof Step) {
lastChild = true;
}
1.8 +9 -1 xml-xalan/java/src/org/apache/xalan/xsltc/compiler/ParameterRef.java
Index: ParameterRef.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/ParameterRef.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ParameterRef.java 2001/09/17 08:20:54 1.7
+++ ParameterRef.java 2001/09/19 17:54:15 1.8
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: ParameterRef.java,v 1.7 2001/09/17 08:20:54 morten Exp $
+ * @(#)$Id: ParameterRef.java,v 1.8 2001/09/19 17:54:15 morten Exp $
*
* The Apache Software License, Version 1.1
*
@@ -110,5 +110,13 @@
}
il.append(new GETFIELD(cpg.addFieldref(className,name,signature)));
}
+
+ if (_variable.getType() instanceof NodeSetType) {
+ final int reset = cpg.addInterfaceMethodref(NODE_ITERATOR,
+ "reset",
+ "()"+NODE_ITERATOR_SIG);
+ il.append(new INVOKEINTERFACE(reset,1));
+ }
+
}
}
1.3 +3 -1 xml-xalan/java/src/org/apache/xalan/xsltc/compiler/PositionCall.java
Index: PositionCall.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/PositionCall.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PositionCall.java 2001/08/27 09:07:19 1.2
+++ PositionCall.java 2001/09/19 17:54:15 1.3
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: PositionCall.java,v 1.2 2001/08/27 09:07:19 morten Exp $
+ * @(#)$Id: PositionCall.java,v 1.3 2001/09/19 17:54:15 morten Exp $
*
* The Apache Software License, Version 1.1
*
@@ -67,6 +67,7 @@
import org.apache.xalan.xsltc.compiler.util.Type;
import de.fub.bytecode.generic.*;
import org.apache.xalan.xsltc.compiler.util.*;
+import org.apache.xalan.xsltc.DOM;
final class PositionCall extends FunctionCall {
@@ -91,6 +92,7 @@
if (getParent().getParent() instanceof Predicate) {
Predicate pred = (Predicate)getParent().getParent();
_type = pred.getPosType();
+ if ((_type==DOM.ELEMENT) || (_type==DOM.ATTRIBUTE)) _type = -1;
}
}
1.13 +4 -5 xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Predicate.java
Index: Predicate.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Predicate.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- Predicate.java 2001/09/19 11:50:31 1.12
+++ Predicate.java 2001/09/19 17:54:15 1.13
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: Predicate.java,v 1.12 2001/09/19 11:50:31 morten Exp $
+ * @(#)$Id: Predicate.java,v 1.13 2001/09/19 17:54:15 morten Exp $
*
* The Apache Software License, Version 1.1
*
@@ -187,13 +187,13 @@
if ((_exp instanceof LastCall) ||
(getParent() instanceof Pattern) ||
(getParent() instanceof FilterExpr)) {
+
final QName position = getParser().getQName("position");
- final PositionCall positionCall;
- positionCall = new PositionCall(position, -1);
+ final PositionCall positionCall = new PositionCall(position);
positionCall.setParser(getParser());
positionCall.setParent(this);
- _exp = new EqualityExpr(EqualityExpr.EQ, positionCall, _exp);
+ _exp = new EqualityExpr(EqualityExpr.EQ, positionCall, _exp);
if (_exp.typeCheck(stable) != Type.Boolean) {
_exp = new CastExpr(_exp, Type.Boolean);
}
@@ -220,7 +220,6 @@
else if (texp instanceof BooleanType == false) {
_exp = new CastExpr(_exp, Type.Boolean);
}
-
_nthPositionFilter = false;
return _type = Type.Boolean;
1.2 +2 -1 xml-xalan/java/src/org/apache/xalan/xsltc/compiler/RoundCall.java
Index: RoundCall.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/RoundCall.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- RoundCall.java 2001/04/17 18:51:46 1.1
+++ RoundCall.java 2001/09/19 17:54:15 1.2
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: RoundCall.java,v 1.1 2001/04/17 18:51:46 sboag Exp $
+ * @(#)$Id: RoundCall.java,v 1.2 2001/09/19 17:54:15 morten Exp $
*
* The Apache Software License, Version 1.1
*
@@ -68,6 +68,7 @@
import org.apache.xalan.xsltc.compiler.util.*;
final class RoundCall extends FunctionCall {
+
public RoundCall(QName fname, Vector arguments) {
super(fname, arguments);
}
1.4 +2 -2 xml-xalan/java/src/org/apache/xalan/xsltc/compiler/VariableRefBase.java
Index: VariableRefBase.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/VariableRefBase.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- VariableRefBase.java 2001/08/23 14:07:05 1.3
+++ VariableRefBase.java 2001/09/19 17:54:15 1.4
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: VariableRefBase.java,v 1.3 2001/08/23 14:07:05 tmiller Exp $
+ * @(#)$Id: VariableRefBase.java,v 1.4 2001/09/19 17:54:15 morten Exp $
*
* The Apache Software License, Version 1.1
*
@@ -97,7 +97,7 @@
* @return Variable reference description
*/
public String toString() {
- return "variable-ref(" + _variable.getName() + ')';
+ return "variable-ref("+_variable.getName()+'/'+_variable.getType()+')';
}
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org