/** * Gets parameters of the method. * @param node of the javaScript code * @return list of parameters, never {@code null} */ public List<DocParameter> getParameters(Node node) { JsComment comment = getCommentForOffset(node.getStart(), getCommentBlocks()); if (comment != null) { return comment.getParameters(); } return Collections.<DocParameter>emptyList(); }
public String getFQN(Node expression, ModelBuilder builder) { exp.clear(); this.builder = builder; expression.accept(this); StringBuilder sb = new StringBuilder(); for(String part : exp){ sb.append(part); sb.append('.'); } if (sb.length() == 0) { LOGGER.log(Level.FINE, "New operator withouth name: {0}", expression.toString()); //NOI18N return null; } return sb.toString().substring(0, sb.length() - 1); }
int findOffset (Node expression) { expression.accept(this); return typeOffset; }
public Set<TypeUsage> getSemiTypes(Node expression, ModelBuilder builder) { this.builder = builder; exp = new ArrayList<String>(); result = new HashMap<String, TypeUsage>(); reset(); expression.accept(this); add(exp, typeOffset == -1 ? offsetVisitor.findOffset(expression) : typeOffset, false); return new HashSet<TypeUsage>(result.values()); }
/** * Gets properties of the object from comment. * @param node of the javaScript code * @return list of properties defined in the comment, never {@code null} */ public List<DocParameter> getProperties(Node node) { JsComment comment = getCommentForOffset(node.getStart(), getCommentBlocks()); if (comment != null) { return comment.getProperties(); } return Collections.<DocParameter>emptyList(); }
} else { types = new ArrayList<TypeUsage>(); types.add(new TypeUsage(parameter, rhs.getStart(), false)); property.addAssignment(type, lhs.getStart() + 5); JsObject lObject = null; boolean indexNodeReferProperty = false; int assignmentOffset = lhs.getFinish(); if (lhs instanceof IndexNode) { IndexNode iNode = (IndexNode)lhs;
@Override public boolean enterTernaryNode(TernaryNode ternaryNode) { ternaryNode.getTrueExpression().accept(this); add(exp, offsetVisitor.findOffset(ternaryNode.getTrueExpression()), false); reset(); Node third = ternaryNode.getFalseExpression(); third.accept(this); int typeStart = offsetVisitor.findOffset(third); add(exp, typeStart, false); reset(); return false; }
/** * Gets the set of modifiers attached to given node. * @param node examined node * @return {@code Set} of modifiers, never {@code null} */ public Set<JsModifier> getModifiers(Node node) { JsComment comment = getCommentForOffset(node.getStart(), getCommentBlocks()); if (comment != null) { return comment.getModifiers(); } return Collections.<JsModifier>emptySet(); }
/** * Gets list of super classes defined by documentation for the given node. * @param node examined node * @return {@code List} of super classes, never {@code null} */ public List<Type> getExtends(Node node) { JsComment comment = getCommentForOffset(node.getStart(), getCommentBlocks()); if (comment != null) { return comment.getExtends(); } return Collections.<Type>emptyList(); }
/** * Says whether is examined node (probably function node) class, constructor or not. * @param node examined node * @return {@code true} if the comment says "it's a class", {@code false} otherwise */ public boolean isClass(Node node) { JsComment comment = getCommentForOffset(node.getStart(), getCommentBlocks()); if (comment != null) { return comment.isClass(); } return false; }
/** * Says whether is examined node constant. * @param node examined node * @return {@code true} if the comment says "it's a constant", {@code false} otherwise */ public boolean isConstant(Node node) { JsComment comment = getCommentForOffset(node.getStart(), getCommentBlocks()); if (comment != null) { return comment.isConstant(); } return false; }
/** * Says whether is code at given code depricated or not. * @param node examined node * @return {@code true} if the comment says "it's deprecated", {@code false} otherwise */ public boolean isDeprecated(Node node) { JsComment comment = getCommentForOffset(node.getStart(), getCommentBlocks()); if (comment != null) { return comment.getDeprecated() != null; } return false; }
/** * Gets documentation for given Node. * @param node of the javaScript code * @return documentation text if any {@code null} otherwise */ public Documentation getDocumentation(Node node) { JsComment comment = getCommentForOffset(node.getStart(), getCommentBlocks()); if (comment != null) { String content = JsDocumentationPrinter.printDocumentation(comment); if (!content.isEmpty()) { return Documentation.create(content); } } return null; }
/** * Gets possible return types get for the node. * @param node of the javaScript code * @return list of potential return types, never {@code null} */ public List<Type> getReturnType(Node node) { JsComment comment = getCommentForOffset(node.getStart(), getCommentBlocks()); if (comment != null && comment.getReturnType() != null) { return comment.getReturnType().getParamTypes(); } return Collections.<Type>emptyList(); }
if (ln.isString()) { result.add(FunctionArgumentAccessor.getDefault().createForString( position, argument.getStart(), ln.getString())); } else if (ln instanceof LiteralNode.ArrayLiteralNode) { for (JsObjectImpl jsObject: functionArguments) { if (jsObject.getOffset() == argument.getStart()) { result.add(FunctionArgumentAccessor.getDefault().createForArray(position, jsObject.getOffset(), jsObject)); break; if (jsObject.getOffset() == argument.getStart()) { result.add(FunctionArgumentAccessor.getDefault().createForAnonymousObject(position, jsObject.getOffset(), jsObject)); break; if(fillName((AccessNode) argument, strFqn)) { result.add(FunctionArgumentAccessor.getDefault().createForReference( position, argument.getStart(), strFqn)); } else { result.add(FunctionArgumentAccessor.getDefault().createForUnknown(position)); if(fillName((IndexNode) argument, strFqn)) { result.add(FunctionArgumentAccessor.getDefault().createForReference( position, argument.getStart(), strFqn)); } else { result.add(FunctionArgumentAccessor.getDefault().createForUnknown(position)); String inName = in.getName(); result.add(FunctionArgumentAccessor.getDefault().createForReference( position, argument.getStart(), Collections.singletonList(inName)));
int aOffset = fqName == null ? lastVisited.getStart() : fqName.get(fqName.size() - 1).getOffsetRange().getEnd(); array.addAssignment(ModelUtils.resolveSemiTypeOfExpression(modelBuilder, lNode), aOffset); for (Node item : aNode.getElementExpressions()) {