@Override public Node leaveAccessNode(AccessNode accessNode) { if (!exp.isEmpty()) { String type = exp.get(exp.size() - 1); String preType = exp.size() > 1 ? exp.get(exp.size() - 2) : ""; if (!ST_THIS.equals(type) && !(preType.startsWith(ST_START_DELIMITER)) && !type.startsWith(ST_ANONYM)) { exp.add(exp.size() - 1, ST_PRO); } } exp.add(ST_PRO); exp.add(accessNode.getProperty()); return super.leaveAccessNode(accessNode); }
@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; }
if (callNode.getFunction() instanceof AccessNode) { AccessNode anode = (AccessNode)callNode.getFunction(); callOffset = anode.getFinish() - anode.getProperty().length();
private static List<Identifier> getName(AccessNode aNode, ParserResult parserResult) { List<Identifier> name = new ArrayList(); 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) { AccessNode aaNode = (AccessNode)base; base = aaNode.getBase(); name.add(new Identifier(aaNode.getProperty(), new OffsetRange(aaNode.getFinish() - aaNode.getProperty().length(), aaNode.getFinish())));
if ("assign".equals(aNode.getProperty()) && aNode.getBase() instanceof IdentNode && "Object".equals(((IdentNode)aNode.getBase()).getName())) {
@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); }
isPrivilage = true; } else { if (!ModelUtils.PROTOTYPE.equals(aNode.getProperty()) && jsFunction.getParent().getJSKind().isFunction()) { if (aNode.getBase() instanceof AccessNode) { if (!ModelUtils.PROTOTYPE.equals(((AccessNode)aNode.getBase()).getProperty())) {
if (fqName != null && ModelUtils.THIS.equals(fqName.get(0).getName())) { //NOI18N fieldName = aNode.getProperty(); if (rhs instanceof IdentNode) {
onLeftSite = bNode.tokenType() == TokenType.ASSIGN && bNode.lhs().equals(accessNode); String propertyName = accessNode.getProperty();