Returns the innermost enclosing function, or {@code null} if not in a
function.  Begins the search with this node's parent.
@return the {@link FunctionNode} enclosing this node, else {@code null}
349370
public FunctionNode getEnclosingFunction() {
        AstNode parent = this.getParent();
        while (parent != null && !(parent instanceof FunctionNode)) {
            parent = parent.getParent();
        }
        return (FunctionNode)parent;
    }
1162868
public Node firstChild() {

		if (currentNode == null)
			return null;

		Node node = getFirstChild(currentNode);

		if (node != null)
			currentNode = node;

		return node;
	}
766066
function() {
      var scope = context.getScope();
      while (scope) {
        var node = scope.block;
        var isClass = node.type === 'ClassExpression';
        var isFunction = /Function/.test(node.type); // Functions
        var isMethod = node.parent && node.parent.type === 'MethodDefinition'; // Classes methods
        var isArgument = node.parent && node.parent.type === 'CallExpression'; // Arguments (callback, etc.)
        // Stop moving up if we reach a class or an argument (like a callback)
        if (isClass || isArgument) {
          return null;
        }
        // Return the node if it is a function that is not a class method
        if (isFunction && !isMethod) {
          return node;
        }
        scope = scope.upper;
      }
      return null;
    }
754386
@Nullable
  public UnixPath getParent() {
    if (path.isEmpty() || isRoot()) {
      return null;
    }
    int index =
        hasTrailingSeparator()
            ? path.lastIndexOf(SEPARATOR, path.length() - 2)
            : path.lastIndexOf(SEPARATOR);
    if (index == -1) {
      return isAbsolute() ? ROOT_PATH : null;
    } else {
      return new UnixPath(permitEmptyComponents, path.substring(0, index + 1));
    }
  }
521135
public Node previousNode() {

		if (currentNode == null)
			return null;

		// get sibling
		Node result = getPreviousSibling(currentNode);
		if (result == null) {
			result = getParentNode(currentNode);
			if (result != null) {
				currentNode = result;
				return result;
			}
			return null;
		}

		// get the lastChild of result.
		Node lastChild = getLastChild(result);

		Node prev = lastChild;
		while (lastChild != null) {
			prev = lastChild;
			lastChild = getLastChild(prev);
		}

		lastChild = prev;

		// if there is a lastChild which passes filters return it.
		if (lastChild != null) {
			currentNode = lastChild;
			return lastChild;
		}

		// otherwise return the previous sibling.
		currentNode = result;
		return result;
	}
1227725
function getThisBinding(thisEnvFn, inConstructor) {
  return getBinding(thisEnvFn, "this", thisBinding => {
    if (!inConstructor || !hasSuperClass(thisEnvFn)) return t.thisExpression();

    const supers = new WeakSet();
    thisEnvFn.traverse({
      Function(child) {
        if (child.isArrowFunctionExpression()) return;
        child.skip();
      },
      ClassProperty(child) {
        child.skip();
      },
      CallExpression(child) {
        if (!child.get("callee").isSuper()) return;
        if (supers.has(child.node)) return;
        supers.add(child.node);

        child.replaceWithMultiple([
          child.node,
          t.assignmentExpression(
            "=",
            t.identifier(thisBinding),
            t.identifier("this"),
          ),
        ]);
      },
    });
  });
}
675158
Node createSuperForFunction(Node functionNode) {
    final Node result = IR.superNode();
    if (isAddingTypes()) {
      result.setJSType(getTypeOfSuperForFunctionNode(functionNode));
    }
    return result;
  }
552944
@Override
    public Node getParentNode(String parentNodeId)
    {
        NodeLink link = new NodeLink(parentNodeId, getNodeId());

        if (this.parents == null)
        {
            return null;
        }
        else
        {
            return this.parents.get(link);
        }
    }
1302127
@SuppressWarnings("unchecked")
	public static <T> Function<T, Void> nullFn() {
		return (Function<T, Void>) NULL_FN;
	}
