use of org.wso2.ballerinalang.compiler.util.diagnotic.DiagnosticPos in project ballerina by ballerina-lang.
the class BLangPackageBuilder method populateStructNode.
private BLangStruct populateStructNode(DiagnosticPos pos, Set<Whitespace> ws, IdentifierNode name, boolean isAnonymous) {
BLangStruct structNode = (BLangStruct) this.structStack.pop();
structNode.pos = pos;
structNode.addWS(ws);
structNode.name = (BLangIdentifier) name;
structNode.isAnonymous = isAnonymous;
this.varListStack.pop().forEach(variableNode -> {
((BLangVariable) variableNode).docTag = DocTag.FIELD;
structNode.addField(variableNode);
});
return structNode;
}
use of org.wso2.ballerinalang.compiler.util.diagnotic.DiagnosticPos in project ballerina by ballerina-lang.
the class BLangPackageBuilder method addEndpointVariable.
public void addEndpointVariable(DiagnosticPos pos, Set<Whitespace> ws, String endpointName) {
BLangVariable var = (BLangVariable) TreeBuilder.createVariableNode();
var.pos = pos;
// endpointName has to be redefine at semantic analyze phase. So appending $ to make it work.
IdentifierNode name = this.createIdentifier("$" + endpointName);
var.setName(name);
var.addWS(ws);
// Type will be calculated at SymEnter phase.
if (varListStack.empty()) {
varListStack.push(new ArrayList<>());
}
varListStack.peek().add(0, var);
}
use of org.wso2.ballerinalang.compiler.util.diagnotic.DiagnosticPos in project ballerina by ballerina-lang.
the class BLangPackageBuilder method addArrayInitExpr.
public void addArrayInitExpr(DiagnosticPos pos, Set<Whitespace> ws, boolean argsAvailable) {
List<ExpressionNode> argExprList;
BLangArrayLiteral arrayLiteral = (BLangArrayLiteral) TreeBuilder.createArrayLiteralNode();
if (argsAvailable) {
arrayLiteral.addWS(commaWsStack.pop());
argExprList = exprNodeListStack.pop();
} else {
argExprList = new ArrayList<>(0);
}
arrayLiteral.exprs = argExprList.stream().map(expr -> (BLangExpression) expr).collect(Collectors.toList());
arrayLiteral.pos = pos;
arrayLiteral.addWS(ws);
addExpressionNode(arrayLiteral);
}
use of org.wso2.ballerinalang.compiler.util.diagnotic.DiagnosticPos in project ballerina by ballerina-lang.
the class BLangPackageBuilder method createUnaryExpr.
public void createUnaryExpr(DiagnosticPos pos, Set<Whitespace> ws, String operator) {
BLangUnaryExpr unaryExpressionNode = (BLangUnaryExpr) TreeBuilder.createUnaryExpressionNode();
unaryExpressionNode.pos = pos;
unaryExpressionNode.addWS(ws);
unaryExpressionNode.expr = (BLangExpression) exprNodeStack.pop();
unaryExpressionNode.operator = OperatorKind.valueFrom(operator);
addExpressionNode(unaryExpressionNode);
}
use of org.wso2.ballerinalang.compiler.util.diagnotic.DiagnosticPos in project ballerina by ballerina-lang.
the class BLangPackageBuilder method startStreamingInputNode.
public void startStreamingInputNode(DiagnosticPos pos, Set<Whitespace> ws) {
StreamingInput streamingInput = TreeBuilder.createStreamingInputNode();
((BLangStreamingInput) streamingInput).pos = pos;
streamingInput.addWS(ws);
this.streamingInputStack.push(streamingInput);
}
Aggregations