3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-03 01:50:07 +01:00

Set ES6 compat flag for Rhino

(cherry picked from commit 849a515d4a5c02c083e5ab343db40d7eb05b2f51)
Dieser Commit ist enthalten in:
Octavia Togami 2020-06-21 18:55:29 -07:00 committet von MattBDev
Ursprung 852abce989
Commit c0bfe06e4b

Datei anzeigen

@ -35,6 +35,14 @@ public class RhinoContextFactory extends ContextFactory {
@Override @Override
protected Context makeContext() { protected Context makeContext() {
RhinoContext cx = new RhinoContext(this); RhinoContext cx = new RhinoContext(this);
try {
// Try to set ES6 compat flag (since 1.7.7)
Context.class.getDeclaredField("VERSION_ES6");
cx.setLanguageVersion(RhinoContext.VERSION_ES6);
} catch (NoSuchFieldException e) {
// best we can do, compatible with 1.7R2 that many people probably use
cx.setLanguageVersion(Context.VERSION_1_7);
}
cx.setInstructionObserverThreshold(10000); cx.setInstructionObserverThreshold(10000);
return cx; return cx;
} }