private RuntimeException codeBug() throws RuntimeException { throw Kit.codeBug("ts.cursor=" + ts.cursor + ", ts.tokenBeg=" + ts.tokenBeg + ", currentToken=" + currentToken); } }
/** * Called when a Context is destroyed. */ public void contextReleased(Context cx) { if (type != IPROXY_LISTEN) Kit.codeBug(); }
/** * @see Kit#codeBug */ public static RuntimeException codeBug() throws RuntimeException { throw Kit.codeBug(); }
private void ungetChar(int c) { // can not unread past across line boundary if (ungetCursor != 0 && ungetBuffer[ungetCursor - 1] == '\n') Kit.codeBug(); ungetBuffer[ungetCursor++] = c; cursor--; }
/** * Exit action. */ public void run() { if (type != EXIT_ACTION) Kit.codeBug(); System.exit(0); }
public void quit(Context cx, int exitCode) { if (type == SYSTEM_EXIT) { System.exit(exitCode); return; } throw Kit.codeBug(); } }
private String sourceToString(int offset) { if (offset < 0 || sourceTop < offset) Kit.codeBug(); return new String(sourceBuffer, offset, sourceTop - offset); }
/** * Set object value of the key. * If key does not exist, also set its int value to 0. */ public void put(int key, Object value) { if (key < 0) Kit.codeBug(); int index = ensureIndex(key, false); if (values == null) { values = new Object[1 << power]; } values[index] = value; }
private static int addIndex(byte[] array, int pc, int index) { if (index < 0) throw Kit.codeBug(); if (index > 0xFFFF) throw Context.reportRuntimeError("Too complex regexp"); array[pc] = (byte)(index >> 8); array[pc + 1] = (byte)(index); return pc + 2; }
/** * Returns a StackFrame for the given function or script. */ public DebugFrame getFrame(Context cx, DebuggableScript fnOrScript) { if (type != IPROXY_DEBUG) Kit.codeBug(); FunctionSource item = dim.getFunctionSource(fnOrScript); if (item == null) { // Can not debug if source is not available return null; } return new StackFrame(cx, dim, item); }
private void resolveForwardGoto(int fromPC) { // Ensure that forward jump skips at least self bytecode if (iCodeTop < fromPC + 3) throw Kit.codeBug(); resolveGoto(fromPC, iCodeTop); }
public final int labelId() { if (type != Token.TARGET && type != Token.YIELD) Kit.codeBug(); return getIntProp(LABEL_ID_PROP, -1); }
private void addUint8(int value) { if ((value & ~0xFF) != 0) throw Kit.codeBug(); byte[] array = itsData.itsICode; int top = iCodeTop; if (top == array.length) { array = increaseICodeCapacity(1); } array[top] = (byte)value; iCodeTop = top + 1; }
Scriptable[] createRegExpWraps(Context cx, Scriptable scope) { if (idata.itsRegExpLiterals == null) Kit.codeBug(); RegExpProxy rep = ScriptRuntime.checkRegExpProxy(cx); int N = idata.itsRegExpLiterals.length; Scriptable[] array = new Scriptable[N]; for (int i = 0; i != N; ++i) { array[i] = rep.wrapRegExp(cx, scope, idata.itsRegExpLiterals[i]); } return array; }
private void addIcode(int icode) { if (!Icode.validIcode(icode)) throw Kit.codeBug(); // Write negative icode as uint8 bits addUint8(icode & 0xFF); }
public void defineConst(String name, Scriptable start) { if (putImpl(name, 0, start, Undefined.instance, UNINITIALIZED_CONST)) return; if (start == this) throw Kit.codeBug(); if (start instanceof ConstProperties) ((ConstProperties)start).defineConst(name, start); } /**
private Node createUseLocal(Node localBlock) { if (Token.LOCAL_BLOCK != localBlock.getType()) throw Kit.codeBug(); Node result = new Node(Token.LOCAL_LOAD); result.putProp(Node.LOCAL_BLOCK_PROP, localBlock); return result; }