Package org.rascalmpl.interpreter

Examples of org.rascalmpl.interpreter.StackTrace$UnmodifiableStackTrace


    String content = e.getLocation().toString()
        + ": "
        + lros.getBuffer().toString()
        + "\n";
   
    StackTrace trace = e.getTrace();
    if (trace != null) {
      content += trace.toLinkedString() + '\n';
    }
    return content;
  }
View Full Code Here


      Throwable targetException = e.getTargetException();
     
      if (targetException instanceof Throw) {
        Throw th = (Throw) targetException;
       
        StackTrace trace = new StackTrace();
        trace.addAll(th.getTrace());
       
        ISourceLocation loc = th.getLocation();
        if (loc == null) {
          loc = getAst().getLocation();
        }
        trace.add(loc, null);

        th.setLocation(loc);
        trace.addAll(eval.getStackTrace());
        th.setTrace(trace.freeze());
        throw th;
      }
      else if (targetException instanceof StaticError) {
        throw (StaticError) targetException;
      }
View Full Code Here

 
  public static Throw javaException(Throwable targetException, AbstractAST ast, StackTrace rascalTrace) throws ImplementationError {
    try {
      String clazz = targetException.getClass().getSimpleName();
      String msg = targetException.getMessage();
      StackTrace trace = buildTrace(targetException, rascalTrace);
      Throwable cause = targetException.getCause();

      if (cause != null && cause != targetException) {
        Throw throwCause = cause instanceof Throw ? (Throw) cause : javaException(cause, ast, rascalTrace);
        return javaException(clazz, msg != null ? msg : "", throwCause.getException(), ast, trace);
View Full Code Here

    return VF.sourceLocation(uri, offset, length, beginLine, endLine, beginCol, endCol);
    }

  private static StackTrace buildTrace(Throwable targetException, StackTrace rascalTrace) throws IOException {
    StackTraceElement[] stackTrace = targetException.getStackTrace();
    StackTrace newTrace = new StackTrace();
    for (StackTraceElement elem : stackTrace) {
      if (elem.getMethodName().equals("invoke")) {
        break;
      }
      newTrace.add(robustSourceLocation(elem.getFileName(), 0, 0, elem.getLineNumber(), elem.getLineNumber(), 0, 0), elem.getClassName() + "." + elem.getMethodName());
    }
    newTrace.addAll(rascalTrace);
    return newTrace.freeze();
  }
View Full Code Here

TOP

Related Classes of org.rascalmpl.interpreter.StackTrace$UnmodifiableStackTrace

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.