src/jdk/nashorn/internal/runtime/ListAdapter.java

Print this page

        

*** 32,41 **** --- 32,42 ---- import java.util.NoSuchElementException; import java.util.RandomAccess; import java.util.concurrent.Callable; import jdk.nashorn.api.scripting.JSObject; import jdk.nashorn.api.scripting.ScriptObjectMirror; + import jdk.nashorn.internal.objects.Global; import jdk.nashorn.internal.runtime.linker.Bootstrap; import jdk.nashorn.internal.runtime.linker.InvokeByName; /** * An adapter that can wrap any ECMAScript Array-like object (that adheres to the array rules for the property
*** 52,73 **** */ public abstract class ListAdapter extends AbstractList<Object> implements RandomAccess, Deque<Object> { // These add to the back and front of the list private static final Object PUSH = new Object(); private static InvokeByName getPUSH() { ! return ((GlobalObject)Context.getGlobal()).getInvokeByName(PUSH, new Callable<InvokeByName>() { @Override public InvokeByName call() { return new InvokeByName("push", Object.class, void.class, Object.class); } }); } private static final Object UNSHIFT = new Object(); private static InvokeByName getUNSHIFT() { ! return ((GlobalObject)Context.getGlobal()).getInvokeByName(UNSHIFT, new Callable<InvokeByName>() { @Override public InvokeByName call() { return new InvokeByName("unshift", Object.class, void.class, Object.class); } --- 53,74 ---- */ public abstract class ListAdapter extends AbstractList<Object> implements RandomAccess, Deque<Object> { // These add to the back and front of the list private static final Object PUSH = new Object(); private static InvokeByName getPUSH() { ! return Context.getGlobal().getInvokeByName(PUSH, new Callable<InvokeByName>() { @Override public InvokeByName call() { return new InvokeByName("push", Object.class, void.class, Object.class); } }); } private static final Object UNSHIFT = new Object(); private static InvokeByName getUNSHIFT() { ! return Context.getGlobal().getInvokeByName(UNSHIFT, new Callable<InvokeByName>() { @Override public InvokeByName call() { return new InvokeByName("unshift", Object.class, void.class, Object.class); }
*** 75,96 **** } // These remove from the back and front of the list private static final Object POP = new Object(); private static InvokeByName getPOP() { ! return ((GlobalObject)Context.getGlobal()).getInvokeByName(POP, new Callable<InvokeByName>() { @Override public InvokeByName call() { return new InvokeByName("pop", Object.class, Object.class); } }); } private static final Object SHIFT = new Object(); private static InvokeByName getSHIFT() { ! return ((GlobalObject)Context.getGlobal()).getInvokeByName(SHIFT, new Callable<InvokeByName>() { @Override public InvokeByName call() { return new InvokeByName("shift", Object.class, Object.class); } --- 76,97 ---- } // These remove from the back and front of the list private static final Object POP = new Object(); private static InvokeByName getPOP() { ! return Context.getGlobal().getInvokeByName(POP, new Callable<InvokeByName>() { @Override public InvokeByName call() { return new InvokeByName("pop", Object.class, Object.class); } }); } private static final Object SHIFT = new Object(); private static InvokeByName getSHIFT() { ! return Context.getGlobal().getInvokeByName(SHIFT, new Callable<InvokeByName>() { @Override public InvokeByName call() { return new InvokeByName("shift", Object.class, Object.class); }
*** 98,119 **** } // These insert and remove in the middle of the list private static final Object SPLICE_ADD = new Object(); private static InvokeByName getSPLICE_ADD() { ! return ((GlobalObject)Context.getGlobal()).getInvokeByName(SPLICE_ADD, new Callable<InvokeByName>() { @Override public InvokeByName call() { return new InvokeByName("splice", Object.class, void.class, int.class, int.class, Object.class); } }); } private static final Object SPLICE_REMOVE = new Object(); private static InvokeByName getSPLICE_REMOVE() { ! return ((GlobalObject)Context.getGlobal()).getInvokeByName(SPLICE_REMOVE, new Callable<InvokeByName>() { @Override public InvokeByName call() { return new InvokeByName("splice", Object.class, void.class, int.class, int.class); } --- 99,120 ---- } // These insert and remove in the middle of the list private static final Object SPLICE_ADD = new Object(); private static InvokeByName getSPLICE_ADD() { ! return Context.getGlobal().getInvokeByName(SPLICE_ADD, new Callable<InvokeByName>() { @Override public InvokeByName call() { return new InvokeByName("splice", Object.class, void.class, int.class, int.class, Object.class); } }); } private static final Object SPLICE_REMOVE = new Object(); private static InvokeByName getSPLICE_REMOVE() { ! return Context.getGlobal().getInvokeByName(SPLICE_REMOVE, new Callable<InvokeByName>() { @Override public InvokeByName call() { return new InvokeByName("splice", Object.class, void.class, int.class, int.class); }