900610
public static Element getFirstChildElement(Node node) {
    	
    	if(node instanceof NestableNode) {
    		return ((NestableNode) node).getFirstElementChild();
    	}
        
        return null;
    }
594109
@Override
  protected Expression visitFunctionNode(FunctionNode node) {
    Object soyFunction = node.getSoyFunction();

    if (soyFunction instanceof BuiltinFunction) {
      switch ((BuiltinFunction) soyFunction) {
        case IS_FIRST:
          return visitIsFirstFunction(node);
        case IS_LAST:
          return visitIsLastFunction(node);
        case INDEX:
          return visitIndexFunction(node);
        case CHECK_NOT_NULL:
          return visitCheckNotNullFunction(node);
        case CSS:
          return visitCssFunction(node);
        case XID:
          return visitXidFunction(node);
        case V1_EXPRESSION:
          return visitV1ExpressionFunction(node);
        case IS_PRIMARY_MSG_IN_USE:
          return visitIsPrimaryMsgInUseFunction(node);
        case TO_FLOAT:
          // this is a no-op in js
          return visit(node.getChild(0));
        case DEBUG_SOY_TEMPLATE_INFO:
          return GOOG_DEBUG.and(JsRuntime.SOY_DEBUG_SOY_TEMPLATE_INFO, codeGenerator);
        case VE_DATA:
          return visitVeDataFunction(node);
        case REMAINDER:
        case MSG_WITH_ID:
          // should have been removed earlier in the compiler
          throw new AssertionError();
      }
      throw new AssertionError();

    } else if (soyFunction instanceof LoggingFunction) {
      return stringLiteral(((LoggingFunction) soyFunction).getPlaceholder());
    } else if (soyFunction instanceof SoyJavaScriptSourceFunction) {
      return javascriptValueFactory.applyFunction(
          node.getSourceLocation(),
          node.getFunctionName(),
          (SoyJavaScriptSourceFunction) soyFunction,
          visitChildren(node),
          codeGenerator);
    } else {
      if (!(soyFunction instanceof SoyJsSrcFunction)) {
        errorReporter.report(
            node.getSourceLocation(),
            SOY_JS_SRC_FUNCTION_NOT_FOUND,
            node.getFunctionName(),
            soyFunction == null ? "missing implementation" : soyFunction.getClass().getName());
        // use a fake function and keep going
        soyFunction = getUnknownFunction(node.getFunctionName(), node.numChildren());
      }

      return SoyJsPluginUtils.applySoyFunction(
          (SoyJsSrcFunction) soyFunction,
          visitChildren(node),
          node.getSourceLocation(),
          errorReporter);
    }
  }
879816
@Nullable
  B getParent() {
    ImmutableList<String> parts = getSegments();
    if (parts.isEmpty()) {
      return null;
    }
    return createPathWithSegments(parts.subList(0, parts.size() - 1));
  }
861133
function getFunctionsList() {
  const type = NodeType.FunctionsListType;
  const token = tokens[pos];
  const line = token.ln;
  const column = token.col;
  const content = [getFunction()];
  const end = getLastPosition(content, line, column, 3);

  // Skip `...`.
  pos += 3;

  return newNode(type, content, line, column, end);
}
751182
@Restricted(DoNotUse.class)
    @Exported
    public @Nonnull String getDescription() {
        Node node = getNode();
        return (node != null) ? node.getNodeDescription() : null;
    }
869213
public LeafNode<K, V> prevNode() {
		if (leftid == NULL_ID) {
			return null;
		}
		return (LeafNode<K, V>) tree.getNode(leftid);
	}
422527
public SymbolScope getEnclosingScope(Node n) {
    Node current = n.getParent();
    if (n.isName() && n.getParent().isFunction()) {
      current = current.getParent();
    }

    for (; current != null; current = current.getParent()) {
      if (scopes.containsKey(current)) {
        return scopes.get(current);
      }
    }
    return null;
  }
378443
public boolean isInnerNode()
  {
    boolean inner = true;
    if ( (_leftChild  == null) ||
         (_rightChild == null) )
      inner = false;
    return inner;
  }