id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
21,400
mozilla/rhino
src/org/mozilla/javascript/ast/AstNode.java
AstNode.operatorToString
public static String operatorToString(int op) { String result = operatorNames.get(op); if (result == null) throw new IllegalArgumentException("Invalid operator: " + op); return result; }
java
public static String operatorToString(int op) { String result = operatorNames.get(op); if (result == null) throw new IllegalArgumentException("Invalid operator: " + op); return result; }
[ "public", "static", "String", "operatorToString", "(", "int", "op", ")", "{", "String", "result", "=", "operatorNames", ".", "get", "(", "op", ")", ";", "if", "(", "result", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"Invalid opera...
Returns the string name for this operator. @param op the token type, e.g. {@link Token#ADD} or {@link Token#TYPEOF} @return the source operator string, such as "+" or "typeof"
[ "Returns", "the", "string", "name", "for", "this", "operator", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ast/AstNode.java#L345-L350
21,401
mozilla/rhino
src/org/mozilla/javascript/ast/AstNode.java
AstNode.debugPrint
public String debugPrint() { DebugPrintVisitor dpv = new DebugPrintVisitor(new StringBuilder(1000)); visit(dpv); return dpv.toString(); }
java
public String debugPrint() { DebugPrintVisitor dpv = new DebugPrintVisitor(new StringBuilder(1000)); visit(dpv); return dpv.toString(); }
[ "public", "String", "debugPrint", "(", ")", "{", "DebugPrintVisitor", "dpv", "=", "new", "DebugPrintVisitor", "(", "new", "StringBuilder", "(", "1000", ")", ")", ";", "visit", "(", "dpv", ")", ";", "return", "dpv", ".", "toString", "(", ")", ";", "}" ]
Returns a debugging representation of the parse tree starting at this node. @return a very verbose indented printout of the tree. The format of each line is: abs-pos name position length [identifier]
[ "Returns", "a", "debugging", "representation", "of", "the", "parse", "tree", "starting", "at", "this", "node", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ast/AstNode.java#L619-L623
21,402
mozilla/rhino
src/org/mozilla/javascript/ast/Label.java
Label.setName
public void setName(String name) { name = name == null ? null : name.trim(); if (name == null || "".equals(name)) throw new IllegalArgumentException("invalid label name"); this.name = name; }
java
public void setName(String name) { name = name == null ? null : name.trim(); if (name == null || "".equals(name)) throw new IllegalArgumentException("invalid label name"); this.name = name; }
[ "public", "void", "setName", "(", "String", "name", ")", "{", "name", "=", "name", "==", "null", "?", "null", ":", "name", ".", "trim", "(", ")", ";", "if", "(", "name", "==", "null", "||", "\"\"", ".", "equals", "(", "name", ")", ")", "throw", ...
Sets the label text @throws IllegalArgumentException if name is {@code null} or the empty string.
[ "Sets", "the", "label", "text" ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ast/Label.java#L54-L59
21,403
mozilla/rhino
src/org/mozilla/javascript/ast/NewExpression.java
NewExpression.visit
@Override public void visit(NodeVisitor v) { if (v.visit(this)) { target.visit(v); for (AstNode arg : getArguments()) { arg.visit(v); } if (initializer != null) { initializer.visit(v); } } }
java
@Override public void visit(NodeVisitor v) { if (v.visit(this)) { target.visit(v); for (AstNode arg : getArguments()) { arg.visit(v); } if (initializer != null) { initializer.visit(v); } } }
[ "@", "Override", "public", "void", "visit", "(", "NodeVisitor", "v", ")", "{", "if", "(", "v", ".", "visit", "(", "this", ")", ")", "{", "target", ".", "visit", "(", "v", ")", ";", "for", "(", "AstNode", "arg", ":", "getArguments", "(", ")", ")",...
Visits this node, the target, and each argument. If there is a trailing initializer node, visits that last.
[ "Visits", "this", "node", "the", "target", "and", "each", "argument", ".", "If", "there", "is", "a", "trailing", "initializer", "node", "visits", "that", "last", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ast/NewExpression.java#L87-L98
21,404
mozilla/rhino
src/org/mozilla/javascript/optimizer/ClassCompiler.java
ClassCompiler.setTargetImplements
public void setTargetImplements(Class<?>[] implementsClasses) { targetImplements = implementsClasses == null ? null : (Class[])implementsClasses.clone(); }
java
public void setTargetImplements(Class<?>[] implementsClasses) { targetImplements = implementsClasses == null ? null : (Class[])implementsClasses.clone(); }
[ "public", "void", "setTargetImplements", "(", "Class", "<", "?", ">", "[", "]", "implementsClasses", ")", "{", "targetImplements", "=", "implementsClasses", "==", "null", "?", "null", ":", "(", "Class", "[", "]", ")", "implementsClasses", ".", "clone", "(", ...
Set the interfaces that the generated target will implement. @param implementsClasses an array of Class objects, one for each interface the target will extend
[ "Set", "the", "interfaces", "that", "the", "generated", "target", "will", "implement", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/optimizer/ClassCompiler.java#L102-L105
21,405
mozilla/rhino
src/org/mozilla/javascript/ast/VariableInitializer.java
VariableInitializer.setTarget
public void setTarget(AstNode target) { // Don't throw exception if target is an "invalid" node type. // See mozilla/js/tests/js1_7/block/regress-350279.js if (target == null) throw new IllegalArgumentException("invalid target arg"); this.target = target; target.setPa...
java
public void setTarget(AstNode target) { // Don't throw exception if target is an "invalid" node type. // See mozilla/js/tests/js1_7/block/regress-350279.js if (target == null) throw new IllegalArgumentException("invalid target arg"); this.target = target; target.setPa...
[ "public", "void", "setTarget", "(", "AstNode", "target", ")", "{", "// Don't throw exception if target is an \"invalid\" node type.", "// See mozilla/js/tests/js1_7/block/regress-350279.js", "if", "(", "target", "==", "null", ")", "throw", "new", "IllegalArgumentException", "("...
Sets the variable name or destructuring form, and sets its parent to this node. @throws IllegalArgumentException if target is {@code null}
[ "Sets", "the", "variable", "name", "or", "destructuring", "form", "and", "sets", "its", "parent", "to", "this", "node", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ast/VariableInitializer.java#L75-L82
21,406
mozilla/rhino
src/org/mozilla/javascript/ast/VariableInitializer.java
VariableInitializer.visit
@Override public void visit(NodeVisitor v) { if (v.visit(this)) { target.visit(v); if (initializer != null) { initializer.visit(v); } } }
java
@Override public void visit(NodeVisitor v) { if (v.visit(this)) { target.visit(v); if (initializer != null) { initializer.visit(v); } } }
[ "@", "Override", "public", "void", "visit", "(", "NodeVisitor", "v", ")", "{", "if", "(", "v", ".", "visit", "(", "this", ")", ")", "{", "target", ".", "visit", "(", "v", ")", ";", "if", "(", "initializer", "!=", "null", ")", "{", "initializer", ...
Visits this node, then the target expression, then the initializer expression if present.
[ "Visits", "this", "node", "then", "the", "target", "expression", "then", "the", "initializer", "expression", "if", "present", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ast/VariableInitializer.java#L117-L125
21,407
mozilla/rhino
src/org/mozilla/javascript/FunctionObject.java
FunctionObject.getMethodList
static Method[] getMethodList(Class<?> clazz) { Method[] methods = null; try { // getDeclaredMethods may be rejected by the security manager // but getMethods is more expensive if (!sawSecurityException) methods = clazz.getDeclaredMethods(); } ...
java
static Method[] getMethodList(Class<?> clazz) { Method[] methods = null; try { // getDeclaredMethods may be rejected by the security manager // but getMethods is more expensive if (!sawSecurityException) methods = clazz.getDeclaredMethods(); } ...
[ "static", "Method", "[", "]", "getMethodList", "(", "Class", "<", "?", ">", "clazz", ")", "{", "Method", "[", "]", "methods", "=", "null", ";", "try", "{", "// getDeclaredMethods may be rejected by the security manager", "// but getMethods is more expensive", "if", ...
Returns all public methods declared by the specified class. This excludes inherited methods. @param clazz the class from which to pull public declared methods @return the public methods declared in the specified class @see Class#getDeclaredMethods()
[ "Returns", "all", "public", "methods", "declared", "by", "the", "specified", "class", ".", "This", "excludes", "inherited", "methods", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/FunctionObject.java#L272-L304
21,408
mozilla/rhino
toolsrc/org/mozilla/javascript/tools/debugger/treetable/JTreeTable.java
JTreeTable.setRowHeight
@Override public void setRowHeight(int rowHeight) { super.setRowHeight(rowHeight); if (tree != null && tree.getRowHeight() != rowHeight) { tree.setRowHeight(getRowHeight()); } }
java
@Override public void setRowHeight(int rowHeight) { super.setRowHeight(rowHeight); if (tree != null && tree.getRowHeight() != rowHeight) { tree.setRowHeight(getRowHeight()); } }
[ "@", "Override", "public", "void", "setRowHeight", "(", "int", "rowHeight", ")", "{", "super", ".", "setRowHeight", "(", "rowHeight", ")", ";", "if", "(", "tree", "!=", "null", "&&", "tree", ".", "getRowHeight", "(", ")", "!=", "rowHeight", ")", "{", "...
Overridden to pass the new rowHeight to the tree.
[ "Overridden", "to", "pass", "the", "new", "rowHeight", "to", "the", "tree", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/toolsrc/org/mozilla/javascript/tools/debugger/treetable/JTreeTable.java#L140-L146
21,409
mozilla/rhino
src/org/mozilla/javascript/NativeJavaObject.java
NativeJavaObject.coerceType
@Deprecated public static Object coerceType(Class<?> type, Object value) { return coerceTypeImpl(type, value); }
java
@Deprecated public static Object coerceType(Class<?> type, Object value) { return coerceTypeImpl(type, value); }
[ "@", "Deprecated", "public", "static", "Object", "coerceType", "(", "Class", "<", "?", ">", "type", ",", "Object", "value", ")", "{", "return", "coerceTypeImpl", "(", "type", ",", "value", ")", ";", "}" ]
Not intended for public use. Callers should use the public API Context.toType. @deprecated as of 1.5 Release 4 @see org.mozilla.javascript.Context#jsToJava(Object, Class)
[ "Not", "intended", "for", "public", "use", ".", "Callers", "should", "use", "the", "public", "API", "Context", ".", "toType", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/NativeJavaObject.java#L496-L500
21,410
mozilla/rhino
src/org/mozilla/javascript/ast/XmlElemRef.java
XmlElemRef.visit
@Override public void visit(NodeVisitor v) { if (v.visit(this)) { if (namespace != null) { namespace.visit(v); } indexExpr.visit(v); } }
java
@Override public void visit(NodeVisitor v) { if (v.visit(this)) { if (namespace != null) { namespace.visit(v); } indexExpr.visit(v); } }
[ "@", "Override", "public", "void", "visit", "(", "NodeVisitor", "v", ")", "{", "if", "(", "v", ".", "visit", "(", "this", ")", ")", "{", "if", "(", "namespace", "!=", "null", ")", "{", "namespace", ".", "visit", "(", "v", ")", ";", "}", "indexExp...
Visits this node, then the namespace if provided, then the index expression.
[ "Visits", "this", "node", "then", "the", "namespace", "if", "provided", "then", "the", "index", "expression", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ast/XmlElemRef.java#L129-L137
21,411
mozilla/rhino
src/org/mozilla/javascript/ast/ElementGet.java
ElementGet.visit
@Override public void visit(NodeVisitor v) { if (v.visit(this)) { target.visit(v); element.visit(v); } }
java
@Override public void visit(NodeVisitor v) { if (v.visit(this)) { target.visit(v); element.visit(v); } }
[ "@", "Override", "public", "void", "visit", "(", "NodeVisitor", "v", ")", "{", "if", "(", "v", ".", "visit", "(", "this", ")", ")", "{", "target", ".", "visit", "(", "v", ")", ";", "element", ".", "visit", "(", "v", ")", ";", "}", "}" ]
Visits this node, the target, and the index expression.
[ "Visits", "this", "node", "the", "target", "and", "the", "index", "expression", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ast/ElementGet.java#L132-L138
21,412
mozilla/rhino
src/org/mozilla/javascript/RhinoSecurityManager.java
RhinoSecurityManager.getCurrentScriptClass
protected Class<?> getCurrentScriptClass() { Class<?>[] context = getClassContext(); for (Class<?> c : context) { if (c != InterpretedFunction.class && NativeFunction.class.isAssignableFrom(c) || PolicySecurityController.SecureCaller.class.isAssignableFrom(c)) { ...
java
protected Class<?> getCurrentScriptClass() { Class<?>[] context = getClassContext(); for (Class<?> c : context) { if (c != InterpretedFunction.class && NativeFunction.class.isAssignableFrom(c) || PolicySecurityController.SecureCaller.class.isAssignableFrom(c)) { ...
[ "protected", "Class", "<", "?", ">", "getCurrentScriptClass", "(", ")", "{", "Class", "<", "?", ">", "[", "]", "context", "=", "getClassContext", "(", ")", ";", "for", "(", "Class", "<", "?", ">", "c", ":", "context", ")", "{", "if", "(", "c", "!...
Get the class of the top-most stack element representing a script. @return The class of the top-most script in the current stack, or null if no script is currently running
[ "Get", "the", "class", "of", "the", "top", "-", "most", "stack", "element", "representing", "a", "script", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/RhinoSecurityManager.java#L22-L31
21,413
mozilla/rhino
src/org/mozilla/javascript/ast/ArrayLiteral.java
ArrayLiteral.setElements
public void setElements(List<AstNode> elements) { if (elements == null) { this.elements = null; } else { if (this.elements != null) this.elements.clear(); for (AstNode e : elements) addElement(e); } }
java
public void setElements(List<AstNode> elements) { if (elements == null) { this.elements = null; } else { if (this.elements != null) this.elements.clear(); for (AstNode e : elements) addElement(e); } }
[ "public", "void", "setElements", "(", "List", "<", "AstNode", ">", "elements", ")", "{", "if", "(", "elements", "==", "null", ")", "{", "this", ".", "elements", "=", "null", ";", "}", "else", "{", "if", "(", "this", ".", "elements", "!=", "null", "...
Sets the element list, and sets each element's parent to this node. @param elements the element list. Can be {@code null}.
[ "Sets", "the", "element", "list", "and", "sets", "each", "element", "s", "parent", "to", "this", "node", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ast/ArrayLiteral.java#L72-L81
21,414
mozilla/rhino
src/org/mozilla/javascript/regexp/RegExpImpl.java
RegExpImpl.matchOrReplace
private static Object matchOrReplace(Context cx, Scriptable scope, Scriptable thisObj, Object[] args, RegExpImpl reImpl, GlobData data, NativeRegExp re) { String str = data.str; ...
java
private static Object matchOrReplace(Context cx, Scriptable scope, Scriptable thisObj, Object[] args, RegExpImpl reImpl, GlobData data, NativeRegExp re) { String str = data.str; ...
[ "private", "static", "Object", "matchOrReplace", "(", "Context", "cx", ",", "Scriptable", "scope", ",", "Scriptable", "thisObj", ",", "Object", "[", "]", "args", ",", "RegExpImpl", "reImpl", ",", "GlobData", "data", ",", "NativeRegExp", "re", ")", "{", "Stri...
Analog of C match_or_replace.
[ "Analog", "of", "C", "match_or_replace", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/regexp/RegExpImpl.java#L162-L209
21,415
mozilla/rhino
src/org/mozilla/javascript/regexp/RegExpImpl.java
RegExpImpl.do_replace
private static void do_replace(GlobData rdata, Context cx, RegExpImpl regExpImpl) { StringBuilder charBuf = rdata.charBuf; int cp = 0; String da = rdata.repstr; int dp = rdata.dollar; if (dp != -1) { int[] skip = new int[1]; ...
java
private static void do_replace(GlobData rdata, Context cx, RegExpImpl regExpImpl) { StringBuilder charBuf = rdata.charBuf; int cp = 0; String da = rdata.repstr; int dp = rdata.dollar; if (dp != -1) { int[] skip = new int[1]; ...
[ "private", "static", "void", "do_replace", "(", "GlobData", "rdata", ",", "Context", "cx", ",", "RegExpImpl", "regExpImpl", ")", "{", "StringBuilder", "charBuf", "=", "rdata", ".", "charBuf", ";", "int", "cp", "=", "0", ";", "String", "da", "=", "rdata", ...
Analog of do_replace in jsstr.c
[ "Analog", "of", "do_replace", "in", "jsstr", ".", "c" ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/regexp/RegExpImpl.java#L488-L520
21,416
mozilla/rhino
src/org/mozilla/classfile/TypeInfo.java
TypeInfo.getPayloadAsType
static final String getPayloadAsType(int typeInfo, ConstantPool pool) { if (getTag(typeInfo) == OBJECT_TAG) { return (String) pool.getConstantData(getPayload(typeInfo)); } throw new IllegalArgumentException("expecting object type"); }
java
static final String getPayloadAsType(int typeInfo, ConstantPool pool) { if (getTag(typeInfo) == OBJECT_TAG) { return (String) pool.getConstantData(getPayload(typeInfo)); } throw new IllegalArgumentException("expecting object type"); }
[ "static", "final", "String", "getPayloadAsType", "(", "int", "typeInfo", ",", "ConstantPool", "pool", ")", "{", "if", "(", "getTag", "(", "typeInfo", ")", "==", "OBJECT_TAG", ")", "{", "return", "(", "String", ")", "pool", ".", "getConstantData", "(", "get...
Treat the result of getPayload as a constant pool index and fetch the corresponding String mapped to it. Only works on OBJECT types.
[ "Treat", "the", "result", "of", "getPayload", "as", "a", "constant", "pool", "index", "and", "fetch", "the", "corresponding", "String", "mapped", "to", "it", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/classfile/TypeInfo.java#L55-L60
21,417
mozilla/rhino
src/org/mozilla/classfile/TypeInfo.java
TypeInfo.fromType
static final int fromType(String type, ConstantPool pool) { if (type.length() == 1) { switch (type.charAt(0)) { case 'B': // sbyte case 'C': // unicode char case 'S': // short case 'Z': // boolean case 'I': // all of the above are verified as integers return I...
java
static final int fromType(String type, ConstantPool pool) { if (type.length() == 1) { switch (type.charAt(0)) { case 'B': // sbyte case 'C': // unicode char case 'S': // short case 'Z': // boolean case 'I': // all of the above are verified as integers return I...
[ "static", "final", "int", "fromType", "(", "String", "type", ",", "ConstantPool", "pool", ")", "{", "if", "(", "type", ".", "length", "(", ")", "==", "1", ")", "{", "switch", "(", "type", ".", "charAt", "(", "0", ")", ")", "{", "case", "'", "'", ...
Create type information from an internal type.
[ "Create", "type", "information", "from", "an", "internal", "type", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/classfile/TypeInfo.java#L65-L85
21,418
mozilla/rhino
src/org/mozilla/classfile/TypeInfo.java
TypeInfo.merge
static int merge(int current, int incoming, ConstantPool pool) { int currentTag = getTag(current); int incomingTag = getTag(incoming); boolean currentIsObject = currentTag == TypeInfo.OBJECT_TAG; boolean incomingIsObject = incomingTag == TypeInfo.OBJECT_TAG; if (current == incoming || (currentIsObj...
java
static int merge(int current, int incoming, ConstantPool pool) { int currentTag = getTag(current); int incomingTag = getTag(incoming); boolean currentIsObject = currentTag == TypeInfo.OBJECT_TAG; boolean incomingIsObject = incomingTag == TypeInfo.OBJECT_TAG; if (current == incoming || (currentIsObj...
[ "static", "int", "merge", "(", "int", "current", ",", "int", "incoming", ",", "ConstantPool", "pool", ")", "{", "int", "currentTag", "=", "getTag", "(", "current", ")", ";", "int", "incomingTag", "=", "getTag", "(", "incoming", ")", ";", "boolean", "curr...
Merge two verification types. In most cases, the verification types must be the same. For example, INTEGER and DOUBLE cannot be merged and an exception will be thrown. The basic rules are: - If the types are equal, simply return one. - If either type is TOP, return TOP. - If either type is NULL, return the other type...
[ "Merge", "two", "verification", "types", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/classfile/TypeInfo.java#L109-L172
21,419
mozilla/rhino
src/org/mozilla/classfile/TypeInfo.java
TypeInfo.getClassFromInternalName
private static Class<?> getClassFromInternalName(String internalName) { try { return Class.forName(internalName.replace('/', '.')); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } }
java
private static Class<?> getClassFromInternalName(String internalName) { try { return Class.forName(internalName.replace('/', '.')); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } }
[ "private", "static", "Class", "<", "?", ">", "getClassFromInternalName", "(", "String", "internalName", ")", "{", "try", "{", "return", "Class", ".", "forName", "(", "internalName", ".", "replace", "(", "'", "'", ",", "'", "'", ")", ")", ";", "}", "cat...
Take an internal name and return a java.lang.Class instance that represents it. For example, given "java/lang/Object", returns the equivalent of Class.forName("java.lang.Object"), but also handles exceptions.
[ "Take", "an", "internal", "name", "and", "return", "a", "java", ".", "lang", ".", "Class", "instance", "that", "represents", "it", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/classfile/TypeInfo.java#L209-L215
21,420
mozilla/rhino
src/org/mozilla/javascript/RhinoException.java
RhinoException.initSourceName
public final void initSourceName(String sourceName) { if (sourceName == null) throw new IllegalArgumentException(); if (this.sourceName != null) throw new IllegalStateException(); this.sourceName = sourceName; }
java
public final void initSourceName(String sourceName) { if (sourceName == null) throw new IllegalArgumentException(); if (this.sourceName != null) throw new IllegalStateException(); this.sourceName = sourceName; }
[ "public", "final", "void", "initSourceName", "(", "String", "sourceName", ")", "{", "if", "(", "sourceName", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", ")", ";", "if", "(", "this", ".", "sourceName", "!=", "null", ")", "throw", "ne...
Initialize the uri of the script source containing the error. @param sourceName the uri of the script source responsible for the error. It should not be <tt>null</tt>. @throws IllegalStateException if the method is called more then once.
[ "Initialize", "the", "uri", "of", "the", "script", "source", "containing", "the", "error", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/RhinoException.java#L83-L88
21,421
mozilla/rhino
src/org/mozilla/javascript/RhinoException.java
RhinoException.initLineNumber
public final void initLineNumber(int lineNumber) { if (lineNumber <= 0) throw new IllegalArgumentException(String.valueOf(lineNumber)); if (this.lineNumber > 0) throw new IllegalStateException(); this.lineNumber = lineNumber; }
java
public final void initLineNumber(int lineNumber) { if (lineNumber <= 0) throw new IllegalArgumentException(String.valueOf(lineNumber)); if (this.lineNumber > 0) throw new IllegalStateException(); this.lineNumber = lineNumber; }
[ "public", "final", "void", "initLineNumber", "(", "int", "lineNumber", ")", "{", "if", "(", "lineNumber", "<=", "0", ")", "throw", "new", "IllegalArgumentException", "(", "String", ".", "valueOf", "(", "lineNumber", ")", ")", ";", "if", "(", "this", ".", ...
Initialize the line number of the script statement causing the error. @param lineNumber the line number in the script source. It should be positive number. @throws IllegalStateException if the method is called more then once.
[ "Initialize", "the", "line", "number", "of", "the", "script", "statement", "causing", "the", "error", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/RhinoException.java#L107-L112
21,422
mozilla/rhino
src/org/mozilla/javascript/RhinoException.java
RhinoException.initColumnNumber
public final void initColumnNumber(int columnNumber) { if (columnNumber <= 0) throw new IllegalArgumentException(String.valueOf(columnNumber)); if (this.columnNumber > 0) throw new IllegalStateException(); this.columnNumber = columnNumber; }
java
public final void initColumnNumber(int columnNumber) { if (columnNumber <= 0) throw new IllegalArgumentException(String.valueOf(columnNumber)); if (this.columnNumber > 0) throw new IllegalStateException(); this.columnNumber = columnNumber; }
[ "public", "final", "void", "initColumnNumber", "(", "int", "columnNumber", ")", "{", "if", "(", "columnNumber", "<=", "0", ")", "throw", "new", "IllegalArgumentException", "(", "String", ".", "valueOf", "(", "columnNumber", ")", ")", ";", "if", "(", "this", ...
Initialize the column number of the script statement causing the error. @param columnNumber the column number in the script source. It should be positive number. @throws IllegalStateException if the method is called more then once.
[ "Initialize", "the", "column", "number", "of", "the", "script", "statement", "causing", "the", "error", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/RhinoException.java#L130-L135
21,423
mozilla/rhino
src/org/mozilla/javascript/RhinoException.java
RhinoException.initLineSource
public final void initLineSource(String lineSource) { if (lineSource == null) throw new IllegalArgumentException(); if (this.lineSource != null) throw new IllegalStateException(); this.lineSource = lineSource; }
java
public final void initLineSource(String lineSource) { if (lineSource == null) throw new IllegalArgumentException(); if (this.lineSource != null) throw new IllegalStateException(); this.lineSource = lineSource; }
[ "public", "final", "void", "initLineSource", "(", "String", "lineSource", ")", "{", "if", "(", "lineSource", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", ")", ";", "if", "(", "this", ".", "lineSource", "!=", "null", ")", "throw", "ne...
Initialize the text of the source line containing the error. @param lineSource the text of the source line responsible for the error. It should not be <tt>null</tt>. @throws IllegalStateException if the method is called more then once.
[ "Initialize", "the", "text", "of", "the", "source", "line", "containing", "the", "error", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/RhinoException.java#L153-L158
21,424
mozilla/rhino
src/org/mozilla/javascript/RhinoException.java
RhinoException.getScriptStackTrace
public String getScriptStackTrace(int limit, String functionName) { ScriptStackElement[] stack = getScriptStack(limit, functionName); return formatStackTrace(stack, details()); }
java
public String getScriptStackTrace(int limit, String functionName) { ScriptStackElement[] stack = getScriptStack(limit, functionName); return formatStackTrace(stack, details()); }
[ "public", "String", "getScriptStackTrace", "(", "int", "limit", ",", "String", "functionName", ")", "{", "ScriptStackElement", "[", "]", "stack", "=", "getScriptStack", "(", "limit", ",", "functionName", ")", ";", "return", "formatStackTrace", "(", "stack", ",",...
Get a string representing the script stack of this exception. If optimization is enabled, this includes java stack elements whose source and method names suggest they have been generated by the Rhino script compiler. The optional "limit" parameter limits the number of stack frames returned. The "functionName" parameter...
[ "Get", "a", "string", "representing", "the", "script", "stack", "of", "this", "exception", ".", "If", "optimization", "is", "enabled", "this", "includes", "java", "stack", "elements", "whose", "source", "and", "method", "names", "suggest", "they", "have", "bee...
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/RhinoException.java#L221-L225
21,425
mozilla/rhino
src/org/mozilla/javascript/ast/SwitchCase.java
SwitchCase.addStatement
public void addStatement(AstNode statement) { assertNotNull(statement); if (statements == null) { statements = new ArrayList<AstNode>(); } int end = statement.getPosition() + statement.getLength(); this.setLength(end - this.getPosition()); statements.add(state...
java
public void addStatement(AstNode statement) { assertNotNull(statement); if (statements == null) { statements = new ArrayList<AstNode>(); } int end = statement.getPosition() + statement.getLength(); this.setLength(end - this.getPosition()); statements.add(state...
[ "public", "void", "addStatement", "(", "AstNode", "statement", ")", "{", "assertNotNull", "(", "statement", ")", ";", "if", "(", "statements", "==", "null", ")", "{", "statements", "=", "new", "ArrayList", "<", "AstNode", ">", "(", ")", ";", "}", "int", ...
Adds a statement to the end of the statement list. Sets the parent of the new statement to this node, updates its start offset to be relative to this node, and sets the length of this node to include the new child. @param statement a child statement @throws IllegalArgumentException} if statement is {@code null}
[ "Adds", "a", "statement", "to", "the", "end", "of", "the", "statement", "list", ".", "Sets", "the", "parent", "of", "the", "new", "statement", "to", "this", "node", "updates", "its", "start", "offset", "to", "be", "relative", "to", "this", "node", "and",...
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ast/SwitchCase.java#L107-L116
21,426
mozilla/rhino
src/org/mozilla/javascript/ast/XmlString.java
XmlString.setXml
public void setXml(String s) { assertNotNull(s); xml = s; setLength(s.length()); }
java
public void setXml(String s) { assertNotNull(s); xml = s; setLength(s.length()); }
[ "public", "void", "setXml", "(", "String", "s", ")", "{", "assertNotNull", "(", "s", ")", ";", "xml", "=", "s", ";", "setLength", "(", "s", ".", "length", "(", ")", ")", ";", "}" ]
Sets the string for this XML component. Sets the length of the component to the length of the passed string. @param s a string of xml text @throws IllegalArgumentException} if {@code s} is {@code null}
[ "Sets", "the", "string", "for", "this", "XML", "component", ".", "Sets", "the", "length", "of", "the", "component", "to", "the", "length", "of", "the", "passed", "string", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ast/XmlString.java#L36-L40
21,427
mozilla/rhino
src/org/mozilla/javascript/typedarrays/NativeArrayBuffer.java
NativeArrayBuffer.slice
public NativeArrayBuffer slice(double s, double e) { // Handle negative start as relative to start // Clamp as per the spec to between 0 and length int end = ScriptRuntime.toInt32(Math.max(0, Math.min(buffer.length, (e < 0 ? buffer.length + e : e)))); int start = ScriptRuntime.toInt3...
java
public NativeArrayBuffer slice(double s, double e) { // Handle negative start as relative to start // Clamp as per the spec to between 0 and length int end = ScriptRuntime.toInt32(Math.max(0, Math.min(buffer.length, (e < 0 ? buffer.length + e : e)))); int start = ScriptRuntime.toInt3...
[ "public", "NativeArrayBuffer", "slice", "(", "double", "s", ",", "double", "e", ")", "{", "// Handle negative start as relative to start", "// Clamp as per the spec to between 0 and length", "int", "end", "=", "ScriptRuntime", ".", "toInt32", "(", "Math", ".", "max", "(...
Return a new buffer that represents a slice of this buffer's content, starting at position "start" and ending at position "end". Both values will be "clamped" as per the JavaScript spec so that invalid values may be passed and will be adjusted up or down accordingly. This method will return a new buffer that contains a...
[ "Return", "a", "new", "buffer", "that", "represents", "a", "slice", "of", "this", "buffer", "s", "content", "starting", "at", "position", "start", "and", "ending", "at", "position", "end", ".", "Both", "values", "will", "be", "clamped", "as", "per", "the",...
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/typedarrays/NativeArrayBuffer.java#L104-L115
21,428
mozilla/rhino
src/org/mozilla/javascript/typedarrays/NativeArrayBuffer.java
NativeArrayBuffer.execIdCall
@Override public Object execIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, Object[] args) { if (!f.hasTag(CLASS_NAME)) { return super.execIdCall(f, cx, scope, thisObj, args); } int id = f.methodId(); switch (i...
java
@Override public Object execIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, Object[] args) { if (!f.hasTag(CLASS_NAME)) { return super.execIdCall(f, cx, scope, thisObj, args); } int id = f.methodId(); switch (i...
[ "@", "Override", "public", "Object", "execIdCall", "(", "IdFunctionObject", "f", ",", "Context", "cx", ",", "Scriptable", "scope", ",", "Scriptable", "thisObj", ",", "Object", "[", "]", "args", ")", "{", "if", "(", "!", "f", ".", "hasTag", "(", "CLASS_NA...
Function-calling dispatcher
[ "Function", "-", "calling", "dispatcher" ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/typedarrays/NativeArrayBuffer.java#L119-L142
21,429
mozilla/rhino
examples/Shell.java
Shell.version
public static double version(Context cx, Scriptable thisObj, Object[] args, Function funObj) { double result = cx.getLanguageVersion(); if (args.length > 0) { double d = Context.toNumber(args[0]); cx.setLanguageVersion((int) d); } ...
java
public static double version(Context cx, Scriptable thisObj, Object[] args, Function funObj) { double result = cx.getLanguageVersion(); if (args.length > 0) { double d = Context.toNumber(args[0]); cx.setLanguageVersion((int) d); } ...
[ "public", "static", "double", "version", "(", "Context", "cx", ",", "Scriptable", "thisObj", ",", "Object", "[", "]", "args", ",", "Function", "funObj", ")", "{", "double", "result", "=", "cx", ".", "getLanguageVersion", "(", ")", ";", "if", "(", "args",...
Get and set the language version. This method is defined as a JavaScript function.
[ "Get", "and", "set", "the", "language", "version", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/examples/Shell.java#L185-L194
21,430
mozilla/rhino
src/org/mozilla/javascript/Arguments.java
Arguments.putIntoActivation
private void putIntoActivation(int index, Object value) { String argName = activation.function.getParamOrVarName(index); activation.put(argName, activation, value); }
java
private void putIntoActivation(int index, Object value) { String argName = activation.function.getParamOrVarName(index); activation.put(argName, activation, value); }
[ "private", "void", "putIntoActivation", "(", "int", "index", ",", "Object", "value", ")", "{", "String", "argName", "=", "activation", ".", "function", ".", "getParamOrVarName", "(", "index", ")", ";", "activation", ".", "put", "(", "argName", ",", "activati...
the following helper methods assume that 0 < index < args.length
[ "the", "following", "helper", "methods", "assume", "that", "0", "<", "index", "<", "args", ".", "length" ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/Arguments.java#L64-L67
21,431
mozilla/rhino
examples/File.java
File.jsConstructor
@JSConstructor public static Scriptable jsConstructor(Context cx, Object[] args, Function ctorObj, boolean inNewExpr) { File result = new File(); if (args.length == 0 || args[0] == Context.getUndefinedValue()) ...
java
@JSConstructor public static Scriptable jsConstructor(Context cx, Object[] args, Function ctorObj, boolean inNewExpr) { File result = new File(); if (args.length == 0 || args[0] == Context.getUndefinedValue()) ...
[ "@", "JSConstructor", "public", "static", "Scriptable", "jsConstructor", "(", "Context", "cx", ",", "Object", "[", "]", "args", ",", "Function", "ctorObj", ",", "boolean", "inNewExpr", ")", "{", "File", "result", "=", "new", "File", "(", ")", ";", "if", ...
The Java method defining the JavaScript File constructor. If the constructor has one or more arguments, and the first argument is not undefined, the argument is converted to a string as used as the filename.<p> Otherwise System.in or System.out is assumed as appropriate to the use.
[ "The", "Java", "method", "defining", "the", "JavaScript", "File", "constructor", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/examples/File.java#L80-L94
21,432
mozilla/rhino
examples/File.java
File.readLines
@JSFunction public Object readLines() throws IOException { List<String> list = new ArrayList<String>(); String s; while ((s = readLine()) != null) { list.add(s); } String[] lines = list.toArray(new String[list.size()]); Scriptable scope = Scrip...
java
@JSFunction public Object readLines() throws IOException { List<String> list = new ArrayList<String>(); String s; while ((s = readLine()) != null) { list.add(s); } String[] lines = list.toArray(new String[list.size()]); Scriptable scope = Scrip...
[ "@", "JSFunction", "public", "Object", "readLines", "(", ")", "throws", "IOException", "{", "List", "<", "String", ">", "list", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "String", "s", ";", "while", "(", "(", "s", "=", "readLine", "...
Read the remaining lines in the file and return them in an array. Implements a JavaScript function.<p> This is a good example of creating a new array and setting elements in that array. @exception IOException if an error occurred while accessing the file associated with this object
[ "Read", "the", "remaining", "lines", "in", "the", "file", "and", "return", "them", "in", "an", "array", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/examples/File.java#L125-L138
21,433
mozilla/rhino
examples/File.java
File.write
@JSFunction public static void write(Context cx, Scriptable thisObj, Object[] args, Function funObj) throws IOException { write0(thisObj, args, false); }
java
@JSFunction public static void write(Context cx, Scriptable thisObj, Object[] args, Function funObj) throws IOException { write0(thisObj, args, false); }
[ "@", "JSFunction", "public", "static", "void", "write", "(", "Context", "cx", ",", "Scriptable", "thisObj", ",", "Object", "[", "]", "args", ",", "Function", "funObj", ")", "throws", "IOException", "{", "write0", "(", "thisObj", ",", "args", ",", "false", ...
Write strings. Implements a JavaScript function. <p> This function takes a variable number of arguments, converts each argument to a string, and writes that string to the file. @exception IOException if an error occurred while accessing the file associated with this object
[ "Write", "strings", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/examples/File.java#L179-L185
21,434
mozilla/rhino
examples/File.java
File.writeLine
@JSFunction public static void writeLine(Context cx, Scriptable thisObj, Object[] args, Function funObj) throws IOException { write0(thisObj, args, true); }
java
@JSFunction public static void writeLine(Context cx, Scriptable thisObj, Object[] args, Function funObj) throws IOException { write0(thisObj, args, true); }
[ "@", "JSFunction", "public", "static", "void", "writeLine", "(", "Context", "cx", ",", "Scriptable", "thisObj", ",", "Object", "[", "]", "args", ",", "Function", "funObj", ")", "throws", "IOException", "{", "write0", "(", "thisObj", ",", "args", ",", "true...
Write strings and a newline. Implements a JavaScript function. @exception IOException if an error occurred while accessing the file associated with this object
[ "Write", "strings", "and", "a", "newline", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/examples/File.java#L195-L201
21,435
mozilla/rhino
examples/File.java
File.close
@JSFunction public void close() throws IOException { if (reader != null) { reader.close(); reader = null; } else if (writer != null) { writer.close(); writer = null; } }
java
@JSFunction public void close() throws IOException { if (reader != null) { reader.close(); reader = null; } else if (writer != null) { writer.close(); writer = null; } }
[ "@", "JSFunction", "public", "void", "close", "(", ")", "throws", "IOException", "{", "if", "(", "reader", "!=", "null", ")", "{", "reader", ".", "close", "(", ")", ";", "reader", "=", "null", ";", "}", "else", "if", "(", "writer", "!=", "null", ")...
Close the file. It may be reopened. Implements a JavaScript function. @exception IOException if an error occurred while accessing the file associated with this object
[ "Close", "the", "file", ".", "It", "may", "be", "reopened", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/examples/File.java#L217-L226
21,436
mozilla/rhino
examples/File.java
File.getJSReader
@JSFunction("getReader") public Object getJSReader() { if (reader == null) return null; // Here we use toObject() to "wrap" the BufferedReader object // in a Scriptable object so that it can be manipulated by // JavaScript. Scriptable parent = ScriptableObject.get...
java
@JSFunction("getReader") public Object getJSReader() { if (reader == null) return null; // Here we use toObject() to "wrap" the BufferedReader object // in a Scriptable object so that it can be manipulated by // JavaScript. Scriptable parent = ScriptableObject.get...
[ "@", "JSFunction", "(", "\"getReader\"", ")", "public", "Object", "getJSReader", "(", ")", "{", "if", "(", "reader", "==", "null", ")", "return", "null", ";", "// Here we use toObject() to \"wrap\" the BufferedReader object", "// in a Scriptable object so that it can be man...
Get the Java reader.
[ "Get", "the", "Java", "reader", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/examples/File.java#L245-L254
21,437
mozilla/rhino
examples/File.java
File.getWriter
@JSFunction public Object getWriter() { if (writer == null) return null; Scriptable parent = ScriptableObject.getTopLevelScope(this); return Context.javaToJS(writer, parent); }
java
@JSFunction public Object getWriter() { if (writer == null) return null; Scriptable parent = ScriptableObject.getTopLevelScope(this); return Context.javaToJS(writer, parent); }
[ "@", "JSFunction", "public", "Object", "getWriter", "(", ")", "{", "if", "(", "writer", "==", "null", ")", "return", "null", ";", "Scriptable", "parent", "=", "ScriptableObject", ".", "getTopLevelScope", "(", "this", ")", ";", "return", "Context", ".", "ja...
Get the Java writer. @see File#getReader
[ "Get", "the", "Java", "writer", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/examples/File.java#L262-L268
21,438
mozilla/rhino
examples/File.java
File.getReader
private LineNumberReader getReader() throws FileNotFoundException { if (writer != null) { throw Context.reportRuntimeError("already writing file \"" + name + "\""); } if (reader == null) ...
java
private LineNumberReader getReader() throws FileNotFoundException { if (writer != null) { throw Context.reportRuntimeError("already writing file \"" + name + "\""); } if (reader == null) ...
[ "private", "LineNumberReader", "getReader", "(", ")", "throws", "FileNotFoundException", "{", "if", "(", "writer", "!=", "null", ")", "{", "throw", "Context", ".", "reportRuntimeError", "(", "\"already writing file \\\"\"", "+", "name", "+", "\"\\\"\"", ")", ";", ...
Get the reader, checking that we're not already writing this file.
[ "Get", "the", "reader", "checking", "that", "we", "re", "not", "already", "writing", "this", "file", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/examples/File.java#L273-L284
21,439
mozilla/rhino
examples/File.java
File.write0
private static void write0(Scriptable thisObj, Object[] args, boolean eol) throws IOException { File thisFile = checkInstance(thisObj); if (thisFile.reader != null) { throw Context.reportRuntimeError("already writing file \"" + thisFil...
java
private static void write0(Scriptable thisObj, Object[] args, boolean eol) throws IOException { File thisFile = checkInstance(thisObj); if (thisFile.reader != null) { throw Context.reportRuntimeError("already writing file \"" + thisFil...
[ "private", "static", "void", "write0", "(", "Scriptable", "thisObj", ",", "Object", "[", "]", "args", ",", "boolean", "eol", ")", "throws", "IOException", "{", "File", "thisFile", "=", "checkInstance", "(", "thisObj", ")", ";", "if", "(", "thisFile", ".", ...
Perform the guts of write and writeLine. Since the two functions differ only in whether they write a newline character, move the code into a common subroutine.
[ "Perform", "the", "guts", "of", "write", "and", "writeLine", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/examples/File.java#L293-L312
21,440
mozilla/rhino
examples/File.java
File.checkInstance
private static File checkInstance(Scriptable obj) { if (obj == null || !(obj instanceof File)) { throw Context.reportRuntimeError("called on incompatible object"); } return (File) obj; }
java
private static File checkInstance(Scriptable obj) { if (obj == null || !(obj instanceof File)) { throw Context.reportRuntimeError("called on incompatible object"); } return (File) obj; }
[ "private", "static", "File", "checkInstance", "(", "Scriptable", "obj", ")", "{", "if", "(", "obj", "==", "null", "||", "!", "(", "obj", "instanceof", "File", ")", ")", "{", "throw", "Context", ".", "reportRuntimeError", "(", "\"called on incompatible object\"...
Perform the instanceof check and return the downcasted File object. This is necessary since methods may reside in the File.prototype object and scripts can dynamically alter prototype chains. For example: <pre> js> defineClass("File"); js> o = {}; [object Object] js> o.__proto__ = File.prototype; [object File] js> o.w...
[ "Perform", "the", "instanceof", "check", "and", "return", "the", "downcasted", "File", "object", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/examples/File.java#L331-L336
21,441
mozilla/rhino
src/org/mozilla/javascript/serialize/ScriptableOutputStream.java
ScriptableOutputStream.addOptionalExcludedName
public void addOptionalExcludedName(String name) { Object obj = lookupQualifiedName(scope, name); if(obj != null && obj != UniqueTag.NOT_FOUND) { if (!(obj instanceof Scriptable)) { throw new IllegalArgumentException( "Object for excluded name " + name...
java
public void addOptionalExcludedName(String name) { Object obj = lookupQualifiedName(scope, name); if(obj != null && obj != UniqueTag.NOT_FOUND) { if (!(obj instanceof Scriptable)) { throw new IllegalArgumentException( "Object for excluded name " + name...
[ "public", "void", "addOptionalExcludedName", "(", "String", "name", ")", "{", "Object", "obj", "=", "lookupQualifiedName", "(", "scope", ",", "name", ")", ";", "if", "(", "obj", "!=", "null", "&&", "obj", "!=", "UniqueTag", ".", "NOT_FOUND", ")", "{", "i...
Adds a qualified name to the list of object to be excluded from serialization. Names excluded from serialization are looked up in the new scope and replaced upon deserialization. @param name a fully qualified name (of the form "a.b.c", where "a" must be a property of the top-level object). The object need not exist, in...
[ "Adds", "a", "qualified", "name", "to", "the", "list", "of", "object", "to", "be", "excluded", "from", "serialization", ".", "Names", "excluded", "from", "serialization", "are", "looked", "up", "in", "the", "new", "scope", "and", "replaced", "upon", "deseria...
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/serialize/ScriptableOutputStream.java#L80-L91
21,442
mozilla/rhino
src/org/mozilla/javascript/serialize/ScriptableOutputStream.java
ScriptableOutputStream.addExcludedName
public void addExcludedName(String name) { Object obj = lookupQualifiedName(scope, name); if (!(obj instanceof Scriptable)) { throw new IllegalArgumentException("Object for excluded name " + name + " not found."); } table.put(obj...
java
public void addExcludedName(String name) { Object obj = lookupQualifiedName(scope, name); if (!(obj instanceof Scriptable)) { throw new IllegalArgumentException("Object for excluded name " + name + " not found."); } table.put(obj...
[ "public", "void", "addExcludedName", "(", "String", "name", ")", "{", "Object", "obj", "=", "lookupQualifiedName", "(", "scope", ",", "name", ")", ";", "if", "(", "!", "(", "obj", "instanceof", "Scriptable", ")", ")", "{", "throw", "new", "IllegalArgumentE...
Adds a qualified name to the list of objects to be excluded from serialization. Names excluded from serialization are looked up in the new scope and replaced upon deserialization. @param name a fully qualified name (of the form "a.b.c", where "a" must be a property of the top-level object) @throws IllegalArgumentExcept...
[ "Adds", "a", "qualified", "name", "to", "the", "list", "of", "objects", "to", "be", "excluded", "from", "serialization", ".", "Names", "excluded", "from", "serialization", "are", "looked", "up", "in", "the", "new", "scope", "and", "replaced", "upon", "deseri...
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/serialize/ScriptableOutputStream.java#L102-L109
21,443
mozilla/rhino
src/org/mozilla/javascript/serialize/ScriptableOutputStream.java
ScriptableOutputStream.excludeStandardObjectNames
public void excludeStandardObjectNames() { String[] names = { "Object", "Object.prototype", "Function", "Function.prototype", "String", "String.prototype", "Math", // no Math.prototype "Array", "Array.pr...
java
public void excludeStandardObjectNames() { String[] names = { "Object", "Object.prototype", "Function", "Function.prototype", "String", "String.prototype", "Math", // no Math.prototype "Array", "Array.pr...
[ "public", "void", "excludeStandardObjectNames", "(", ")", "{", "String", "[", "]", "names", "=", "{", "\"Object\"", ",", "\"Object.prototype\"", ",", "\"Function\"", ",", "\"Function.prototype\"", ",", "\"String\"", ",", "\"String.prototype\"", ",", "\"Math\"", ",",...
Adds the names of the standard objects and their prototypes to the list of excluded names.
[ "Adds", "the", "names", "of", "the", "standard", "objects", "and", "their", "prototypes", "to", "the", "list", "of", "excluded", "names", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/serialize/ScriptableOutputStream.java#L129-L153
21,444
mozilla/rhino
src/org/mozilla/javascript/NativeMap.java
NativeMap.loadFromIterable
static void loadFromIterable(Context cx, Scriptable scope, ScriptableObject map, Object arg1) { if ((arg1 == null) || Undefined.instance.equals(arg1)) { return; } // Call the "[Symbol.iterator]" property as a function. final Object ito = ScriptRuntime.callIterator(arg1, ...
java
static void loadFromIterable(Context cx, Scriptable scope, ScriptableObject map, Object arg1) { if ((arg1 == null) || Undefined.instance.equals(arg1)) { return; } // Call the "[Symbol.iterator]" property as a function. final Object ito = ScriptRuntime.callIterator(arg1, ...
[ "static", "void", "loadFromIterable", "(", "Context", "cx", ",", "Scriptable", "scope", ",", "ScriptableObject", "map", ",", "Object", "arg1", ")", "{", "if", "(", "(", "arg1", "==", "null", ")", "||", "Undefined", ".", "instance", ".", "equals", "(", "a...
If an "iterable" object was passed to the constructor, there are many many things to do... Make this static because NativeWeakMap has the exact same requirement.
[ "If", "an", "iterable", "object", "was", "passed", "to", "the", "constructor", "there", "are", "many", "many", "things", "to", "do", "...", "Make", "this", "static", "because", "NativeWeakMap", "has", "the", "exact", "same", "requirement", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/NativeMap.java#L180-L219
21,445
mozilla/rhino
src/org/mozilla/javascript/NativeMath.java
NativeMath.js_pow
private static double js_pow(double x, double y) { double result; if (y != y) { // y is NaN, result is always NaN result = y; } else if (y == 0) { // Java's pow(NaN, 0) = NaN; we need 1 result = 1.0; } else if (x == 0) { // Many...
java
private static double js_pow(double x, double y) { double result; if (y != y) { // y is NaN, result is always NaN result = y; } else if (y == 0) { // Java's pow(NaN, 0) = NaN; we need 1 result = 1.0; } else if (x == 0) { // Many...
[ "private", "static", "double", "js_pow", "(", "double", "x", ",", "double", "y", ")", "{", "double", "result", ";", "if", "(", "y", "!=", "y", ")", "{", "// y is NaN, result is always NaN", "result", "=", "y", ";", "}", "else", "if", "(", "y", "==", ...
See Ecma 15.8.2.13
[ "See", "Ecma", "15", ".", "8", ".", "2", ".", "13" ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/NativeMath.java#L367-L419
21,446
mozilla/rhino
src/org/mozilla/javascript/NativeMath.java
NativeMath.js_imul
private static int js_imul(Object[] args) { if (args == null) { return 0; } int x = ScriptRuntime.toInt32(args, 0); int y = ScriptRuntime.toInt32(args, 1); return x * y; }
java
private static int js_imul(Object[] args) { if (args == null) { return 0; } int x = ScriptRuntime.toInt32(args, 0); int y = ScriptRuntime.toInt32(args, 1); return x * y; }
[ "private", "static", "int", "js_imul", "(", "Object", "[", "]", "args", ")", "{", "if", "(", "args", "==", "null", ")", "{", "return", "0", ";", "}", "int", "x", "=", "ScriptRuntime", ".", "toInt32", "(", "args", ",", "0", ")", ";", "int", "y", ...
From EcmaScript 6 section 20.2.2.19
[ "From", "EcmaScript", "6", "section", "20", ".", "2", ".", "2", ".", "19" ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/NativeMath.java#L448-L457
21,447
mozilla/rhino
toolsrc/org/mozilla/javascript/tools/jsc/Main.java
Main.badUsage
private static void badUsage(String s) { System.err.println(ToolErrorReporter.getMessage( "msg.jsc.bad.usage", Main.class.getName(), s)); }
java
private static void badUsage(String s) { System.err.println(ToolErrorReporter.getMessage( "msg.jsc.bad.usage", Main.class.getName(), s)); }
[ "private", "static", "void", "badUsage", "(", "String", "s", ")", "{", "System", ".", "err", ".", "println", "(", "ToolErrorReporter", ".", "getMessage", "(", "\"msg.jsc.bad.usage\"", ",", "Main", ".", "class", ".", "getName", "(", ")", ",", "s", ")", ")...
Print a usage message.
[ "Print", "a", "usage", "message", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/toolsrc/org/mozilla/javascript/tools/jsc/Main.java#L217-L220
21,448
mozilla/rhino
toolsrc/org/mozilla/javascript/tools/jsc/Main.java
Main.processSource
public void processSource(String[] filenames) { for (int i = 0; i != filenames.length; ++i) { String filename = filenames[i]; if (!filename.endsWith(".js")) { addError("msg.extension.not.js", filename); return; } File f = new Fi...
java
public void processSource(String[] filenames) { for (int i = 0; i != filenames.length; ++i) { String filename = filenames[i]; if (!filename.endsWith(".js")) { addError("msg.extension.not.js", filename); return; } File f = new Fi...
[ "public", "void", "processSource", "(", "String", "[", "]", "filenames", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "!=", "filenames", ".", "length", ";", "++", "i", ")", "{", "String", "filename", "=", "filenames", "[", "i", "]", ";", ...
Compile JavaScript source.
[ "Compile", "JavaScript", "source", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/toolsrc/org/mozilla/javascript/tools/jsc/Main.java#L226-L280
21,449
mozilla/rhino
toolsrc/org/mozilla/javascript/tools/jsc/Main.java
Main.getClassName
String getClassName(String name) { char[] s = new char[name.length()+1]; char c; int j = 0; if (!Character.isJavaIdentifierStart(name.charAt(0))) { s[j++] = '_'; } for (int i=0; i < name.length(); i++, j++) { c = name.charAt(i); if ( C...
java
String getClassName(String name) { char[] s = new char[name.length()+1]; char c; int j = 0; if (!Character.isJavaIdentifierStart(name.charAt(0))) { s[j++] = '_'; } for (int i=0; i < name.length(); i++, j++) { c = name.charAt(i); if ( C...
[ "String", "getClassName", "(", "String", "name", ")", "{", "char", "[", "]", "s", "=", "new", "char", "[", "name", ".", "length", "(", ")", "+", "1", "]", ";", "char", "c", ";", "int", "j", "=", "0", ";", "if", "(", "!", "Character", ".", "is...
Verify that class file names are legal Java identifiers. Substitute illegal characters with underscores, and prepend the name with an underscore if the file name does not begin with a JavaLetter.
[ "Verify", "that", "class", "file", "names", "are", "legal", "Java", "identifiers", ".", "Substitute", "illegal", "characters", "with", "underscores", "and", "prepend", "the", "name", "with", "an", "underscore", "if", "the", "file", "name", "does", "not", "begi...
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/toolsrc/org/mozilla/javascript/tools/jsc/Main.java#L321-L338
21,450
mozilla/rhino
src/org/mozilla/javascript/NativeFunction.java
NativeFunction.resumeGenerator
public Object resumeGenerator(Context cx, Scriptable scope, int operation, Object state, Object value) { throw new EvaluatorException("resumeGenerator() not implemented"); }
java
public Object resumeGenerator(Context cx, Scriptable scope, int operation, Object state, Object value) { throw new EvaluatorException("resumeGenerator() not implemented"); }
[ "public", "Object", "resumeGenerator", "(", "Context", "cx", ",", "Scriptable", "scope", ",", "int", "operation", ",", "Object", "state", ",", "Object", "value", ")", "{", "throw", "new", "EvaluatorException", "(", "\"resumeGenerator() not implemented\"", ")", ";"...
Resume execution of a suspended generator. @param cx The current context @param scope Scope for the parent generator function @param operation The resumption operation (next, send, etc.. ) @param state The generator state (has locals, stack, etc.) @param value The return value of yield (if required). @return The next y...
[ "Resume", "execution", "of", "a", "suspended", "generator", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/NativeFunction.java#L97-L101
21,451
mozilla/rhino
src/org/mozilla/javascript/ast/ConditionalExpression.java
ConditionalExpression.visit
@Override public void visit(NodeVisitor v) { if (v.visit(this)) { testExpression.visit(v); trueExpression.visit(v); falseExpression.visit(v); } }
java
@Override public void visit(NodeVisitor v) { if (v.visit(this)) { testExpression.visit(v); trueExpression.visit(v); falseExpression.visit(v); } }
[ "@", "Override", "public", "void", "visit", "(", "NodeVisitor", "v", ")", "{", "if", "(", "v", ".", "visit", "(", "this", ")", ")", "{", "testExpression", ".", "visit", "(", "v", ")", ";", "trueExpression", ".", "visit", "(", "v", ")", ";", "falseE...
Visits this node, then the test-expression, the true-expression, and the false-expression.
[ "Visits", "this", "node", "then", "the", "test", "-", "expression", "the", "true", "-", "expression", "and", "the", "false", "-", "expression", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ast/ConditionalExpression.java#L160-L167
21,452
mozilla/rhino
src/org/mozilla/classfile/ClassFileWriter.java
ClassFileWriter.addInterface
public void addInterface(String interfaceName) { short interfaceIndex = itsConstantPool.addClass(interfaceName); itsInterfaces.add(Short.valueOf(interfaceIndex)); }
java
public void addInterface(String interfaceName) { short interfaceIndex = itsConstantPool.addClass(interfaceName); itsInterfaces.add(Short.valueOf(interfaceIndex)); }
[ "public", "void", "addInterface", "(", "String", "interfaceName", ")", "{", "short", "interfaceIndex", "=", "itsConstantPool", ".", "addClass", "(", "interfaceName", ")", ";", "itsInterfaces", ".", "add", "(", "Short", ".", "valueOf", "(", "interfaceIndex", ")",...
Add an interface implemented by this class. This method may be called multiple times for classes that implement multiple interfaces. @param interfaceName a name of an interface implemented by the class being written, including full package qualification.
[ "Add", "an", "interface", "implemented", "by", "this", "class", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/classfile/ClassFileWriter.java#L75-L78
21,453
mozilla/rhino
src/org/mozilla/classfile/ClassFileWriter.java
ClassFileWriter.classNameToSignature
public static String classNameToSignature(String name) { int nameLength = name.length(); int colonPos = 1 + nameLength; char[] buf = new char[colonPos + 1]; buf[0] = 'L'; buf[colonPos] = ';'; name.getChars(0, nameLength, buf, 1); for (int i = 1; i != colonPos; ++i...
java
public static String classNameToSignature(String name) { int nameLength = name.length(); int colonPos = 1 + nameLength; char[] buf = new char[colonPos + 1]; buf[0] = 'L'; buf[colonPos] = ';'; name.getChars(0, nameLength, buf, 1); for (int i = 1; i != colonPos; ++i...
[ "public", "static", "String", "classNameToSignature", "(", "String", "name", ")", "{", "int", "nameLength", "=", "name", ".", "length", "(", ")", ";", "int", "colonPos", "=", "1", "+", "nameLength", ";", "char", "[", "]", "buf", "=", "new", "char", "["...
Convert Java class name in dot notation into "Lname-with-dots-replaced-by-slashes;" form suitable for use as JVM type signatures.
[ "Convert", "Java", "class", "name", "in", "dot", "notation", "into", "Lname", "-", "with", "-", "dots", "-", "replaced", "-", "by", "-", "slashes", ";", "form", "suitable", "for", "use", "as", "JVM", "type", "signatures", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/classfile/ClassFileWriter.java#L113-L126
21,454
mozilla/rhino
src/org/mozilla/classfile/ClassFileWriter.java
ClassFileWriter.addVariableDescriptor
public void addVariableDescriptor(String name, String type, int startPC, int register) { int nameIndex = itsConstantPool.addUtf8(name); int descriptorIndex = itsConstantPool.addUtf8(type); int[] chunk = {nameIndex, descriptorIndex, startPC, register}; if (itsVarDescriptors == null) { ...
java
public void addVariableDescriptor(String name, String type, int startPC, int register) { int nameIndex = itsConstantPool.addUtf8(name); int descriptorIndex = itsConstantPool.addUtf8(type); int[] chunk = {nameIndex, descriptorIndex, startPC, register}; if (itsVarDescriptors == null) { ...
[ "public", "void", "addVariableDescriptor", "(", "String", "name", ",", "String", "type", ",", "int", "startPC", ",", "int", "register", ")", "{", "int", "nameIndex", "=", "itsConstantPool", ".", "addUtf8", "(", "name", ")", ";", "int", "descriptorIndex", "="...
Add Information about java variable to use when generating the local variable table. @param name variable name. @param type variable type as bytecode descriptor string. @param startPC the starting bytecode PC where this variable is live, or -1 if it does not have a Java register. @param register the Java register numb...
[ "Add", "Information", "about", "java", "variable", "to", "use", "when", "generating", "the", "local", "variable", "table", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/classfile/ClassFileWriter.java#L214-L222
21,455
mozilla/rhino
src/org/mozilla/classfile/ClassFileWriter.java
ClassFileWriter.startMethod
public void startMethod(String methodName, String type, short flags) { short methodNameIndex = itsConstantPool.addUtf8(methodName); short typeIndex = itsConstantPool.addUtf8(type); itsCurrentMethod = new ClassFileMethod(methodName, methodNameIndex, type, typeIndex, flags); it...
java
public void startMethod(String methodName, String type, short flags) { short methodNameIndex = itsConstantPool.addUtf8(methodName); short typeIndex = itsConstantPool.addUtf8(type); itsCurrentMethod = new ClassFileMethod(methodName, methodNameIndex, type, typeIndex, flags); it...
[ "public", "void", "startMethod", "(", "String", "methodName", ",", "String", "type", ",", "short", "flags", ")", "{", "short", "methodNameIndex", "=", "itsConstantPool", ".", "addUtf8", "(", "methodName", ")", ";", "short", "typeIndex", "=", "itsConstantPool", ...
Add a method and begin adding code. This method must be called before other methods for adding code, exception tables, etc. can be invoked. @param methodName the name of the method @param type a string representing the type @param flags the attributes of the field, such as ACC_PUBLIC, etc. bitwise or'd together
[ "Add", "a", "method", "and", "begin", "adding", "code", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/classfile/ClassFileWriter.java#L234-L242
21,456
mozilla/rhino
src/org/mozilla/classfile/ClassFileWriter.java
ClassFileWriter.add
public void add(int theOpCode) { if (opcodeCount(theOpCode) != 0) throw new IllegalArgumentException("Unexpected operands"); int newStack = itsStackTop + stackChange(theOpCode); if (newStack < 0 || Short.MAX_VALUE < newStack) badStack(newStack); if (DEBUGCODE) ...
java
public void add(int theOpCode) { if (opcodeCount(theOpCode) != 0) throw new IllegalArgumentException("Unexpected operands"); int newStack = itsStackTop + stackChange(theOpCode); if (newStack < 0 || Short.MAX_VALUE < newStack) badStack(newStack); if (DEBUGCODE) ...
[ "public", "void", "add", "(", "int", "theOpCode", ")", "{", "if", "(", "opcodeCount", "(", "theOpCode", ")", "!=", "0", ")", "throw", "new", "IllegalArgumentException", "(", "\"Unexpected operands\"", ")", ";", "int", "newStack", "=", "itsStackTop", "+", "st...
Add the single-byte opcode to the current method. @param theOpCode the opcode of the bytecode
[ "Add", "the", "single", "-", "byte", "opcode", "to", "the", "current", "method", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/classfile/ClassFileWriter.java#L425-L444
21,457
mozilla/rhino
src/org/mozilla/classfile/ClassFileWriter.java
ClassFileWriter.addLoadConstant
public void addLoadConstant(int k) { switch (k) { case 0: add(ByteCode.ICONST_0); break; case 1: add(ByteCode.ICONST_1); break; case 2: add(ByteCode.ICONST_2); break; c...
java
public void addLoadConstant(int k) { switch (k) { case 0: add(ByteCode.ICONST_0); break; case 1: add(ByteCode.ICONST_1); break; case 2: add(ByteCode.ICONST_2); break; c...
[ "public", "void", "addLoadConstant", "(", "int", "k", ")", "{", "switch", "(", "k", ")", "{", "case", "0", ":", "add", "(", "ByteCode", ".", "ICONST_0", ")", ";", "break", ";", "case", "1", ":", "add", "(", "ByteCode", ".", "ICONST_1", ")", ";", ...
Generate the load constant bytecode for the given integer. @param k the constant
[ "Generate", "the", "load", "constant", "bytecode", "for", "the", "given", "integer", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/classfile/ClassFileWriter.java#L610-L634
21,458
mozilla/rhino
src/org/mozilla/classfile/ClassFileWriter.java
ClassFileWriter.add
public void add(int theOpCode, int theOperand1, int theOperand2) { if (DEBUGCODE) { System.out.println("Add " + bytecodeStr(theOpCode) + ", " + Integer.toHexString(theOperand1) + ", " + Integer.toHexString(theOperand2)); } int newStack = itsStackTop + ...
java
public void add(int theOpCode, int theOperand1, int theOperand2) { if (DEBUGCODE) { System.out.println("Add " + bytecodeStr(theOpCode) + ", " + Integer.toHexString(theOperand1) + ", " + Integer.toHexString(theOperand2)); } int newStack = itsStackTop + ...
[ "public", "void", "add", "(", "int", "theOpCode", ",", "int", "theOperand1", ",", "int", "theOperand2", ")", "{", "if", "(", "DEBUGCODE", ")", "{", "System", ".", "out", ".", "println", "(", "\"Add \"", "+", "bytecodeStr", "(", "theOpCode", ")", "+", "...
Add the given two-operand bytecode to the current method. @param theOpCode the opcode of the bytecode @param theOperand1 the first operand of the bytecode @param theOperand2 the second operand of the bytecode
[ "Add", "the", "given", "two", "-", "operand", "bytecode", "to", "the", "current", "method", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/classfile/ClassFileWriter.java#L679-L726
21,459
mozilla/rhino
src/org/mozilla/classfile/ClassFileWriter.java
ClassFileWriter.addPush
public void addPush(int k) { if ((byte) k == k) { if (k == -1) { add(ByteCode.ICONST_M1); } else if (0 <= k && k <= 5) { add((byte) (ByteCode.ICONST_0 + k)); } else { add(ByteCode.BIPUSH, (byte) k); } } else ...
java
public void addPush(int k) { if ((byte) k == k) { if (k == -1) { add(ByteCode.ICONST_M1); } else if (0 <= k && k <= 5) { add((byte) (ByteCode.ICONST_0 + k)); } else { add(ByteCode.BIPUSH, (byte) k); } } else ...
[ "public", "void", "addPush", "(", "int", "k", ")", "{", "if", "(", "(", "byte", ")", "k", "==", "k", ")", "{", "if", "(", "k", "==", "-", "1", ")", "{", "add", "(", "ByteCode", ".", "ICONST_M1", ")", ";", "}", "else", "if", "(", "0", "<=", ...
Generate code to load the given integer on stack. @param k the constant
[ "Generate", "code", "to", "load", "the", "given", "integer", "on", "stack", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/classfile/ClassFileWriter.java#L904-L918
21,460
mozilla/rhino
src/org/mozilla/classfile/ClassFileWriter.java
ClassFileWriter.addPush
public void addPush(long k) { int ik = (int) k; if (ik == k) { addPush(ik); add(ByteCode.I2L); } else { addLoadConstant(k); } }
java
public void addPush(long k) { int ik = (int) k; if (ik == k) { addPush(ik); add(ByteCode.I2L); } else { addLoadConstant(k); } }
[ "public", "void", "addPush", "(", "long", "k", ")", "{", "int", "ik", "=", "(", "int", ")", "k", ";", "if", "(", "ik", "==", "k", ")", "{", "addPush", "(", "ik", ")", ";", "add", "(", "ByteCode", ".", "I2L", ")", ";", "}", "else", "{", "add...
Generate code to load the given long on stack. @param k the constant
[ "Generate", "code", "to", "load", "the", "given", "long", "on", "stack", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/classfile/ClassFileWriter.java#L929-L937
21,461
mozilla/rhino
src/org/mozilla/classfile/ClassFileWriter.java
ClassFileWriter.addPush
public void addPush(double k) { if (k == 0.0) { // zero add(ByteCode.DCONST_0); if (1.0 / k < 0) { // Negative zero add(ByteCode.DNEG); } } else if (k == 1.0 || k == -1.0) { add(ByteCode.DCONST_1); if...
java
public void addPush(double k) { if (k == 0.0) { // zero add(ByteCode.DCONST_0); if (1.0 / k < 0) { // Negative zero add(ByteCode.DNEG); } } else if (k == 1.0 || k == -1.0) { add(ByteCode.DCONST_1); if...
[ "public", "void", "addPush", "(", "double", "k", ")", "{", "if", "(", "k", "==", "0.0", ")", "{", "// zero", "add", "(", "ByteCode", ".", "DCONST_0", ")", ";", "if", "(", "1.0", "/", "k", "<", "0", ")", "{", "// Negative zero", "add", "(", "ByteC...
Generate code to load the given double on stack. @param k the constant
[ "Generate", "code", "to", "load", "the", "given", "double", "on", "stack", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/classfile/ClassFileWriter.java#L944-L960
21,462
mozilla/rhino
src/org/mozilla/classfile/ClassFileWriter.java
ClassFileWriter.addPush
public void addPush(String k) { int length = k.length(); int limit = itsConstantPool.getUtfEncodingLimit(k, 0, length); if (limit == length) { addLoadConstant(k); return; } // Split string into picies fitting the UTF limit and generate code for // ...
java
public void addPush(String k) { int length = k.length(); int limit = itsConstantPool.getUtfEncodingLimit(k, 0, length); if (limit == length) { addLoadConstant(k); return; } // Split string into picies fitting the UTF limit and generate code for // ...
[ "public", "void", "addPush", "(", "String", "k", ")", "{", "int", "length", "=", "k", ".", "length", "(", ")", ";", "int", "limit", "=", "itsConstantPool", ".", "getUtfEncodingLimit", "(", "k", ",", "0", ",", "length", ")", ";", "if", "(", "limit", ...
Generate the code to leave on stack the given string even if the string encoding exeeds the class file limit for single string constant @param k the constant
[ "Generate", "the", "code", "to", "leave", "on", "stack", "the", "given", "string", "even", "if", "the", "string", "encoding", "exeeds", "the", "class", "file", "limit", "for", "single", "string", "constant" ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/classfile/ClassFileWriter.java#L968-L1002
21,463
mozilla/rhino
src/org/mozilla/classfile/ClassFileWriter.java
ClassFileWriter.setTableSwitchJump
public void setTableSwitchJump(int switchStart, int caseIndex, int jumpTarget) { if (jumpTarget < 0 || itsCodeBufferTop < jumpTarget) throw new IllegalArgumentException("Bad jump target: " + jumpTarget); if (caseIndex < -1) throw new IllegalArgumentException("Bad case ind...
java
public void setTableSwitchJump(int switchStart, int caseIndex, int jumpTarget) { if (jumpTarget < 0 || itsCodeBufferTop < jumpTarget) throw new IllegalArgumentException("Bad jump target: " + jumpTarget); if (caseIndex < -1) throw new IllegalArgumentException("Bad case ind...
[ "public", "void", "setTableSwitchJump", "(", "int", "switchStart", ",", "int", "caseIndex", ",", "int", "jumpTarget", ")", "{", "if", "(", "jumpTarget", "<", "0", "||", "itsCodeBufferTop", "<", "jumpTarget", ")", "throw", "new", "IllegalArgumentException", "(", ...
Set a jump case for a tableswitch instruction. The jump target should be marked as a super block start for stack map generation.
[ "Set", "a", "jump", "case", "for", "a", "tableswitch", "instruction", ".", "The", "jump", "target", "should", "be", "marked", "as", "a", "super", "block", "start", "for", "stack", "map", "generation", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/classfile/ClassFileWriter.java#L1192-L1223
21,464
mozilla/rhino
src/org/mozilla/classfile/ClassFileWriter.java
ClassFileWriter.arrayTypeToName
private static char arrayTypeToName(int type) { switch (type) { case ByteCode.T_BOOLEAN: return 'Z'; case ByteCode.T_CHAR: return 'C'; case ByteCode.T_FLOAT: return 'F'; case ByteCode.T_DOUBLE: return...
java
private static char arrayTypeToName(int type) { switch (type) { case ByteCode.T_BOOLEAN: return 'Z'; case ByteCode.T_CHAR: return 'C'; case ByteCode.T_FLOAT: return 'F'; case ByteCode.T_DOUBLE: return...
[ "private", "static", "char", "arrayTypeToName", "(", "int", "type", ")", "{", "switch", "(", "type", ")", "{", "case", "ByteCode", ".", "T_BOOLEAN", ":", "return", "'", "'", ";", "case", "ByteCode", ".", "T_CHAR", ":", "return", "'", "'", ";", "case", ...
Convert a newarray operand into an internal type.
[ "Convert", "a", "newarray", "operand", "into", "an", "internal", "type", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/classfile/ClassFileWriter.java#L2611-L2632
21,465
mozilla/rhino
src/org/mozilla/classfile/ClassFileWriter.java
ClassFileWriter.descriptorToInternalName
private static String descriptorToInternalName(String descriptor) { switch (descriptor.charAt(0)) { case 'B': case 'C': case 'D': case 'F': case 'I': case 'J': case 'S': case 'Z': case 'V': ca...
java
private static String descriptorToInternalName(String descriptor) { switch (descriptor.charAt(0)) { case 'B': case 'C': case 'D': case 'F': case 'I': case 'J': case 'S': case 'Z': case 'V': ca...
[ "private", "static", "String", "descriptorToInternalName", "(", "String", "descriptor", ")", "{", "switch", "(", "descriptor", ".", "charAt", "(", "0", ")", ")", "{", "case", "'", "'", ":", "case", "'", "'", ":", "case", "'", "'", ":", "case", "'", "...
Convert a non-method type descriptor into an internal type. @param descriptor the simple type descriptor to convert
[ "Convert", "a", "non", "-", "method", "type", "descriptor", "into", "an", "internal", "type", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/classfile/ClassFileWriter.java#L2648-L2667
21,466
mozilla/rhino
src/org/mozilla/classfile/ClassFileWriter.java
ClassFileWriter.createInitialLocals
private int[] createInitialLocals() { int[] initialLocals = new int[itsMaxLocals]; int localsTop = 0; // Instance methods require the first local variable in the array // to be "this". However, if the method being created is a // constructor, aka the method is <init>, then the ty...
java
private int[] createInitialLocals() { int[] initialLocals = new int[itsMaxLocals]; int localsTop = 0; // Instance methods require the first local variable in the array // to be "this". However, if the method being created is a // constructor, aka the method is <init>, then the ty...
[ "private", "int", "[", "]", "createInitialLocals", "(", ")", "{", "int", "[", "]", "initialLocals", "=", "new", "int", "[", "itsMaxLocals", "]", ";", "int", "localsTop", "=", "0", ";", "// Instance methods require the first local variable in the array", "// to be \"...
Compute the initial local variable array for the current method. Creates an array of the size of the method's max locals, regardless of the number of parameters in the method.
[ "Compute", "the", "initial", "local", "variable", "array", "for", "the", "current", "method", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/classfile/ClassFileWriter.java#L2675-L2733
21,467
mozilla/rhino
src/org/mozilla/classfile/ClassFileWriter.java
ClassFileWriter.addSuperBlockStart
private void addSuperBlockStart(int pc) { if (GenerateStackMap) { if (itsSuperBlockStarts == null) { itsSuperBlockStarts = new int[SuperBlockStartsSize]; } else if (itsSuperBlockStarts.length == itsSuperBlockStartsTop) { int[] tmp = new int[itsSuperBlockSt...
java
private void addSuperBlockStart(int pc) { if (GenerateStackMap) { if (itsSuperBlockStarts == null) { itsSuperBlockStarts = new int[SuperBlockStartsSize]; } else if (itsSuperBlockStarts.length == itsSuperBlockStartsTop) { int[] tmp = new int[itsSuperBlockSt...
[ "private", "void", "addSuperBlockStart", "(", "int", "pc", ")", "{", "if", "(", "GenerateStackMap", ")", "{", "if", "(", "itsSuperBlockStarts", "==", "null", ")", "{", "itsSuperBlockStarts", "=", "new", "int", "[", "SuperBlockStartsSize", "]", ";", "}", "els...
Add a pc as the start of super block. A pc is the beginning of a super block if: - pc == 0 - it is the target of a branch instruction - it is the beginning of an exception handler - it is directly after an unconditional jump
[ "Add", "a", "pc", "as", "the", "start", "of", "super", "block", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/classfile/ClassFileWriter.java#L4344-L4356
21,468
mozilla/rhino
src/org/mozilla/classfile/ClassFileWriter.java
ClassFileWriter.finalizeSuperBlockStarts
private void finalizeSuperBlockStarts() { if (GenerateStackMap) { for (int i = 0; i < itsExceptionTableTop; i++) { ExceptionTableEntry ete = itsExceptionTable[i]; int handlerPC = getLabelPC(ete.itsHandlerLabel); addSuperBlockStart(handlerPC); ...
java
private void finalizeSuperBlockStarts() { if (GenerateStackMap) { for (int i = 0; i < itsExceptionTableTop; i++) { ExceptionTableEntry ete = itsExceptionTable[i]; int handlerPC = getLabelPC(ete.itsHandlerLabel); addSuperBlockStart(handlerPC); ...
[ "private", "void", "finalizeSuperBlockStarts", "(", ")", "{", "if", "(", "GenerateStackMap", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "itsExceptionTableTop", ";", "i", "++", ")", "{", "ExceptionTableEntry", "ete", "=", "itsExceptionTable", ...
Sort the list of recorded super block starts and remove duplicates. Also adds exception handling blocks as block starts, since there is no explicit control flow to these. Used for stack map table generation.
[ "Sort", "the", "list", "of", "recorded", "super", "block", "starts", "and", "remove", "duplicates", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/classfile/ClassFileWriter.java#L4364-L4389
21,469
mozilla/rhino
src/org/mozilla/javascript/ast/VariableDeclaration.java
VariableDeclaration.setVariables
public void setVariables(List<VariableInitializer> variables) { assertNotNull(variables); this.variables.clear(); for (VariableInitializer vi : variables) { addVariable(vi); } }
java
public void setVariables(List<VariableInitializer> variables) { assertNotNull(variables); this.variables.clear(); for (VariableInitializer vi : variables) { addVariable(vi); } }
[ "public", "void", "setVariables", "(", "List", "<", "VariableInitializer", ">", "variables", ")", "{", "assertNotNull", "(", "variables", ")", ";", "this", ".", "variables", ".", "clear", "(", ")", ";", "for", "(", "VariableInitializer", "vi", ":", "variable...
Sets variable list @throws IllegalArgumentException if variables list is {@code null}
[ "Sets", "variable", "list" ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ast/VariableDeclaration.java#L58-L64
21,470
mozilla/rhino
src/org/mozilla/javascript/ast/VariableDeclaration.java
VariableDeclaration.addVariable
public void addVariable(VariableInitializer v) { assertNotNull(v); variables.add(v); v.setParent(this); }
java
public void addVariable(VariableInitializer v) { assertNotNull(v); variables.add(v); v.setParent(this); }
[ "public", "void", "addVariable", "(", "VariableInitializer", "v", ")", "{", "assertNotNull", "(", "v", ")", ";", "variables", ".", "add", "(", "v", ")", ";", "v", ".", "setParent", "(", "this", ")", ";", "}" ]
Adds a variable initializer node to the child list. Sets initializer node's parent to this node. @throws IllegalArgumentException if v is {@code null}
[ "Adds", "a", "variable", "initializer", "node", "to", "the", "child", "list", ".", "Sets", "initializer", "node", "s", "parent", "to", "this", "node", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ast/VariableDeclaration.java#L71-L75
21,471
mozilla/rhino
src/org/mozilla/javascript/ast/VariableDeclaration.java
VariableDeclaration.setType
@Override public org.mozilla.javascript.Node setType(int type) { if (type != Token.VAR && type != Token.CONST && type != Token.LET) throw new IllegalArgumentException("invalid decl type: " + type); return super.setType(type); }
java
@Override public org.mozilla.javascript.Node setType(int type) { if (type != Token.VAR && type != Token.CONST && type != Token.LET) throw new IllegalArgumentException("invalid decl type: " + type); return super.setType(type); }
[ "@", "Override", "public", "org", ".", "mozilla", ".", "javascript", ".", "Node", "setType", "(", "int", "type", ")", "{", "if", "(", "type", "!=", "Token", ".", "VAR", "&&", "type", "!=", "Token", ".", "CONST", "&&", "type", "!=", "Token", ".", "L...
Sets the node type and returns this node. @throws IllegalArgumentException if {@code declType} is invalid
[ "Sets", "the", "node", "type", "and", "returns", "this", "node", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ast/VariableDeclaration.java#L81-L88
21,472
mozilla/rhino
src/org/mozilla/javascript/Parser.java
Parser.addStrictWarning
void addStrictWarning(String messageId, String messageArg) { int beg = -1, end = -1; if (ts != null) { beg = ts.tokenBeg; end = ts.tokenEnd - ts.tokenBeg; } addStrictWarning(messageId, messageArg, beg, end); }
java
void addStrictWarning(String messageId, String messageArg) { int beg = -1, end = -1; if (ts != null) { beg = ts.tokenBeg; end = ts.tokenEnd - ts.tokenBeg; } addStrictWarning(messageId, messageArg, beg, end); }
[ "void", "addStrictWarning", "(", "String", "messageId", ",", "String", "messageArg", ")", "{", "int", "beg", "=", "-", "1", ",", "end", "=", "-", "1", ";", "if", "(", "ts", "!=", "null", ")", "{", "beg", "=", "ts", ".", "tokenBeg", ";", "end", "=...
Add a strict warning on the last matched token.
[ "Add", "a", "strict", "warning", "on", "the", "last", "matched", "token", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/Parser.java#L184-L191
21,473
mozilla/rhino
src/org/mozilla/javascript/Parser.java
Parser.peekToken
private int peekToken() throws IOException { // By far the most common case: last token hasn't been consumed, // so return already-peeked token. if (currentFlaggedToken != Token.EOF) { return currentToken; } int lineno = ts.getLineno(); int tt = ...
java
private int peekToken() throws IOException { // By far the most common case: last token hasn't been consumed, // so return already-peeked token. if (currentFlaggedToken != Token.EOF) { return currentToken; } int lineno = ts.getLineno(); int tt = ...
[ "private", "int", "peekToken", "(", ")", "throws", "IOException", "{", "// By far the most common case: last token hasn't been consumed,", "// so return already-peeked token.", "if", "(", "currentFlaggedToken", "!=", "Token", ".", "EOF", ")", "{", "return", "currentToken", ...
The flags, if any, are saved in currentFlaggedToken.
[ "The", "flags", "if", "any", "are", "saved", "in", "currentFlaggedToken", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/Parser.java#L395-L429
21,474
mozilla/rhino
src/org/mozilla/javascript/Parser.java
Parser.parse
public AstRoot parse(String sourceString, String sourceURI, int lineno) { if (parseFinished) throw new IllegalStateException("parser reused"); this.sourceURI = sourceURI; if (compilerEnv.isIdeMode()) { this.sourceChars = sourceString.toCharArray(); } this.ts = new...
java
public AstRoot parse(String sourceString, String sourceURI, int lineno) { if (parseFinished) throw new IllegalStateException("parser reused"); this.sourceURI = sourceURI; if (compilerEnv.isIdeMode()) { this.sourceChars = sourceString.toCharArray(); } this.ts = new...
[ "public", "AstRoot", "parse", "(", "String", "sourceString", ",", "String", "sourceURI", ",", "int", "lineno", ")", "{", "if", "(", "parseFinished", ")", "throw", "new", "IllegalStateException", "(", "\"parser reused\"", ")", ";", "this", ".", "sourceURI", "="...
Builds a parse tree from the given source string. @return an {@link AstRoot} object representing the parsed program. If the parse fails, {@code null} will be returned. (The parse failure will result in a call to the {@link ErrorReporter} from {@link CompilerEnvirons}.)
[ "Builds", "a", "parse", "tree", "from", "the", "given", "source", "string", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/Parser.java#L584-L600
21,475
mozilla/rhino
src/org/mozilla/javascript/Parser.java
Parser.parse
public AstRoot parse(Reader sourceReader, String sourceURI, int lineno) throws IOException { if (parseFinished) throw new IllegalStateException("parser reused"); if (compilerEnv.isIdeMode()) { return parse(readFully(sourceReader), sourceURI, lineno); } try { ...
java
public AstRoot parse(Reader sourceReader, String sourceURI, int lineno) throws IOException { if (parseFinished) throw new IllegalStateException("parser reused"); if (compilerEnv.isIdeMode()) { return parse(readFully(sourceReader), sourceURI, lineno); } try { ...
[ "public", "AstRoot", "parse", "(", "Reader", "sourceReader", ",", "String", "sourceURI", ",", "int", "lineno", ")", "throws", "IOException", "{", "if", "(", "parseFinished", ")", "throw", "new", "IllegalStateException", "(", "\"parser reused\"", ")", ";", "if", ...
Builds a parse tree from the given sourcereader. @see #parse(String,String,int) @throws IOException if the {@link Reader} encounters an error
[ "Builds", "a", "parse", "tree", "from", "the", "given", "sourcereader", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/Parser.java#L607-L621
21,476
mozilla/rhino
src/org/mozilla/javascript/Parser.java
Parser.statements
private AstNode statements(AstNode parent) throws IOException { if (currentToken != Token.LC // assertion can be invalid in bad code && !compilerEnv.isIdeMode()) codeBug(); int pos = ts.tokenBeg; AstNode block = parent != null ? parent : new Block(pos); block.setLineno(ts.li...
java
private AstNode statements(AstNode parent) throws IOException { if (currentToken != Token.LC // assertion can be invalid in bad code && !compilerEnv.isIdeMode()) codeBug(); int pos = ts.tokenBeg; AstNode block = parent != null ? parent : new Block(pos); block.setLineno(ts.li...
[ "private", "AstNode", "statements", "(", "AstNode", "parent", ")", "throws", "IOException", "{", "if", "(", "currentToken", "!=", "Token", ".", "LC", "// assertion can be invalid in bad code", "&&", "!", "compilerEnv", ".", "isIdeMode", "(", ")", ")", "codeBug", ...
node are given relative start positions and correct lengths.
[ "node", "are", "given", "relative", "start", "positions", "and", "correct", "lengths", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/Parser.java#L1070-L1083
21,477
mozilla/rhino
src/org/mozilla/javascript/Parser.java
Parser.condition
private ConditionData condition() throws IOException { ConditionData data = new ConditionData(); if (mustMatchToken(Token.LP, "msg.no.paren.cond", true)) data.lp = ts.tokenBeg; data.condition = expr(); if (mustMatchToken(Token.RP, "msg.no.paren.after.cond", tru...
java
private ConditionData condition() throws IOException { ConditionData data = new ConditionData(); if (mustMatchToken(Token.LP, "msg.no.paren.cond", true)) data.lp = ts.tokenBeg; data.condition = expr(); if (mustMatchToken(Token.RP, "msg.no.paren.after.cond", tru...
[ "private", "ConditionData", "condition", "(", ")", "throws", "IOException", "{", "ConditionData", "data", "=", "new", "ConditionData", "(", ")", ";", "if", "(", "mustMatchToken", "(", "Token", ".", "LP", ",", "\"msg.no.paren.cond\"", ",", "true", ")", ")", "...
parse and return a parenthesized expression
[ "parse", "and", "return", "a", "parenthesized", "expression" ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/Parser.java#L1096-L1117
21,478
mozilla/rhino
src/org/mozilla/javascript/Parser.java
Parser.nowAllSet
private static final boolean nowAllSet(int before, int after, int mask) { return ((before & mask) != mask) && ((after & mask) == mask); }
java
private static final boolean nowAllSet(int before, int after, int mask) { return ((before & mask) != mask) && ((after & mask) == mask); }
[ "private", "static", "final", "boolean", "nowAllSet", "(", "int", "before", ",", "int", "after", ",", "int", "mask", ")", "{", "return", "(", "(", "before", "&", "mask", ")", "!=", "mask", ")", "&&", "(", "(", "after", "&", "mask", ")", "==", "mask...
Returns whether or not the bits in the mask have changed to all set. @param before bits before change @param after bits after change @param mask mask for bits @return {@code true} if all the bits in the mask are set in "after" but not in "before"
[ "Returns", "whether", "or", "not", "the", "bits", "in", "the", "mask", "have", "changed", "to", "all", "set", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/Parser.java#L1908-L1910
21,479
mozilla/rhino
src/org/mozilla/javascript/Parser.java
Parser.variables
private VariableDeclaration variables(int declType, int pos, boolean isStatement) throws IOException { int end; VariableDeclaration pn = new VariableDeclaration(pos); pn.setType(declType); pn.setLineno(ts.lineno); Comment varjsdocNode = getAndResetJsDoc(); if ...
java
private VariableDeclaration variables(int declType, int pos, boolean isStatement) throws IOException { int end; VariableDeclaration pn = new VariableDeclaration(pos); pn.setType(declType); pn.setLineno(ts.lineno); Comment varjsdocNode = getAndResetJsDoc(); if ...
[ "private", "VariableDeclaration", "variables", "(", "int", "declType", ",", "int", "pos", ",", "boolean", "isStatement", ")", "throws", "IOException", "{", "int", "end", ";", "VariableDeclaration", "pn", "=", "new", "VariableDeclaration", "(", "pos", ")", ";", ...
Parse a 'var' or 'const' statement, or a 'var' init list in a for statement. @param declType A token value: either VAR, CONST, or LET depending on context. @param pos the position where the node should start. It's sometimes the var/const/let keyword, and other times the beginning of the first token in the first variab...
[ "Parse", "a", "var", "or", "const", "statement", "or", "a", "var", "init", "list", "in", "a", "for", "statement", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/Parser.java#L2120-L2193
21,480
mozilla/rhino
src/org/mozilla/javascript/Parser.java
Parser.let
private AstNode let(boolean isStatement, int pos) throws IOException { LetNode pn = new LetNode(pos); pn.setLineno(ts.lineno); if (mustMatchToken(Token.LP, "msg.no.paren.after.let", true)) pn.setLp(ts.tokenBeg - pos); pushScope(pn); try { Varia...
java
private AstNode let(boolean isStatement, int pos) throws IOException { LetNode pn = new LetNode(pos); pn.setLineno(ts.lineno); if (mustMatchToken(Token.LP, "msg.no.paren.after.let", true)) pn.setLp(ts.tokenBeg - pos); pushScope(pn); try { Varia...
[ "private", "AstNode", "let", "(", "boolean", "isStatement", ",", "int", "pos", ")", "throws", "IOException", "{", "LetNode", "pn", "=", "new", "LetNode", "(", "pos", ")", ";", "pn", ".", "setLineno", "(", "ts", ".", "lineno", ")", ";", "if", "(", "mu...
have to pass in 'let' kwd position to compute kid offsets properly
[ "have", "to", "pass", "in", "let", "kwd", "position", "to", "compute", "kid", "offsets", "properly" ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/Parser.java#L2196-L2237
21,481
mozilla/rhino
src/org/mozilla/javascript/Parser.java
Parser.propertyAccess
private AstNode propertyAccess(int tt, AstNode pn) throws IOException { if (pn == null) codeBug(); int memberTypeFlags = 0, lineno = ts.lineno, dotPos = ts.tokenBeg; consumeToken(); if (tt == Token.DOTDOT) { mustHaveXML(); memberTypeFlags = Node.D...
java
private AstNode propertyAccess(int tt, AstNode pn) throws IOException { if (pn == null) codeBug(); int memberTypeFlags = 0, lineno = ts.lineno, dotPos = ts.tokenBeg; consumeToken(); if (tt == Token.DOTDOT) { mustHaveXML(); memberTypeFlags = Node.D...
[ "private", "AstNode", "propertyAccess", "(", "int", "tt", ",", "AstNode", "pn", ")", "throws", "IOException", "{", "if", "(", "pn", "==", "null", ")", "codeBug", "(", ")", ";", "int", "memberTypeFlags", "=", "0", ",", "lineno", "=", "ts", ".", "lineno"...
Handles any construct following a "." or ".." operator. @param pn the left-hand side (target) of the operator. Never null. @return a PropertyGet, XmlMemberGet, or ErrorNode
[ "Handles", "any", "construct", "following", "a", ".", "or", "..", "operator", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/Parser.java#L2881-L2967
21,482
mozilla/rhino
src/org/mozilla/javascript/Parser.java
Parser.arrayComprehension
private AstNode arrayComprehension(AstNode result, int pos) throws IOException { List<ArrayComprehensionLoop> loops = new ArrayList<ArrayComprehensionLoop>(); while (peekToken() == Token.FOR) { loops.add(arrayComprehensionLoop()); } int ifPos = -1;...
java
private AstNode arrayComprehension(AstNode result, int pos) throws IOException { List<ArrayComprehensionLoop> loops = new ArrayList<ArrayComprehensionLoop>(); while (peekToken() == Token.FOR) { loops.add(arrayComprehensionLoop()); } int ifPos = -1;...
[ "private", "AstNode", "arrayComprehension", "(", "AstNode", "result", ",", "int", "pos", ")", "throws", "IOException", "{", "List", "<", "ArrayComprehensionLoop", ">", "loops", "=", "new", "ArrayList", "<", "ArrayComprehensionLoop", ">", "(", ")", ";", "while", ...
Parse a JavaScript 1.7 Array comprehension. @param result the first expression after the opening left-bracket @param pos start of LB token that begins the array comprehension @return the array comprehension or an error node
[ "Parse", "a", "JavaScript", "1", ".", "7", "Array", "comprehension", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/Parser.java#L3323-L3349
21,483
mozilla/rhino
src/org/mozilla/javascript/Parser.java
Parser.lineBeginningFor
private int lineBeginningFor(int pos) { if (sourceChars == null) { return -1; } if (pos <= 0) { return 0; } char[] buf = sourceChars; if (pos >= buf.length) { pos = buf.length - 1; } while (--pos >= 0) { char...
java
private int lineBeginningFor(int pos) { if (sourceChars == null) { return -1; } if (pos <= 0) { return 0; } char[] buf = sourceChars; if (pos >= buf.length) { pos = buf.length - 1; } while (--pos >= 0) { char...
[ "private", "int", "lineBeginningFor", "(", "int", "pos", ")", "{", "if", "(", "sourceChars", "==", "null", ")", "{", "return", "-", "1", ";", "}", "if", "(", "pos", "<=", "0", ")", "{", "return", "0", ";", "}", "char", "[", "]", "buf", "=", "so...
Return the file offset of the beginning of the input source line containing the passed position. @param pos an offset into the input source stream. If the offset is negative, it's converted to 0, and if it's beyond the end of the source buffer, the last source position is used. @return the offset of the beginning of...
[ "Return", "the", "file", "offset", "of", "the", "beginning", "of", "the", "input", "source", "line", "containing", "the", "passed", "position", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/Parser.java#L3872-L3890
21,484
mozilla/rhino
src/org/mozilla/javascript/Parser.java
Parser.createDestructuringAssignment
Node createDestructuringAssignment(int type, Node left, Node right) { String tempName = currentScriptOrFn.getNextTempName(); Node result = destructuringAssignmentHelper(type, left, right, tempName); Node comma = result.getLastChild(); comma.addChildToBack(createName(tempN...
java
Node createDestructuringAssignment(int type, Node left, Node right) { String tempName = currentScriptOrFn.getNextTempName(); Node result = destructuringAssignmentHelper(type, left, right, tempName); Node comma = result.getLastChild(); comma.addChildToBack(createName(tempN...
[ "Node", "createDestructuringAssignment", "(", "int", "type", ",", "Node", "left", ",", "Node", "right", ")", "{", "String", "tempName", "=", "currentScriptOrFn", ".", "getNextTempName", "(", ")", ";", "Node", "result", "=", "destructuringAssignmentHelper", "(", ...
Given a destructuring assignment with a left hand side parsed as an array or object literal and a right hand side expression, rewrite as a series of assignments to the variables defined in left from property accesses to the expression on the right. @param type declaration type: Token.VAR or Token.LET or -1 @param left ...
[ "Given", "a", "destructuring", "assignment", "with", "a", "left", "hand", "side", "parsed", "as", "an", "array", "or", "object", "literal", "and", "a", "right", "hand", "side", "expression", "rewrite", "as", "a", "series", "of", "assignments", "to", "the", ...
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/Parser.java#L3996-L4004
21,485
mozilla/rhino
src/org/mozilla/javascript/Parser.java
Parser.simpleAssignment
protected Node simpleAssignment(Node left, Node right) { int nodeType = left.getType(); switch (nodeType) { case Token.NAME: String name = ((Name) left).getIdentifier(); if (inUseStrictDirective && ("eval".equals(name) || "arguments".equals(name)))...
java
protected Node simpleAssignment(Node left, Node right) { int nodeType = left.getType(); switch (nodeType) { case Token.NAME: String name = ((Name) left).getIdentifier(); if (inUseStrictDirective && ("eval".equals(name) || "arguments".equals(name)))...
[ "protected", "Node", "simpleAssignment", "(", "Node", "left", ",", "Node", "right", ")", "{", "int", "nodeType", "=", "left", ".", "getType", "(", ")", ";", "switch", "(", "nodeType", ")", "{", "case", "Token", ".", "NAME", ":", "String", "name", "=", ...
side effects in the RHS.
[ "side", "effects", "in", "the", "RHS", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/Parser.java#L4204-L4257
21,486
mozilla/rhino
src/org/mozilla/javascript/Parser.java
Parser.removeParens
protected AstNode removeParens(AstNode node) { while (node instanceof ParenthesizedExpression) { node = ((ParenthesizedExpression)node).getExpression(); } return node; }
java
protected AstNode removeParens(AstNode node) { while (node instanceof ParenthesizedExpression) { node = ((ParenthesizedExpression)node).getExpression(); } return node; }
[ "protected", "AstNode", "removeParens", "(", "AstNode", "node", ")", "{", "while", "(", "node", "instanceof", "ParenthesizedExpression", ")", "{", "node", "=", "(", "(", "ParenthesizedExpression", ")", "node", ")", ".", "getExpression", "(", ")", ";", "}", "...
remove any ParenthesizedExpression wrappers
[ "remove", "any", "ParenthesizedExpression", "wrappers" ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/Parser.java#L4267-L4272
21,487
mozilla/rhino
src/org/mozilla/javascript/Parser.java
Parser.codeBug
private RuntimeException codeBug() throws RuntimeException { throw Kit.codeBug("ts.cursor=" + ts.cursor + ", ts.tokenBeg=" + ts.tokenBeg + ", currentToken=" + currentToken); }
java
private RuntimeException codeBug() throws RuntimeException { throw Kit.codeBug("ts.cursor=" + ts.cursor + ", ts.tokenBeg=" + ts.tokenBeg + ", currentToken=" + currentToken); }
[ "private", "RuntimeException", "codeBug", "(", ")", "throws", "RuntimeException", "{", "throw", "Kit", ".", "codeBug", "(", "\"ts.cursor=\"", "+", "ts", ".", "cursor", "+", "\", ts.tokenBeg=\"", "+", "ts", ".", "tokenBeg", "+", "\", currentToken=\"", "+", "curre...
throw a failed-assertion with some helpful debugging info
[ "throw", "a", "failed", "-", "assertion", "with", "some", "helpful", "debugging", "info" ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/Parser.java#L4283-L4289
21,488
mozilla/rhino
src/org/mozilla/javascript/jdk18/VMBridge_jdk18.java
VMBridge_jdk18.getJavaIterator
@Override protected Iterator<?> getJavaIterator(Context cx, Scriptable scope, Object obj) { if (obj instanceof Wrapper) { Object unwrapped = ((Wrapper) obj).unwrap(); Iterator<?> iterator = null; if (unwrapped instanceof Iterator) iterator = (Iterator<?>) ...
java
@Override protected Iterator<?> getJavaIterator(Context cx, Scriptable scope, Object obj) { if (obj instanceof Wrapper) { Object unwrapped = ((Wrapper) obj).unwrap(); Iterator<?> iterator = null; if (unwrapped instanceof Iterator) iterator = (Iterator<?>) ...
[ "@", "Override", "protected", "Iterator", "<", "?", ">", "getJavaIterator", "(", "Context", "cx", ",", "Scriptable", "scope", ",", "Object", "obj", ")", "{", "if", "(", "obj", "instanceof", "Wrapper", ")", "{", "Object", "unwrapped", "=", "(", "(", "Wrap...
If "obj" is a java.util.Iterator or a java.lang.Iterable, return a wrapping as a JavaScript Iterator. Otherwise, return null. This method is in VMBridge since Iterable is a JDK 1.5 addition.
[ "If", "obj", "is", "a", "java", ".", "util", ".", "Iterator", "or", "a", "java", ".", "lang", ".", "Iterable", "return", "a", "wrapping", "as", "a", "JavaScript", "Iterator", ".", "Otherwise", "return", "null", ".", "This", "method", "is", "in", "VMBri...
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/jdk18/VMBridge_jdk18.java#L152-L164
21,489
mozilla/rhino
src/org/mozilla/javascript/ast/PropertyGet.java
PropertyGet.visit
@Override public void visit(NodeVisitor v) { if (v.visit(this)) { getTarget().visit(v); getProperty().visit(v); } }
java
@Override public void visit(NodeVisitor v) { if (v.visit(this)) { getTarget().visit(v); getProperty().visit(v); } }
[ "@", "Override", "public", "void", "visit", "(", "NodeVisitor", "v", ")", "{", "if", "(", "v", ".", "visit", "(", "this", ")", ")", "{", "getTarget", "(", ")", ".", "visit", "(", "v", ")", ";", "getProperty", "(", ")", ".", "visit", "(", "v", "...
Visits this node, the target expression, and the property name.
[ "Visits", "this", "node", "the", "target", "expression", "and", "the", "property", "name", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ast/PropertyGet.java#L93-L99
21,490
mozilla/rhino
src/org/mozilla/javascript/ast/DoLoop.java
DoLoop.visit
@Override public void visit(NodeVisitor v) { if (v.visit(this)) { body.visit(v); condition.visit(v); } }
java
@Override public void visit(NodeVisitor v) { if (v.visit(this)) { body.visit(v); condition.visit(v); } }
[ "@", "Override", "public", "void", "visit", "(", "NodeVisitor", "v", ")", "{", "if", "(", "v", ".", "visit", "(", "this", ")", ")", "{", "body", ".", "visit", "(", "v", ")", ";", "condition", ".", "visit", "(", "v", ")", ";", "}", "}" ]
Visits this node, the body, and then the while-expression.
[ "Visits", "this", "node", "the", "body", "and", "then", "the", "while", "-", "expression", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ast/DoLoop.java#L86-L92
21,491
mozilla/rhino
src/org/mozilla/javascript/InterfaceAdapter.java
InterfaceAdapter.create
static Object create(Context cx, Class<?> cl, ScriptableObject object) { if (!cl.isInterface()) throw new IllegalArgumentException(); Scriptable topScope = ScriptRuntime.getTopCallScope(cx); ClassCache cache = ClassCache.get(topScope); InterfaceAdapter adapter; adapter = (In...
java
static Object create(Context cx, Class<?> cl, ScriptableObject object) { if (!cl.isInterface()) throw new IllegalArgumentException(); Scriptable topScope = ScriptRuntime.getTopCallScope(cx); ClassCache cache = ClassCache.get(topScope); InterfaceAdapter adapter; adapter = (In...
[ "static", "Object", "create", "(", "Context", "cx", ",", "Class", "<", "?", ">", "cl", ",", "ScriptableObject", "object", ")", "{", "if", "(", "!", "cl", ".", "isInterface", "(", ")", ")", "throw", "new", "IllegalArgumentException", "(", ")", ";", "Scr...
Make glue object implementing interface cl that will call the supplied JS function when called. Only interfaces were all methods have the same signature is supported. @return The glue object or null if <tt>cl</tt> is not interface or has methods with different signatures.
[ "Make", "glue", "object", "implementing", "interface", "cl", "that", "will", "call", "the", "supplied", "JS", "function", "when", "called", ".", "Only", "interfaces", "were", "all", "methods", "have", "the", "same", "signature", "is", "supported", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/InterfaceAdapter.java#L27-L64
21,492
mozilla/rhino
src/org/mozilla/javascript/ast/ArrayComprehension.java
ArrayComprehension.visit
@Override public void visit(NodeVisitor v) { if (!v.visit(this)) { return; } result.visit(v); for (ArrayComprehensionLoop loop : loops) { loop.visit(v); } if (filter != null) { filter.visit(v); } }
java
@Override public void visit(NodeVisitor v) { if (!v.visit(this)) { return; } result.visit(v); for (ArrayComprehensionLoop loop : loops) { loop.visit(v); } if (filter != null) { filter.visit(v); } }
[ "@", "Override", "public", "void", "visit", "(", "NodeVisitor", "v", ")", "{", "if", "(", "!", "v", ".", "visit", "(", "this", ")", ")", "{", "return", ";", "}", "result", ".", "visit", "(", "v", ")", ";", "for", "(", "ArrayComprehensionLoop", "loo...
Visits this node, the result expression, the loops, and the optional filter.
[ "Visits", "this", "node", "the", "result", "expression", "the", "loops", "and", "the", "optional", "filter", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ast/ArrayComprehension.java#L169-L181
21,493
mozilla/rhino
src/org/mozilla/javascript/ast/ExpressionStatement.java
ExpressionStatement.setExpression
public void setExpression(AstNode expression) { assertNotNull(expression); expr = expression; expression.setParent(this); setLineno(expression.getLineno()); }
java
public void setExpression(AstNode expression) { assertNotNull(expression); expr = expression; expression.setParent(this); setLineno(expression.getLineno()); }
[ "public", "void", "setExpression", "(", "AstNode", "expression", ")", "{", "assertNotNull", "(", "expression", ")", ";", "expr", "=", "expression", ";", "expression", ".", "setParent", "(", "this", ")", ";", "setLineno", "(", "expression", ".", "getLineno", ...
Sets the wrapped expression, and sets its parent to this node. @throws IllegalArgumentException} if expression is {@code null}
[ "Sets", "the", "wrapped", "expression", "and", "sets", "its", "parent", "to", "this", "node", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ast/ExpressionStatement.java#L89-L94
21,494
mozilla/rhino
src/org/mozilla/javascript/ast/InfixExpression.java
InfixExpression.setLeft
public void setLeft(AstNode left) { assertNotNull(left); this.left = left; // line number should agree with source position setLineno(left.getLineno()); left.setParent(this); }
java
public void setLeft(AstNode left) { assertNotNull(left); this.left = left; // line number should agree with source position setLineno(left.getLineno()); left.setParent(this); }
[ "public", "void", "setLeft", "(", "AstNode", "left", ")", "{", "assertNotNull", "(", "left", ")", ";", "this", ".", "left", "=", "left", ";", "// line number should agree with source position", "setLineno", "(", "left", ".", "getLineno", "(", ")", ")", ";", ...
Sets the left-hand side of the expression, and sets its parent to this node. @param left the left-hand side of the expression @throws IllegalArgumentException} if left is {@code null}
[ "Sets", "the", "left", "-", "hand", "side", "of", "the", "expression", "and", "sets", "its", "parent", "to", "this", "node", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ast/InfixExpression.java#L104-L110
21,495
mozilla/rhino
src/org/mozilla/javascript/ast/InfixExpression.java
InfixExpression.visit
@Override public void visit(NodeVisitor v) { if (v.visit(this)) { left.visit(v); right.visit(v); } }
java
@Override public void visit(NodeVisitor v) { if (v.visit(this)) { left.visit(v); right.visit(v); } }
[ "@", "Override", "public", "void", "visit", "(", "NodeVisitor", "v", ")", "{", "if", "(", "v", ".", "visit", "(", "this", ")", ")", "{", "left", ".", "visit", "(", "v", ")", ";", "right", ".", "visit", "(", "v", ")", ";", "}", "}" ]
Visits this node, the left operand, and the right operand.
[ "Visits", "this", "node", "the", "left", "operand", "and", "the", "right", "operand", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ast/InfixExpression.java#L178-L184
21,496
mozilla/rhino
src/org/mozilla/javascript/ScriptRuntime.java
ScriptRuntime.toNumber
public static double toNumber(Object val) { for (;;) { if (val instanceof Number) return ((Number) val).doubleValue(); if (val == null) return +0.0; if (val == Undefined.instance) return NaN; if (val instanceof S...
java
public static double toNumber(Object val) { for (;;) { if (val instanceof Number) return ((Number) val).doubleValue(); if (val == null) return +0.0; if (val == Undefined.instance) return NaN; if (val instanceof S...
[ "public", "static", "double", "toNumber", "(", "Object", "val", ")", "{", "for", "(", ";", ";", ")", "{", "if", "(", "val", "instanceof", "Number", ")", "return", "(", "(", "Number", ")", "val", ")", ".", "doubleValue", "(", ")", ";", "if", "(", ...
Convert the value to a number. See ECMA 9.3.
[ "Convert", "the", "value", "to", "a", "number", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ScriptRuntime.java#L426-L452
21,497
mozilla/rhino
src/org/mozilla/javascript/ScriptRuntime.java
ScriptRuntime.padArguments
public static Object[] padArguments(Object[] args, int count) { if (count < args.length) return args; int i; Object[] result = new Object[count]; for (i = 0; i < args.length; i++) { result[i] = args[i]; } for (; i < count; i++) { resu...
java
public static Object[] padArguments(Object[] args, int count) { if (count < args.length) return args; int i; Object[] result = new Object[count]; for (i = 0; i < args.length; i++) { result[i] = args[i]; } for (; i < count; i++) { resu...
[ "public", "static", "Object", "[", "]", "padArguments", "(", "Object", "[", "]", "args", ",", "int", "count", ")", "{", "if", "(", "count", "<", "args", ".", "length", ")", "return", "args", ";", "int", "i", ";", "Object", "[", "]", "result", "=", ...
Helper function for builtin objects that use the varargs form. ECMA function formal arguments are undefined if not supplied; this function pads the argument array out to the expected length, if necessary.
[ "Helper", "function", "for", "builtin", "objects", "that", "use", "the", "varargs", "form", ".", "ECMA", "function", "formal", "arguments", "are", "undefined", "if", "not", "supplied", ";", "this", "function", "pads", "the", "argument", "array", "out", "to", ...
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ScriptRuntime.java#L745-L760
21,498
mozilla/rhino
src/org/mozilla/javascript/ScriptRuntime.java
ScriptRuntime.escapeString
public static String escapeString(String s, char escapeQuote) { if (!(escapeQuote == '"' || escapeQuote == '\'' || escapeQuote == '`')) Kit.codeBug(); StringBuilder sb = null; for(int i = 0, L = s.length(); i != L; ++i) { int c = s.charAt(i); if (' ' <= c && c <= '~...
java
public static String escapeString(String s, char escapeQuote) { if (!(escapeQuote == '"' || escapeQuote == '\'' || escapeQuote == '`')) Kit.codeBug(); StringBuilder sb = null; for(int i = 0, L = s.length(); i != L; ++i) { int c = s.charAt(i); if (' ' <= c && c <= '~...
[ "public", "static", "String", "escapeString", "(", "String", "s", ",", "char", "escapeQuote", ")", "{", "if", "(", "!", "(", "escapeQuote", "==", "'", "'", "||", "escapeQuote", "==", "'", "'", "||", "escapeQuote", "==", "'", "'", ")", ")", "Kit", "."...
For escaping strings printed by object and array literals; not quite the same as 'escape.'
[ "For", "escaping", "strings", "printed", "by", "object", "and", "array", "literals", ";", "not", "quite", "the", "same", "as", "escape", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ScriptRuntime.java#L771-L831
21,499
mozilla/rhino
src/org/mozilla/javascript/ScriptRuntime.java
ScriptRuntime.toObject
public static Scriptable toObject(Context cx, Scriptable scope, Object val) { if (val == null) { throw typeError0("msg.null.to.object"); } if (Undefined.isUndefined(val)) { throw typeError0("msg.undef.to.object"); } if (isSymbol(val)) { Na...
java
public static Scriptable toObject(Context cx, Scriptable scope, Object val) { if (val == null) { throw typeError0("msg.null.to.object"); } if (Undefined.isUndefined(val)) { throw typeError0("msg.undef.to.object"); } if (isSymbol(val)) { Na...
[ "public", "static", "Scriptable", "toObject", "(", "Context", "cx", ",", "Scriptable", "scope", ",", "Object", "val", ")", "{", "if", "(", "val", "==", "null", ")", "{", "throw", "typeError0", "(", "\"msg.null.to.object\"", ")", ";", "}", "if", "(", "Und...
Convert the value to an object. See ECMA 9.9.
[ "Convert", "the", "value", "to", "an", "object", "." ]
fa8a86df11d37623f5faa8d445a5876612bc47b0
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ScriptRuntime.java#L1111-L1150