Matches an AST node which is the same object reference as the given node.
430568
public static <T extends Tree> Matcher<T> isSame(final Tree t) {
    return new Matcher<T>() {
      @Override
      public boolean matches(T tree, VisitorState state) {
        return tree == t;
      }
    };
  }
69937
public static <T> SameType<T> of(TreeNode<T> expected, TreeNode<T> actual) {
		return of(TreeNode.treeDef(), expected, TreeNode.treeDef(), actual).mapToSame(TreeNode::getContent, TreeNode::getContent);
	}
656136
def find_matching_builtin(self, node):
        
        for path in EQUIVALENT_ITERATORS.keys():
            correct_alias = {path_to_node(path)}
            if self.aliases[node.func] == correct_alias:
                return path
1175776
private static final boolean match(Object obj1, Object obj2) {
        return obj1 == obj2 || (obj1 != null && obj1.equals(obj2));
    }
654992
def match(self, obj, attrs):
        
        if '__doc__' in attrs:
            lstrip = getattr(obj.__doc__, 'lstrip', False)
            return lstrip and any(lstrip())
1367307
function isTagExpr (node) {
  return typeof(node) === 'object' && node.type === 'assign' && !node.local
    && node.varname === 'tags'
    && node.value.length > 2
    && node.value[0].type === 'lookup' && node.value[0].varname === 'tags'
    && node.value[1] === ' '
}
544396
private static Matcher<AssignmentTree> assignmentIncrementDecrementMatcher(
      ExpressionTree variable) {
    return allOf(
        variableFromAssignmentTree(Matchers.<ExpressionTree>hasModifier(Modifier.VOLATILE)),
        not(inSynchronized()),
        assignment(
            Matchers.<ExpressionTree>anything(),
            toType(
                BinaryTree.class,
                Matchers.<BinaryTree>allOf(
                    Matchers.<BinaryTree>anyOf(kindIs(Kind.PLUS), kindIs(Kind.MINUS)),
                    binaryTree(sameVariable(variable), Matchers.<ExpressionTree>anything())))));
  }
664614
public char nodeMatch(IContextMapping<IAtomicConceptOfLabel> acolMapping,
                          Map<INode, ArrayList<IAtomicConceptOfLabel>> nmtAcols,
                          Map<String, IAtomicConceptOfLabel> sourceACoLs,
                          Map<String, IAtomicConceptOfLabel> targetACoLs,
                          INode sourceNode, INode targetNode) throws NodeMatcherException {
        throw new NodeMatcherException("Unsupported operation");
    }
1183314
@Override
  public Description matchMemberReference(MemberReferenceTree tree, VisitorState state) {
    return checkInvocation(
        tree, ((JCMemberReference) tree).referentType, state, ASTHelpers.getSymbol(tree));
  }
707721
static boolean referencesSuper(Node n) {
    Node curr = n.getFirstChild();
    while (curr != null) {
      if (containsType(curr, Token.SUPER, node -> !node.isClass())) {
        return true;
      }
      curr = curr.getNext();
    }
    return false;
  }
497582
public static boolean samePackageName(ClassNode first, ClassNode second) {
        return Objects.equals(first.getPackageName(), second.getPackageName());
    }
63554
function sameType(a, b) {
  a = Object.prototype.toString.call(a);
  b = Object.prototype.toString.call(b);
  return a == b;
}
453509
public static boolean sameVariable(ExpressionTree expr1, ExpressionTree expr2) {
    requireNonNull(expr1);
    requireNonNull(expr2);
    // Throw up our hands if we're not comparing identifiers and/or field accesses.
    if ((expr1.getKind() != Kind.IDENTIFIER && expr1.getKind() != Kind.MEMBER_SELECT)
        || (expr2.getKind() != Kind.IDENTIFIER && expr2.getKind() != Kind.MEMBER_SELECT)) {
      return false;
    }

    Symbol sym1 = getSymbol(expr1);
    Symbol sym2 = getSymbol(expr2);
    if (sym1 == null) {
      throw new IllegalStateException("Couldn't get symbol for " + expr1);
    } else if (sym2 == null) {
      throw new IllegalStateException("Couldn't get symbol for " + expr2);
    }

    if (expr1.getKind() == Kind.IDENTIFIER && expr2.getKind() == Kind.IDENTIFIER) {
      // foo == foo?
      return sym1.equals(sym2);
    } else if (expr1.getKind() == Kind.MEMBER_SELECT && expr2.getKind() == Kind.MEMBER_SELECT) {
      // foo.baz.bar == foo.baz.bar?
      return sym1.equals(sym2)
          && sameVariable(((JCFieldAccess) expr1).selected, ((JCFieldAccess) expr2).selected);
    } else {
      // this.foo == foo?
      ExpressionTree selected = null;
      if (expr1.getKind() == Kind.IDENTIFIER) {
        selected = ((JCFieldAccess) expr2).selected;
      } else {
        selected = ((JCFieldAccess) expr1).selected;
      }
      // TODO(eaftan): really shouldn't be relying on .toString()
      return selected.toString().equals("this") && sym1.equals(sym2);
    }
  }
590670
@Override
    public MatchType match(int level, Node node) {
        if(! (node instanceof Element)) {
            return MatchType.NOT_A_MATCH;
        }
        Element element = (Element) node;
        if(this.level != level) {
            return MatchType.NOT_A_MATCH;
        } else if(element.getName().equals(elementName) && element.hasAttribute(attributeName)
                && element.attributeValue(attributeName).equals(attributeValue)) {
            return MatchType.NODE_MATCH;
        }
        return MatchType.NOT_A_MATCH;
    }
278014
@SuppressWarnings("ReferenceEquality")
  public final boolean matchesQualifiedName(Node n) {
    if (n.token != token) {
      return false;
    }
    switch (token) {
      case NAME:
        // ==, rather than equal as it is intern'd in setString
        return !getString().isEmpty() && getString() == n.getString();
      case THIS:
      case SUPER:
        return true;
      case GETPROP:
        // ==, rather than equal as it is intern'd in setString
        return getLastChild().getString() == n.getLastChild().getString()
            && getFirstChild().matchesQualifiedName(n.getFirstChild());

      case MEMBER_FUNCTION_DEF:
        // These are explicitly *not* qualified name components.
      default:
        return false;
    }
  }
440608
function matchesFactory(test) {
  return matches

  function matches(node) {
    var key

    for (key in test) {
      if (node[key] !== test[key]) {
        return false
      }
    }

    return true
  }
}
50949
function reference(node, clone)
			{
				clone.originalNode = node;
				
				node = node.firstChild;
				var child = clone.firstChild;
				
				while (node != null && child != null)
				{
					reference(node, child);
					node = node.nextSibling;
					child = child.nextSibling;
				}
				
				return clone;
			}