mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 01:37:37 +00:00
Set ES6 compat flag for Rhino
(cherry picked from commit 849a515d4a5c02c083e5ab343db40d7eb05b2f51)
This commit is contained in:
parent
852abce989
commit
c0bfe06e4b
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user