Exemplo n.º 1
0
  private void leave_file() {
    SVPreProc2InputData old_file = fInputCurr;

    // Clean up (if needed) after the macro stack
    // Only cleanup after leaving a file where file content (not expanded macro content)
    // was present
    if (fInputCurr.incPos()) {
      cleanup_preproc_leftovers();
    }

    fInputCurr.leave_file();

    if (fIndexStats != null) {
      // Update stats
      if (old_file.getInput() instanceof SVFileBuffer) {
        fIndexStats.incLastIndexFileReadTime(((SVFileBuffer) old_file.getInput()).getReadTime());
      }
      fIndexStats.incNumLines(old_file.getLineCount());
      fIndexStats.incNumProcessedFiles();
    }

    /*SVPreProc2InputData curr_in =*/ fInputStack.pop();

    SVPreProc2InputData new_file = fInputStack.peek();
    fInputCurr = new_file;

    int file_idx = fFileList.indexOf(new_file.getFileName());

    // We will not have registered ANONYMOUS files
    if (file_idx != -1) {
      int file_id = 0;

      if (fFileMapper != null) {
        file_id = fFileMapper.mapFilePathToId(new_file.getFileName(), true);
      }

      // Add a marker noting that we're switching to a new file
      SVPreProcOutput.FileChangeInfo file_info =
          new SVPreProcOutput.FileChangeInfo(fOutputLen, file_id, new_file.getLineNo());
      fFileMap.add(file_info);
    }
  }