@Override public boolean enterAccessNode(AccessNode accessNode) { if (typeOffset == -1) { typeOffset = accessNode.getFinish() - accessNode.getProperty().length(); } accessNode.getBase().accept(this); exp.add(accessNode.getProperty()); return false; }
@Override public boolean enterAccessNode(AccessNode accessNode) { BinaryNode node = getPath().get(getPath().size() - 1) instanceof BinaryNode ? (BinaryNode)getPath().get(getPath().size() - 1) : null; if (!(node != null && node.tokenType() == TokenType.ASSIGN)) { if (accessNode.getBase() instanceof IdentNode && ModelUtils.THIS.equals(((IdentNode)accessNode.getBase()).getName())) { //NOI18N String iNode = accessNode.getProperty(); JsObject current = modelBuilder.getCurrentDeclarationFunction(); JsObject property = current.getProperty(iNode); if (property == null && current.getParent() != null && (current.getParent().getJSKind() == JsElement.Kind.CONSTRUCTOR || current.getParent().getJSKind() == JsElement.Kind.OBJECT)) { current = current.getParent(); property = current.getProperty(iNode); if (property == null && ModelUtils.PROTOTYPE.equals(current.getName())) { current = current.getParent(); property = current.getProperty(iNode); } } if (property == null && current.getParent() == null) { // probably we are in global space and there is used this property = modelBuilder.getGlobal().getProperty(iNode); } if (property != null && !property.getModifiers().contains(Modifier.PRIVATE)) { // we don't want to add occurrences for cases like var buf = this.buf. See issue #267694 ((JsObjectImpl)property).addOccurrence(new OffsetRange(accessNode.getFinish() - iNode.length(), accessNode.getFinish())); } } } return super.enterAccessNode(accessNode); }
if ((binNode.lhs() instanceof IdentNode) || (binNode.lhs() instanceof AccessNode && ((AccessNode) binNode.lhs()).getBase() instanceof IdentNode && ((IdentNode) ((AccessNode) binNode.lhs()).getBase()).getName().equals(ModelUtils.THIS))) { //NOI18N if (lastVisited instanceof ExpressionStatement && !fqName.get(0).getName().equals(ModelUtils.THIS)) { //NOI18N
name.add(new Identifier(aNode.getProperty(), new OffsetRange(aNode.getFinish() - aNode.getProperty().length(), aNode.getFinish()))); Node base = aNode.getBase(); while (base instanceof AccessNode || base instanceof CallNode || base instanceof IndexNode) { if (base instanceof CallNode) { base = aaNode.getBase(); name.add(new Identifier(aaNode.getProperty(), new OffsetRange(aaNode.getFinish() - aaNode.getProperty().length(), aaNode.getFinish())));
int propertyOffsetStart = accessNode.getBase().getFinish() + 1; int propertyOffsetEnd = propertyOffsetStart + propertyName.length(); if (property != null) {