use of org.wso2.ballerinalang.compiler.tree.BLangVariable in project ballerina by ballerina-lang.
the class BLangPackageBuilder method endObjectFieldList.
void endObjectFieldList(boolean isPublic) {
BLangObject objectNode = (BLangObject) this.objectStack.peek();
this.varListStack.pop().forEach(variableNode -> {
((BLangVariable) variableNode).docTag = DocTag.FIELD;
if (isPublic) {
((BLangVariable) variableNode).flagSet.add(Flag.PUBLIC);
}
objectNode.addField(variableNode);
});
this.varListStack.push(new ArrayList<>());
}
use of org.wso2.ballerinalang.compiler.tree.BLangVariable in project ballerina by ballerina-lang.
the class BLangPackageBuilder method generateBasicVarNode.
private VariableNode generateBasicVarNode(DiagnosticPos pos, Set<Whitespace> ws, String identifier, boolean exprAvailable) {
BLangVariable var = (BLangVariable) TreeBuilder.createVariableNode();
var.pos = pos;
IdentifierNode name = this.createIdentifier(identifier);
var.setName(name);
var.addWS(ws);
var.setTypeNode(this.typeNodeStack.pop());
if (exprAvailable) {
var.setInitialExpression(this.exprNodeStack.pop());
}
return var;
}
use of org.wso2.ballerinalang.compiler.tree.BLangVariable 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.tree.BLangVariable 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.tree.BLangVariable in project ballerina by ballerina-lang.
the class BLangPackageBuilder method generateObjectVarNode.
private VariableNode generateObjectVarNode(DiagnosticPos pos, Set<Whitespace> ws, boolean isField, String identifier, boolean exprAvailable) {
BLangVariable var = (BLangVariable) TreeBuilder.createVariableNode();
var.pos = pos;
IdentifierNode name = this.createIdentifier(identifier);
var.setName(name);
var.addWS(ws);
var.isField = isField;
if (!isField) {
var.setTypeNode(this.typeNodeStack.pop());
}
if (exprAvailable) {
var.setInitialExpression(this.exprNodeStack.pop());
}
return var;
}
Aggregations