morten 01/06/27 07:34:01
Modified: java/src/org/apache/xalan/xsltc/compiler Predicate.java
Log:
This update allows variables that contain references to result-tree fragments
to be used inside position filters.
PR: n/a
Obtained from: n/a
Submitted by: [EMAIL PROTECTED]
Reviewed by: [EMAIL PROTECTED]
Revision Changes Path
1.4 +13 -3
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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Predicate.java 2001/06/17 12:23:30 1.3
+++ Predicate.java 2001/06/27 14:34:01 1.4
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: Predicate.java,v 1.3 2001/06/17 12:23:30 curcuru Exp $
+ * @(#)$Id: Predicate.java,v 1.4 2001/06/27 14:34:01 morten Exp $
*
* The Apache Software License, Version 1.1
*
@@ -151,15 +151,25 @@
* reference type are always converted to booleans.
*/
public Type typeCheck(SymbolTable stable) throws TypeCheckError {
+
Type texp = _exp.typeCheck(stable);
+ // We need explicit type information for reference types
if (texp instanceof ReferenceType) {
- // TODO: print a warning indicating that no expansion is
- // possible in this case due to lack of type info
throw new TypeCheckError(this);
}
+ // Result tree fragments need to be type-casted to a numerical type
+ // in cases where they are used in position filters.
+ if (texp instanceof ResultTreeType) {
+ _exp = new CastExpr(_exp, Type.String); // Costly!!!!
+ _exp = new CastExpr(_exp, Type.Real);
+ texp = _exp.typeCheck(stable);
+ }
+
+ // Numerical types will be converted to a position filter
if (texp instanceof NumberType) {
+
if (texp instanceof IntType == false) {
_exp = new CastExpr(_exp, Type.Int);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]