use of org.wso2.ballerinalang.compiler.tree.types.BLangFunctionTypeNode in project ballerina by ballerina-lang.
the class SymbolResolver method visit.
@Override
public void visit(BLangFunctionTypeNode functionTypeNode) {
List<BType> paramTypes = new ArrayList<>();
List<BType> retParamTypes = new ArrayList<>();
functionTypeNode.getParamTypeNode().forEach(t -> paramTypes.add(resolveTypeNode((BLangType) t, env)));
functionTypeNode.getReturnParamTypeNode().forEach(t -> retParamTypes.add(resolveTypeNode((BLangType) t, env)));
resultType = new BInvokableType(paramTypes, retParamTypes, null);
}
use of org.wso2.ballerinalang.compiler.tree.types.BLangFunctionTypeNode in project ballerina by ballerina-lang.
the class BLangPackageBuilder method addFunctionType.
public void addFunctionType(DiagnosticPos pos, Set<Whitespace> ws, boolean paramsAvail, boolean paramsTypeOnly, boolean retParamsAvail) {
// TODO : Fix function main ()(boolean , function(string x)(float, int)){} issue
BLangFunctionTypeNode functionTypeNode = (BLangFunctionTypeNode) TreeBuilder.createFunctionTypeNode();
functionTypeNode.pos = pos;
functionTypeNode.returnsKeywordExists = true;
if (retParamsAvail) {
// functionTypeNode.addWS(commaWsStack.pop());
functionTypeNode.returnParamTypeNodes.add(this.varStack.pop().getTypeNode());
}
if (paramsAvail) {
functionTypeNode.addWS(commaWsStack.pop());
this.varListStack.pop().forEach(v -> functionTypeNode.paramTypeNodes.add(v.getTypeNode()));
}
functionTypeNode.addWS(ws);
addType(functionTypeNode);
}
Aggregations