@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()); }
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()); }