mirror of
https://github.com/cincheo/jsweet.git
synced 2025-12-15 07:19:22 +00:00
added stack and generic get to js error
This commit is contained in:
parent
c4aa537a22
commit
31ef499237
@ -3,6 +3,10 @@ package def.js;
|
||||
public class Error extends RuntimeException {
|
||||
public java.lang.String name;
|
||||
public java.lang.String message;
|
||||
|
||||
public java.lang.String stack;
|
||||
public native <T> T $get(String key);
|
||||
|
||||
public Error(java.lang.String message){}
|
||||
native public static Error applyStatic(java.lang.String message);
|
||||
public static final Error prototype=null;
|
||||
|
||||
@ -3,6 +3,10 @@ package def.js;
|
||||
public class Error extends RuntimeException {
|
||||
public java.lang.String name;
|
||||
public java.lang.String message;
|
||||
|
||||
public java.lang.String stack;
|
||||
public native <T> T $get(String key);
|
||||
|
||||
public Error(java.lang.String message){}
|
||||
native public static Error applyStatic(java.lang.String message);
|
||||
public static Error prototype;
|
||||
|
||||
@ -727,22 +727,40 @@ public class JSweetTranspiler implements JSweetOptions {
|
||||
}
|
||||
}
|
||||
|
||||
public List<JCCompilationUnit> setupCompiler(java.util.List<File> files,
|
||||
protected List<JCCompilationUnit> setupCompiler(java.util.List<File> files,
|
||||
ErrorCountTranspilationHandler transpilationHandler) throws IOException {
|
||||
initJavac(transpilationHandler);
|
||||
List<JavaFileObject> fileObjects = toJavaFileObjects(fileManager, files);
|
||||
|
||||
logger.info("parsing: " + fileObjects);
|
||||
try {
|
||||
compiler.compile(fileObjects);
|
||||
} catch (Throwable e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
logger.info("ENTER phase: " + fileObjects);
|
||||
transpilationHandler.setDisabled(isIgnoreJavaErrors());
|
||||
List<JCCompilationUnit> compilationUnits = compiler.enterTrees(compiler.parseFiles(fileObjects));
|
||||
context.compilationUnits = compilationUnits.toArray(new JCCompilationUnit[compilationUnits.size()]);
|
||||
if (transpilationHandler.getErrorCount() > 0) {
|
||||
logger.warn("errors during parse tree");
|
||||
return null;
|
||||
}
|
||||
logger.info("attribution phase");
|
||||
logger.info("ATTRIBUTE phase");
|
||||
compiler.attribute(compiler.todo);
|
||||
|
||||
transpilationHandler.setDisabled(false);
|
||||
logger.info("FLOW phase");
|
||||
compiler.flow(compiler.todo);
|
||||
|
||||
compiler.processAnnotations(compilationUnits);
|
||||
|
||||
logger.info("DESUGAR phase");
|
||||
compiler.desugar(compiler.todo);
|
||||
|
||||
|
||||
context.compilationUnits = compilationUnits.toArray(new JCCompilationUnit[compilationUnits.size()]);
|
||||
// logger.info("DESUGAR phase");
|
||||
// compiler.desugar(compiler.todo);
|
||||
|
||||
if (transpilationHandler.getErrorCount() > 0) {
|
||||
return null;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user