Package org.fife.rsta.ac.js.util
Class RhinoUtil
- java.lang.Object
-
- org.fife.rsta.ac.js.util.RhinoUtil
-
public class RhinoUtil extends java.lang.ObjectUtility methods for walking ASTs from Rhino.- Version:
- 1.0
-
-
Constructor Summary
Constructors Modifier Constructor Description privateRhinoUtil()Private constructor to prevent instantiation.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringgetFunctionArgsString(org.mozilla.javascript.ast.FunctionNode fn)Iterates through a function's parameters and returns a string representation of them, suitable for presentation as part of the method's signature.static java.lang.StringgetPropertyName(org.mozilla.javascript.ast.AstNode propKeyNode)Property keys in object literals can be identifiers or string literals.static java.lang.StringgetPrototypeClazz(java.util.List<org.mozilla.javascript.ast.AstNode> nodes)static java.lang.StringgetPrototypeClazz(java.util.List<org.mozilla.javascript.ast.AstNode> nodes, int depth)private static booleanisName(org.mozilla.javascript.ast.AstNode node, java.lang.String value)Returns whether an AST node is aNamewith the specified value.static booleanisPrototypeNameNode(org.mozilla.javascript.ast.AstNode node)static booleanisPrototypePropertyGet(org.mozilla.javascript.ast.PropertyGet pg)static booleanisSimplePropertyGet(org.mozilla.javascript.ast.PropertyGet pg, java.lang.String expectedObj, java.lang.String expectedField)Returns whether aPropertyGetis a simple one, referencing an object's value 1 level deep.static java.util.List<org.mozilla.javascript.ast.AstNode>toList(org.mozilla.javascript.ast.AstNode... nodes)
-
-
-
Method Detail
-
getFunctionArgsString
public static java.lang.String getFunctionArgsString(org.mozilla.javascript.ast.FunctionNode fn)
Iterates through a function's parameters and returns a string representation of them, suitable for presentation as part of the method's signature.- Parameters:
fn- The function node.- Returns:
- The string representation of the function's arguments.
-
getPropertyName
public static java.lang.String getPropertyName(org.mozilla.javascript.ast.AstNode propKeyNode)
Property keys in object literals can be identifiers or string literals. This method takes an AST node that was the key of anObjectPropertyand returns its value, no matter what the concrete AST node's type.- Parameters:
propKeyNode- The AST node for the property key.- Returns:
- The property key's value.
-
getPrototypeClazz
public static java.lang.String getPrototypeClazz(java.util.List<org.mozilla.javascript.ast.AstNode> nodes)
-
getPrototypeClazz
public static java.lang.String getPrototypeClazz(java.util.List<org.mozilla.javascript.ast.AstNode> nodes, int depth)
-
isName
private static boolean isName(org.mozilla.javascript.ast.AstNode node, java.lang.String value)Returns whether an AST node is aNamewith the specified value.- Parameters:
node- The AST node.value- The expected value.- Returns:
- Whether the AST node is a
Namewith the specified value.
-
isPrototypeNameNode
public static boolean isPrototypeNameNode(org.mozilla.javascript.ast.AstNode node)
-
isPrototypePropertyGet
public static boolean isPrototypePropertyGet(org.mozilla.javascript.ast.PropertyGet pg)
-
isSimplePropertyGet
public static boolean isSimplePropertyGet(org.mozilla.javascript.ast.PropertyGet pg, java.lang.String expectedObj, java.lang.String expectedField)Returns whether aPropertyGetis a simple one, referencing an object's value 1 level deep. For example,Object.create.- Parameters:
pg- ThePropertyGet.expectedObj- The expected object value.expectedField- The expected string value.- Returns:
- Whether the object is what was expected.
-
toList
public static java.util.List<org.mozilla.javascript.ast.AstNode> toList(org.mozilla.javascript.ast.AstNode... nodes)
-
-