Beispiel #1
0
RexxArray *RexxCode::getSource()
/******************************************************************************/
/* Function:  Extract the source from a method from the source object as an   */
/*            array of strings.                                               */
/******************************************************************************/
{
  SourceLocation   location;           /* location information              */
  SourceLocation   end_location;       /* ending location                   */
  RexxInstruction *current;            /* current instruction               */

  if (this->start == OREF_NULL)        /* empty method?                     */
    return new_array((size_t)0);       /* just return an empty array        */
  location = start->getLocation();     /* get its location info             */
  current = this->start;               /* point to the beginning            */
                                       /* while not at the last one         */
  while (current->nextInstruction != OREF_NULL) {
    current = current->nextInstruction;/* step to the next one              */
  }

  end_location = current->getLocation(); /* get the end location              */
                                       /* copy over the ending position     */
  location.setEndLine(end_location.getEndLine());
  location.setEndOffset(end_location.getEndOffset());
                                       /* go extract the source array       */
  return this->source->extractSource(location);
}