Java Code Examples for com.google.javascript.rhino.Node#isNull()
The following examples show how to use
com.google.javascript.rhino.Node#isNull() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TypeConversionPass.java From clutz with MIT License | 5 votes |
/** Converts goog.defineClass calls into class definitions. */ private void convertDefineClassToClass(Node n) { Preconditions.checkState(n.isCall()); Node superClass = n.getSecondChild(); if (superClass.isNull()) { superClass = IR.empty(); } else { superClass.detach(); } Node classMembers = new Node(Token.CLASS_MEMBERS); classMembers.useSourceInfoFrom(n); for (Node child : n.getLastChild().children()) { if (child.isStringKey() || child.isMemberFunctionDef()) { // Handle static methods if ("statics".equals(child.getString())) { for (Node child2 : child.getFirstChild().children()) { convertObjectLiteral(classMembers, child2, true); } } else { // prototype methods convertObjectLiteral(classMembers, child, false); } } else { // Add all other members, such as EMPTY comment nodes, as is. child.detach(); classMembers.addChildToBack(child); } } Node classNode = new Node(Token.CLASS, IR.empty(), superClass, classMembers); classNode.useSourceInfoFrom(n); nodeComments.replaceWithComment(n, classNode); }
Example 2
Source File: Closure_10_NodeUtil_s.java From coming with MIT License | 4 votes |
static boolean mayBeStringHelper(Node n) { return !isNumericResult(n) && !isBooleanResult(n) && !isUndefined(n) && !n.isNull(); }
Example 3
Source File: jKali_003_s.java From coming with MIT License | 4 votes |
static boolean mayBeStringHelper(Node n) { return !isNumericResult(n) && !isBooleanResult(n) && !isUndefined(n) && !n.isNull(); }
Example 4
Source File: Closure_10_NodeUtil_s.java From coming with MIT License | 4 votes |
static boolean isNullOrUndefined(Node n) { return n.isNull() || isUndefined(n); }
Example 5
Source File: jKali_003_t.java From coming with MIT License | 4 votes |
static boolean isNullOrUndefined(Node n) { return n.isNull() || isUndefined(n); }
Example 6
Source File: Cardumen_0087_t.java From coming with MIT License | 4 votes |
static boolean mayBeStringHelper(Node n) { return !isNumericResult(n) && !isBooleanResult(n) && !isUndefined(n) && !n.isNull(); }
Example 7
Source File: jMutRepair_003_s.java From coming with MIT License | 4 votes |
static boolean mayBeStringHelper(Node n) { return !isNumericResult(n) && !isBooleanResult(n) && !isUndefined(n) && !n.isNull(); }
Example 8
Source File: Cardumen_0087_s.java From coming with MIT License | 4 votes |
static boolean mayBeStringHelper(Node n) { return !isNumericResult(n) && !isBooleanResult(n) && !isUndefined(n) && !n.isNull(); }
Example 9
Source File: jMutRepair_003_t.java From coming with MIT License | 4 votes |
static boolean isNullOrUndefined(Node n) { return n.isNull() || isUndefined(n); }
Example 10
Source File: Cardumen_0014_s.java From coming with MIT License | 4 votes |
static boolean mayBeStringHelper(Node n) { return !isNumericResult(n) && !isBooleanResult(n) && !isUndefined(n) && !n.isNull(); }
Example 11
Source File: Cardumen_0014_s.java From coming with MIT License | 4 votes |
static boolean isNullOrUndefined(Node n) { return n.isNull() || isUndefined(n); }
Example 12
Source File: Cardumen_0014_t.java From coming with MIT License | 4 votes |
static boolean isNullOrUndefined(Node n) { return n.isNull() || isUndefined(n); }
Example 13
Source File: Cardumen_00149_t.java From coming with MIT License | 4 votes |
static boolean mayBeStringHelper(Node n) { return !isNumericResult(n) && !isBooleanResult(n) && !isUndefined(n) && !n.isNull(); }
Example 14
Source File: jMutRepair_003_t.java From coming with MIT License | 4 votes |
static boolean mayBeStringHelper(Node n) { return !isNumericResult(n) && !isBooleanResult(n) && !isUndefined(n) && !n.isNull(); }
Example 15
Source File: Cardumen_00149_s.java From coming with MIT License | 4 votes |
static boolean mayBeStringHelper(Node n) { return !isNumericResult(n) && !isBooleanResult(n) && !isUndefined(n) && !n.isNull(); }
Example 16
Source File: Cardumen_00149_s.java From coming with MIT License | 4 votes |
static boolean isNullOrUndefined(Node n) { return n.isNull() || isUndefined(n); }
Example 17
Source File: ClosureRewriteClass.java From astor with GNU General Public License v2.0 | 4 votes |
/** * Validates the class definition and if valid, destructively extracts * the class definition from the AST. */ private ClassDefinition extractClassDefinition( Node targetName, Node callNode) { // name = goog.defineClass(superClass, {...}, [modifier, ...]) Node superClass = NodeUtil.getArgumentForCallOrNew(callNode, 0); if (superClass == null || (!superClass.isNull() && !superClass.isQualifiedName())) { compiler.report(JSError.make(callNode, GOOG_CLASS_SUPER_CLASS_NOT_VALID)); return null; } if (NodeUtil.isNullOrUndefined(superClass)) { superClass = null; } Node description = NodeUtil.getArgumentForCallOrNew(callNode, 1); if (description == null || !description.isObjectLit() || !validateObjLit(description)) { // report bad class definition compiler.report(JSError.make(callNode, GOOG_CLASS_DESCRIPTOR_NOT_VALID)); return null; } int paramCount = callNode.getChildCount() -1; if (paramCount > 2) { compiler.report(JSError.make(callNode, GOOG_CLASS_UNEXPECTED_PARAMS)); return null; } Node constructor = extractProperty(description, "constructor"); if (constructor == null) { // report missing constructor compiler.report(JSError.make(description, GOOG_CLASS_CONSTRUCTOR_MISING)); return null; } JSDocInfo info = NodeUtil.getBestJSDocInfo(constructor); Node classModifier = null; Node statics = null; Node staticsProp = extractProperty(description, "statics"); if (staticsProp != null) { if (staticsProp.isObjectLit() && validateObjLit(staticsProp)) { statics = staticsProp; } else if (staticsProp.isFunction()) { classModifier = staticsProp; } else { compiler.report( JSError.make(staticsProp, GOOG_CLASS_STATICS_NOT_VALID)); return null; } } if (statics == null) { statics = IR.objectlit(); } // Ok, now rip apart the definition into its component pieces. // Remove the "special" property key nodes. maybeDetach(constructor.getParent()); maybeDetach(statics.getParent()); if (classModifier != null) { maybeDetach(classModifier.getParent()); } ClassDefinition def = new ClassDefinition( targetName, maybeDetach(superClass), new MemberDefinition(info, null, maybeDetach(constructor)), objectLitToList(maybeDetach(statics)), objectLitToList(description), maybeDetach(classModifier)); return def; }
Example 18
Source File: Cardumen_00200_t.java From coming with MIT License | 4 votes |
static boolean isNullOrUndefined(Node n) { return n.isNull() || isUndefined(n); }
Example 19
Source File: Cardumen_00200_s.java From coming with MIT License | 4 votes |
static boolean mayBeStringHelper(Node n) { return !isNumericResult(n) && !isBooleanResult(n) && !isUndefined(n) && !n.isNull(); }
Example 20
Source File: Cardumen_00200_s.java From coming with MIT License | 4 votes |
static boolean isNullOrUndefined(Node n) { return n.isNull() || isUndefined(n); }