private boolean tryJavaInvocation(FunctionCall node) throws IOException { if (!(node.getTarget() instanceof PropertyGet)) { return false; } PropertyGet propertyGet = (PropertyGet) node.getTarget(); String callMethod = getJavaMethod(propertyGet.getTarget()); if (callMethod == null || !propertyGet.getProperty().getIdentifier().equals("invoke")) { return false; } MethodReference method = MethodReference.parseIfPossible(callMethod); if (method == null) { return false; } writer.appendMethodBody(method).append('('); printList(node.getArguments()); writer.append(')'); return true; }
@Override public String toSource(int depth) { StringBuilder sb = new StringBuilder(); sb.append(makeIndent(depth)); sb.append(getLeft().toSource(0)); sb.append("."); sb.append(getRight().toSource(0)); return sb.toString(); }
private boolean isJavaMethodRepository(AstNode node) { if (!(node instanceof PropertyGet)) { return false; } PropertyGet propertyGet = (PropertyGet) node; if (!(propertyGet.getLeft() instanceof Name)) { return false; } if (!((Name) propertyGet.getTarget()).getIdentifier().equals("javaMethods")) { return false; } return propertyGet.getProperty().getIdentifier().equals("get"); } }
@Override public String getFunctionNameLookup(FunctionCall call, SourceCompletionProvider provider) { if (call != null) { StringBuilder sb = new StringBuilder(); if (call.getTarget() instanceof PropertyGet) { PropertyGet get = (PropertyGet) call.getTarget(); sb.append(get.getProperty().getIdentifier()); } sb.append("("); int count = call.getArguments().size(); for (int i = 0; i < count; i++) { sb.append("p"); if (i < count - 1) { sb.append(","); } } sb.append(")"); return sb.toString(); } return null; }
MethodReference methodRef = getJavaMethodSelector(propertyGet.getTarget()); if (methodRef == null || !propertyGet.getProperty().getIdentifier().equals("invoke")) { return true; propertyGet.setTarget(newTarget);
if (left.getLeft() instanceof Name && ((Name)left.getLeft()).getIdentifier().equals("exports")) String exportName = left.getProperty().getIdentifier(); Export export = new Export(exportName, JsDocParser.parse(getId(), node.getJsDoc())); if (jsDoc.get().getDescription().length() > 0 && export.getJsDoc().getDescription().equals(jsDoc.get().getDescription()))
/** * Returns the object on which the property is being fetched. * Should never be {@code null}. */ public AstNode getTarget() { return getLeft(); }
PropertyGet pg = new PropertyGet(pn, name, dotPos); pg.setLineno(lineno); return pg; InfixExpression result = xml ? new XmlMemberGet() : new PropertyGet(); if (xml && tt == Token.DOT) result.setType(Token.DOT);
/** * Returns the property being accessed. */ public Name getProperty() { return (Name)getRight(); }
/** * Sets target object, and sets its parent to this node. * @param target expression evaluating to the object upon which * to do the property lookup * @throws IllegalArgumentException} if {@code target} is {@code null} */ public void setTarget(AstNode target) { setLeft(target); }
/** * Sets the property being accessed, and sets its parent to this node. * @throws IllegalArgumentException} if {@code property} is {@code null} */ public void setProperty(Name property) { setRight(property); }
@Override public String toSource(int depth) { StringBuilder sb = new StringBuilder(); sb.append(makeIndent(depth)); sb.append(getLeft().toSource(0)); sb.append("."); sb.append(getRight().toSource(0)); return sb.toString(); }
private void checkCallRequiresActivation(AstNode pn) { if ((pn.getType() == Token.NAME && "eval".equals(((Name)pn).getIdentifier())) || (pn.getType() == Token.GETPROP && "eval".equals(((PropertyGet)pn).getProperty().getIdentifier()))) setRequiresActivation(); }
/** * Returns the object on which the property is being fetched. * Should never be {@code null}. */ public AstNode getTarget() { return getLeft(); }
PropertyGet pg = new PropertyGet(pn, name, dotPos); pg.setLineno(lineno); return pg; InfixExpression result = xml ? new XmlMemberGet() : new PropertyGet(); if (xml && tt == Token.DOT) result.setType(Token.DOT);
/** * Returns the property being accessed. */ public Name getProperty() { return (Name)getRight(); }
/** * Sets target object, and sets its parent to this node. * @param target expression evaluating to the object upon which * to do the property lookup * @throws IllegalArgumentException} if {@code target} is {@code null} */ public void setTarget(AstNode target) { setLeft(target); }
/** * Sets the property being accessed, and sets its parent to this node. * @throws IllegalArgumentException} if {@code property} is {@code null} */ public void setProperty(Name property) { setRight(property); }
@Override public CAstNode visitPropertyGet(PropertyGet node, WalkContext arg) { CAstNode elt = Ast.makeConstant(node.getProperty().getString()); return visitObjectRead(node, node.getTarget(), elt, arg); }