예제 #1
0
 private SNode getErrorLocation(_FunctionTypes._void_P0_E0 method) {
   try {
     method.invoke();
   } catch (Throwable t) {
     StackTraceElement stackTraceElement = t.getStackTrace()[0];
     SNode node =
         TraceInfoUtil.getJavaNode(
             stackTraceElement.getClassName(),
             stackTraceElement.getFileName(),
             stackTraceElement.getLineNumber());
     return node;
   }
   return null;
 }
  @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());
  }
예제 #3
0
 @Nullable
 @Override
 public SNode getNode(@NonNls String unitName, @NonNls String fileName, int position) {
   return TraceInfoUtil.getJavaNode(unitName, fileName, position);
 }
 @Nullable
 public SNode getNode() {
   return TraceInfoUtil.getJavaNode(myTypeName, myFileName, myLineNumber);
 }