Source:
<code>public boolean visit(FieldAccess node) { if (searchKind != IIndexConstants.FIELD_PATTERN) { return true; } FieldPattern fieldPattern = (FieldPattern) pattern; char[] nodeName = node.getName().getIdentifier().toCharArray(); char[] rootName = new char[0]; Expression expression = node.getExpression(); switch <START> (expression.getNodeType()) <END> { case ASTNode.SIMPLE_NAME : rootName = ((SimpleName) expression).getIdentifier().toCharArray(); break; case ASTNode.THIS_EXPRESSION : rootName = contextNames.isEmpty() ? new char[0] : contextNames.peek(); break; case ASTNode.FIELD_ACCESS : rootName = ((FieldAccess) expression).getName().getIdentifier().toCharArray(); break; } if (fieldPattern.getDeclaringSimpleName() != null && !CharOperation.equals(rootName, fieldPattern.getDeclaringSimpleName(), false)) { return true; } char[] patternName = fieldPattern.name; IJavaScriptElement enclosingElement = getEnclosingElement(node); if (matchesName(patternName, nodeName)) { boolean isDeclaration = isFieldDeclaration(rootName, nodeName); if (fieldPattern.findDeclarations && isDeclaration) { FieldDeclarationMatch match = new FieldDeclarationMatch( enclosingElement, SearchMatch.A_ACCURATE, node.getStartPosition(), node.getLength(), participant, rootJSUnit.getResource()); matches.add(match); } else if (fieldPattern.findReferences && !isDeclaration) { FieldReferenceMatch match = new FieldReferenceMatch( enclosingElement, SearchMatch.A_ACCURATE, node.getStartPosition(), node.getLength(), true, true, false, participant, rootJSUnit.getResource()); matches.add(match); } } if (patternName != null && matchesName(patternName, rootName)) { FieldReferenceMatch match = new FieldReferenceMatch( enclosingElement, SearchMatch.A_ACCURATE, node.getStartPosition(), node.getLength(), true, true, false, participant, rootJSUnit.getResource()); matches.add(match); } if (node.getExpression() != null && node.getExpression().getNodeType() != ASTNode.SIMPLE_NAME) { return true; } else { return false; } }</code><technical_language>expression null, need a check</technical_language>

Target:
public boolean visit(FieldAccess node) { anonymousNameAvailable = false; if (searchKind != IIndexConstants.FIELD_PATTERN) { return true; } FieldPattern fieldPattern = (FieldPattern) pattern; char[] nodeName = node.getName().getIdentifier().toCharArray(); char[] rootName = new char[0]; Expression expression = node.getExpression(); if (expression == null) { return true; } switch (expression.getNodeType()) { case ASTNode.SIMPLE_NAME : rootName = ((SimpleName) expression).getIdentifier().toCharArray(); break; case ASTNode.THIS_EXPRESSION : rootName = contextNames.isEmpty() ? new char[0] : contextNames.peek(); break; case ASTNode.FIELD_ACCESS : rootName = ((FieldAccess) expression).getName().getIdentifier().toCharArray(); break; } if (fieldPattern.getDeclaringSimpleName() != null && !CharOperation.equals(rootName, fieldPattern.getDeclaringSimpleName(), false)) { return true; } char[] patternName = fieldPattern.name; IJavaScriptElement enclosingElement = getEnclosingElement(node); if (matchesName(patternName, nodeName)) { boolean isDeclaration = isFieldDeclaration(rootName, nodeName); if (isDeclaration) { contextNames.push(nodeName); anonymousNameAvailable = true; } if (fieldPattern.findDeclarations && isDeclaration) { FieldDeclarationMatch match = new FieldDeclarationMatch( enclosingElement, SearchMatch.A_ACCURATE, node.getStartPosition(), node.getLength(), participant, rootJSUnit.getResource()); matches.add(match); } else if (fieldPattern.findReferences && !isDeclaration) { FieldReferenceMatch match = new FieldReferenceMatch( enclosingElement, SearchMatch.A_ACCURATE, node.getStartPosition(), node.getLength(), true, true, false, participant, rootJSUnit.getResource()); matches.add(match); } } if (patternName != null && matchesName(patternName, rootName)) { FieldReferenceMatch match = new FieldReferenceMatch( enclosingElement, SearchMatch.A_ACCURATE, node.getStartPosition(), node.getLength(), true, true, false, participant, rootJSUnit.getResource()); matches.add(match); } if (node.getExpression() != null && node.getExpression().getNodeType() != ASTNode.SIMPLE_NAME) { return true; } else { return false; } }