mirror of
https://github.com/cincheo/jsweet.git
synced 2025-12-15 15:29: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 class Error extends RuntimeException {
|
||||||
public java.lang.String name;
|
public java.lang.String name;
|
||||||
public java.lang.String message;
|
public java.lang.String message;
|
||||||
|
|
||||||
|
public java.lang.String stack;
|
||||||
|
public native <T> T $get(String key);
|
||||||
|
|
||||||
public Error(java.lang.String message){}
|
public Error(java.lang.String message){}
|
||||||
native public static Error applyStatic(java.lang.String message);
|
native public static Error applyStatic(java.lang.String message);
|
||||||
public static final Error prototype=null;
|
public static final Error prototype=null;
|
||||||
|
|||||||
@ -3,6 +3,10 @@ package def.js;
|
|||||||
public class Error extends RuntimeException {
|
public class Error extends RuntimeException {
|
||||||
public java.lang.String name;
|
public java.lang.String name;
|
||||||
public java.lang.String message;
|
public java.lang.String message;
|
||||||
|
|
||||||
|
public java.lang.String stack;
|
||||||
|
public native <T> T $get(String key);
|
||||||
|
|
||||||
public Error(java.lang.String message){}
|
public Error(java.lang.String message){}
|
||||||
native public static Error applyStatic(java.lang.String message);
|
native public static Error applyStatic(java.lang.String message);
|
||||||
public static Error prototype;
|
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 {
|
ErrorCountTranspilationHandler transpilationHandler) throws IOException {
|
||||||
initJavac(transpilationHandler);
|
initJavac(transpilationHandler);
|
||||||
List<JavaFileObject> fileObjects = toJavaFileObjects(fileManager, files);
|
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());
|
transpilationHandler.setDisabled(isIgnoreJavaErrors());
|
||||||
List<JCCompilationUnit> compilationUnits = compiler.enterTrees(compiler.parseFiles(fileObjects));
|
List<JCCompilationUnit> compilationUnits = compiler.enterTrees(compiler.parseFiles(fileObjects));
|
||||||
context.compilationUnits = compilationUnits.toArray(new JCCompilationUnit[compilationUnits.size()]);
|
|
||||||
if (transpilationHandler.getErrorCount() > 0) {
|
if (transpilationHandler.getErrorCount() > 0) {
|
||||||
logger.warn("errors during parse tree");
|
logger.warn("errors during parse tree");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
logger.info("attribution phase");
|
logger.info("ATTRIBUTE phase");
|
||||||
compiler.attribute(compiler.todo);
|
compiler.attribute(compiler.todo);
|
||||||
|
|
||||||
transpilationHandler.setDisabled(false);
|
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) {
|
if (transpilationHandler.getErrorCount() > 0) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user