コード例 #1
0
  @Nullable
  public static GeneratedSourcePosition fromNode(final SNode node) {
    SModel model = node.getModel().getModelDescriptor();
    DebugInfo debugInfo = TraceInfoCache.getInstance().get(model);
    if (debugInfo == null) {
      return null;
    }
    TraceablePositionInfo position = debugInfo.getPositionForNode(node);
    if (position == null) return null;

    return new GeneratedSourcePosition(
        TraceInfoUtil.getUnitName(position.getFileName(), position.getStartLine(), model),
        position.getFileName(),
        position.getStartLine());
  }
コード例 #2
0
  private TraceablePositionInfo getTargetCodePosition(SNodePointer nodePointer) {
    SModelDescriptor model = nodePointer.getModel();
    if (model == null) return null;
    DebugInfo debugInfo = TraceInfoCache.getInstance().get(model);
    if (debugInfo == null) {
      return null;
    }

    // RE-2693
    TraceablePositionInfo positionForNode =
        debugInfo.getPositionForNode(nodePointer.getNodeId().toString());
    if (positionForNode != null) {
      return positionForNode;
    }

    TraceInfoCache.getInstance().clearCacheFor(model);
    debugInfo = TraceInfoCache.getInstance().get(model);
    if (debugInfo == null) {
      return null;
    }
    return debugInfo.getPositionForNode(nodePointer.getNodeId().toString());
  }