ES6 Support Groundwork + Fixes (OLD ONE DON'T LOOK AT ME!!!) #22

Merged
TopchetoEU merged 49 commits from ES6 into master 2024-09-05 14:17:52 +00:00
Showing only changes of commit 5359c54694 - Show all commits

View File

@ -8,17 +8,22 @@ import me.topchetoeu.jscript.compilation.CompileResult;
import me.topchetoeu.jscript.compilation.JavaScript;
import me.topchetoeu.jscript.runtime.debug.DebugContext;
import me.topchetoeu.jscript.runtime.exceptions.EngineException;
import me.topchetoeu.jscript.runtime.exceptions.SyntaxException;
import me.topchetoeu.jscript.runtime.values.Value;
import me.topchetoeu.jscript.runtime.values.functions.CodeFunction;
public interface Compiler {
public static final Compiler DEFAULT = (env, filename, raw) -> {
try {
var res = JavaScript.compile(env, filename, raw);
var body = res.body();
DebugContext.get(env).onSource(filename, raw);
registerFunc(env, body, res);
return body;
}
catch (SyntaxException e) {
throw EngineException.ofSyntax(e.loc + ": " + e.msg);
}
};
public Key<Compiler> KEY = Key.of();