List<Node> pnodes = RubyParserUtils.findNodes(callNode.getArgs(), new NodeType[] { NodeType.SYMBOLNODE });
if(pnodes.size() != 1)
throw new IOException("A newparam or newproperty call does not take exactly one symbol parameter in " +
typeFileStr);
NamedTypeItem elem = new NamedTypeItem();
if(isParam) {
if(parameters == null)
parameters = new ArrayList<NamedTypeItem>();
parameters.add(elem);
}
else {
if(properties == null)
properties = new ArrayList<NamedTypeItem>();
properties.add(elem);
}
elem.setName(((SymbolNode) pnodes.get(0)).getName());
iterNode = callNode.getIter();
pnodes = RubyParserUtils.findNodes(iterNode, new NodeType[] { NodeType.BLOCKNODE, NodeType.FCALLNODE });
if(pnodes.isEmpty())
// No block when there's just one call
pnodes = RubyParserUtils.findNodes(iterNode, new NodeType[] { NodeType.FCALLNODE });
for(Node pnode : pnodes) {
FCallNode pcallNode = (FCallNode) pnode;
if("desc".equals(pcallNode.getName())) {
List<Node> args = pcallNode.getArgs().childNodes();
if(args.size() != 1)
throw new IOException(
"A newparam or newproperty desc call does not take exactly one parameter in " + typeFileStr);
elem.setDocumentation(RubyParserUtils.stringValue(args.get(0)));
break;
}
}
}
type.setParameters(parameters);