use of org.wso2.ballerinalang.compiler.tree.BLangConnector in project ballerina by ballerina-lang.
the class Generator method createDocForNode.
/**
* Create documentation for connectors.
* @param connectorNode ballerina connector node.
* @return documentation for connectors.
*/
public static ConnectorDoc createDocForNode(BLangConnector connectorNode) {
String connectorName = connectorNode.getName().value;
List<Variable> parameters = new ArrayList<>();
List<Documentable> actions = new ArrayList<>();
// Iterate through the connector parameters
if (connectorNode.getParameters().size() > 0) {
for (BLangVariable param : connectorNode.getParameters()) {
String dataType = type(param);
String desc = paramAnnotation(connectorNode, param);
Variable variable = new Variable(param.getName().value, dataType, desc);
parameters.add(variable);
}
}
// Iterate through the actions of the connectors
if (connectorNode.getActions().size() > 0) {
for (BLangAction action : connectorNode.getActions()) {
actions.add(createDocForNode(action));
}
}
return new ConnectorDoc(connectorName, description(connectorNode), actions, parameters);
}
use of org.wso2.ballerinalang.compiler.tree.BLangConnector in project ballerina by ballerina-lang.
the class SignatureTreeVisitor method visit.
@Override
public void visit(BLangConnector connectorNode) {
BSymbol connectorSymbol = connectorNode.symbol;
SymbolEnv connectorEnv = SymbolEnv.createConnectorEnv(connectorNode, connectorSymbol.scope, symbolEnv);
connectorNode.actions.forEach(action -> this.acceptNode(action, connectorEnv));
}
use of org.wso2.ballerinalang.compiler.tree.BLangConnector in project ballerina by ballerina-lang.
the class SymbolEnter method defineConnectorParams.
private void defineConnectorParams(List<BLangConnector> connectors, SymbolEnv pkgEnv) {
connectors.forEach(connector -> {
SymbolEnv conEnv = SymbolEnv.createConnectorEnv(connector, connector.symbol.scope, pkgEnv);
defineConnectorSymbolParams(connector, connector.symbol, conEnv);
});
}
use of org.wso2.ballerinalang.compiler.tree.BLangConnector in project ballerina by ballerina-lang.
the class SymbolEnter method defineConnectorSymbolParams.
private void defineConnectorSymbolParams(BLangConnector connectorNode, BConnectorSymbol symbol, SymbolEnv connectorEnv) {
List<BVarSymbol> paramSymbols = connectorNode.params.stream().peek(varNode -> defineNode(varNode, connectorEnv)).map(varNode -> varNode.symbol).collect(Collectors.toList());
symbol.params = paramSymbols;
// Create connector type
List<BType> paramTypes = paramSymbols.stream().map(paramSym -> paramSym.type).collect(Collectors.toList());
symbol.type = new BConnectorType(paramTypes, symbol);
}
use of org.wso2.ballerinalang.compiler.tree.BLangConnector in project ballerina by ballerina-lang.
the class TaintAnalyzer method visit.
public void visit(BLangConnector connectorNode) {
BSymbol connectorSymbol = connectorNode.symbol;
SymbolEnv connectorEnv = SymbolEnv.createConnectorEnv(connectorNode, connectorSymbol.scope, env);
attachTaintTableBasedOnAnnotations(connectorNode);
connectorNode.varDefs.forEach(var -> var.accept(this));
analyzeNode(connectorNode.initFunction, connectorEnv);
analyzeNode(connectorNode.initAction, connectorEnv);
connectorNode.actions.forEach(action -> analyzeNode(action, connectorEnv));
}
Aggregations