예제 #1
0
 /**
  * Evaluate the child with the given index of the given node. This is usually called while
  * visiting the given node.
  *
  * @exception IllegalActionException If an evaluation error occurs.
  */
 protected ptolemy.data.Token _evaluateChild(ASTPtRootNode node, int i)
     throws IllegalActionException {
   ASTPtRootNode child = (ASTPtRootNode) node.jjtGetChild(i);
   _traceEnter(child);
   child.visit(this);
   _traceLeave(child);
   return _evaluatedChildToken;
 }
예제 #2
0
  /**
   * Loop through all of the children of this node, visiting each one of them; this will cause their
   * token value to be determined.
   *
   * @param node The node whose children are evaluated.
   * @exception IllegalActionException If an evaluation error occurs.
   */
  protected ptolemy.data.Token[] _evaluateAllChildren(ASTPtRootNode node)
      throws IllegalActionException {
    int numChildren = node.jjtGetNumChildren();
    ptolemy.data.Token[] tokens = new ptolemy.data.Token[numChildren];

    for (int i = 0; i < numChildren; i++) {
      /* ASTPtRootNode child = (ASTPtRootNode) */ node.jjtGetChild(i);
      tokens[i] = _evaluateChild(node, i);
    }

    return tokens;
  }
  /**
   * Loop through all of the children of this node, visiting each one of them, which will cause
   * their token value to be determined.
   */
  protected Type[] _inferAllChildren(ASTPtRootNode node) throws IllegalActionException {
    Type[] types = new Type[node.jjtGetNumChildren()];
    int numChildren = node.jjtGetNumChildren();

    for (int i = 0; i < numChildren; i++) {
      _inferChild(node, i);

      Type type = _inferredChildType;

      if (type == null) {
        throw new RuntimeException("node " + node.jjtGetChild(i) + " has no type.");
      }

      types[i] = type;
    }

    return types;
  }
 /**
  * Visit the child with the given index of the given node. This is usually called while visiting
  * the given node.
  */
 protected Type _inferChild(ASTPtRootNode node, int i) throws IllegalActionException {
   ASTPtRootNode child = (ASTPtRootNode) node.jjtGetChild(i);
   child.visit(this);
   return _inferredChildType;
 }