morten      01/06/12 02:26:48

  Modified:    java/src/org/apache/xalan/xsltc/compiler LogicalExpr.java
  Log:
  Fix for bug 1511. Predicates on the format ((a or b) and c) are not
  handled correctly. I added a small piece of code to direct the true-list
  of the OR expression to the beginning of the AND test.
  PR:           Bugzilla 1511
  Obtained from:        n/a
  Submitted by: [EMAIL PROTECTED]
  Reviewed by:  [EMAIL PROTECTED]
  
  Revision  Changes    Path
  1.3       +16 -2     
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/LogicalExpr.java
  
  Index: LogicalExpr.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/LogicalExpr.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- LogicalExpr.java  2001/06/06 10:45:12     1.2
  +++ LogicalExpr.java  2001/06/12 09:26:46     1.3
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: LogicalExpr.java,v 1.2 2001/06/06 10:45:12 morten Exp $
  + * @(#)$Id: LogicalExpr.java,v 1.3 2001/06/12 09:26:46 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -58,6 +58,7 @@
    *
    * @author Jacek Ambroziak
    * @author Santiago Pericas-Geertsen
  + * @author Morten Jorgensen
    *
    */
   
  @@ -128,17 +129,30 @@
       public void translateDesynthesized(ClassGenerator classGen,
                                       MethodGenerator methodGen) {
        final InstructionList il = methodGen.getInstructionList();
  +     final SyntaxTreeNode parent = getParent();
        if (_op == AND) {
            _left.translateDesynthesized(classGen, methodGen);
            if ((_left instanceof FunctionCall) &&
                (!(_left instanceof ContainsCall)))
                _falseList.add(il.append(new IFEQ(null)));
  +         InstructionHandle middle = il.append(NOP);
            _right.translateDesynthesized(classGen, methodGen);
            if ((_right instanceof FunctionCall) &&
                (!(_right instanceof ContainsCall)))
                _falseList.add(il.append(new IFEQ(null)));
  -         _trueList.append(_right._trueList.append(_left._trueList));
            _falseList.append(_right._falseList.append(_left._falseList));
  +
  +         // Special case for ((a OR b) and c)
  +         if (_left instanceof LogicalExpr) {
  +             LogicalExpr left = (LogicalExpr)_left;
  +             if (left.getOp() == OR) {
  +                 left.backPatchTrueList(middle);
  +                 _trueList.append(_right._trueList);
  +                 return; 
  +             }
  +         }
  +
  +         _trueList.append(_right._trueList.append(_left._trueList));
        } 
        else {          // _op == OR
            _left.translateDesynthesized(classGen, methodGen);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to