Esempio n. 1
0
 /**
  * Gibt das uebergeordnete CFXD Tag Element zurueck, falls dies nicht existiert wird null
  * zurueckgegeben.
  *
  * @param el Element von dem das parent Element zurueckgegeben werden soll.
  * @return uebergeordnete CFXD Tag Element
  */
 public static Tag getParentTag(Tag tag) {
   Statement p = tag.getParent();
   if (p == null) return null;
   p = p.getParent();
   if (p instanceof Tag) return (Tag) p;
   return null;
 }
Esempio n. 2
0
  public static boolean isCFC(Statement s) {
    Statement p;
    while ((p = s.getParent()) != null) {
      s = p;
    }

    return true;
  }
Esempio n. 3
0
 public static Statement getRoot(Statement stat) {
   while (true) {
     if (isRoot(stat)) {
       return stat;
     }
     stat = stat.getParent();
   }
 }
Esempio n. 4
0
 public static Page getAncestorPage(Statement stat, Page defaultValue) {
   Statement parent = stat;
   while (true) {
     parent = parent.getParent();
     if (parent == null) {
       return defaultValue;
     }
     if (parent instanceof Page) return (Page) parent;
   }
 }
Esempio n. 5
0
 public static void listAncestor(Statement stat) {
   Statement parent = stat;
   aprint.o(stat);
   while (true) {
     parent = parent.getParent();
     if (parent instanceof Page)
       aprint.o("page-> " + ((Page) parent).getPageSource().getDisplayPath());
     else aprint.o("parent-> " + parent);
     if (parent == null) break;
   }
 }
Esempio n. 6
0
 public static Page getAncestorPage(Statement stat) throws BytecodeException {
   Statement parent = stat;
   while (true) {
     parent = parent.getParent();
     if (parent == null) {
       throw new BytecodeException("missing parent Statement of Statement", stat.getStart());
       // return null;
     }
     if (parent instanceof Page) return (Page) parent;
   }
 }
Esempio n. 7
0
 /**
  * Gibt ein uebergeordnetes Tag mit dem uebergebenen Full-Name (Namespace und Name) zurueck, falls
  * ein solches existiert, andernfalls wird null zurueckgegeben.
  *
  * @param el Startelement, von wo aus gesucht werden soll.
  * @param fullName Name des gesuchten Tags.
  * @return uebergeornetes Element oder null.
  */
 public static Tag getAncestorTag(Tag tag, String fullName) {
   Statement parent = tag;
   while (true) {
     parent = parent.getParent();
     if (parent == null) return null;
     if (parent instanceof Tag) {
       tag = (Tag) parent;
       if (tag.getFullname().equalsIgnoreCase(fullName)) return tag;
     }
   }
 }
Esempio n. 8
0
  public static Statement getAncestorTryStatement(Statement stat) {
    Statement parent = stat;
    while (true) {
      parent = parent.getParent();
      if (parent == null) return null;

      if (parent instanceof TagTry) {
        return parent;
      } else if (parent instanceof TryCatchFinally) {
        return parent;
      }
    }
  }
Esempio n. 9
0
 public static Tag getAncestorComponent(Statement stat) throws BytecodeException {
   // print.ln("getAncestorPage:"+stat);
   Statement parent = stat;
   while (true) {
     parent = parent.getParent();
     // print.ln(" - "+parent);
     if (parent == null) {
       throw new BytecodeException("missing parent Statement of Statement", stat.getStart());
       // return null;
     }
     if (parent instanceof TagComponent)
       // if(parent instanceof Tag && "component".equals(((Tag)parent).getTagLibTag().getName()))
       return (Tag) parent;
   }
 }
Esempio n. 10
0
  private static FlowControl getAncestorFCStatement(
      Statement stat, List<FlowControlFinal> finallyLabels, int flowType, String label) {
    Statement parent = stat;
    FlowControlFinal fcf;
    while (true) {
      parent = parent.getParent();
      if (parent == null) return null;
      if (((flowType == FlowControl.RETRY && parent instanceof FlowControlRetry)
              || (flowType == FlowControl.CONTINUE && parent instanceof FlowControlContinue)
              || (flowType == FlowControl.BREAK && parent instanceof FlowControlBreak))
          && labelMatch((FlowControl) parent, label)) {
        if (parent instanceof ScriptBody) {
          List<FlowControlFinal> _finallyLabels =
              finallyLabels == null ? null : new ArrayList<FlowControlFinal>();

          FlowControl scriptBodyParent =
              getAncestorFCStatement(parent, _finallyLabels, flowType, label);
          if (scriptBodyParent != null) {
            if (finallyLabels != null) {
              Iterator<FlowControlFinal> it = _finallyLabels.iterator();
              while (it.hasNext()) {
                finallyLabels.add(it.next());
              }
            }
            return scriptBodyParent;
          }
          return (FlowControl) parent;
        }
        return (FlowControl) parent;
      }

      // only if not last
      if (finallyLabels != null) {
        fcf = parent.getFlowControlFinal();
        if (fcf != null) {
          finallyLabels.add(fcf);
        }
      }
    }
  }