private boolean isStaticFunction(Node node, NodeTraversal traversal) { if (!node.isQualifiedName()) { return false; } String root = NodeUtil.getRootOfQualifiedName(node).getQualifiedName(); if (globals == null) { return false; } GlobalNamespace.Name fullName = globals.getOwnSlot(node.getQualifiedName()); GlobalNamespace.Name rootName = globals.getOwnSlot(root); if (fullName == null || rootName == null) { return false; } GlobalNamespace.Ref rootDecl = rootName.getDeclaration(); if (rootDecl == null) { return false; } Node globalDeclNode = rootDecl.getNode(); if (globalDeclNode == null) { return false; // don't know where the root came from so assume it could be anything } Var rootScope = traversal.getScope().getVar(root); if (rootScope == null) { return true; // root is not in the current scope, so it's a static function } Node scopeDeclNode = rootScope.getNode(); return scopeDeclNode == globalDeclNode; // is the global name currently in scope? }