use of org.wso2.ballerinalang.compiler.util.diagnotic.DiagnosticPos in project ballerina by ballerina-lang.
the class BLangPackageBuilder method addAnonStructType.
public void addAnonStructType(DiagnosticPos pos, Set<Whitespace> ws) {
// Generate a name for the anonymous struct
String genName = anonymousModelHelper.getNextAnonymousStructKey(pos.src.pkgID);
IdentifierNode anonStructGenName = createIdentifier(genName);
// Create an anonymous struct and add it to the list of structs in the current package.
BLangStruct structNode = populateStructNode(pos, ws, anonStructGenName, true);
this.compUnit.addTopLevelNode(structNode);
addType(createUserDefinedType(pos, ws, (BLangIdentifier) TreeBuilder.createIdentifierNode(), structNode.name));
}
use of org.wso2.ballerinalang.compiler.util.diagnotic.DiagnosticPos in project ballerina by ballerina-lang.
the class BLangPackageBuilder method createUserDefinedType.
private BLangUserDefinedType createUserDefinedType(DiagnosticPos pos, Set<Whitespace> ws, BLangIdentifier pkgAlias, BLangIdentifier name) {
BLangUserDefinedType userDefinedType = (BLangUserDefinedType) TreeBuilder.createUserDefinedTypeNode();
userDefinedType.pos = pos;
userDefinedType.addWS(ws);
userDefinedType.pkgAlias = pkgAlias;
userDefinedType.typeName = name;
return userDefinedType;
}
use of org.wso2.ballerinalang.compiler.util.diagnotic.DiagnosticPos in project ballerina by ballerina-lang.
the class BLangPackageBuilder method addXMLNSDeclaration.
public void addXMLNSDeclaration(DiagnosticPos pos, Set<Whitespace> ws, String namespaceUri, String prefix, boolean isTopLevel) {
BLangXMLNS xmlns = (BLangXMLNS) TreeBuilder.createXMLNSNode();
BLangIdentifier prefixIdentifer = (BLangIdentifier) TreeBuilder.createIdentifierNode();
prefixIdentifer.pos = pos;
prefixIdentifer.value = prefix;
addLiteralValue(pos, removeNthFromStart(ws, 1), TypeTags.STRING, namespaceUri);
xmlns.namespaceURI = (BLangLiteral) exprNodeStack.pop();
xmlns.prefix = prefixIdentifer;
xmlns.pos = pos;
xmlns.addWS(ws);
if (isTopLevel) {
this.compUnit.addTopLevelNode(xmlns);
return;
}
BLangXMLNSStatement xmlnsStmt = (BLangXMLNSStatement) TreeBuilder.createXMLNSDeclrStatementNode();
xmlnsStmt.xmlnsDecl = xmlns;
xmlnsStmt.pos = pos;
addStmtToCurrentBlock(xmlnsStmt);
}
use of org.wso2.ballerinalang.compiler.util.diagnotic.DiagnosticPos in project ballerina by ballerina-lang.
the class BLangPackageBuilder method addForkJoinStmt.
public void addForkJoinStmt(DiagnosticPos pos, Set<Whitespace> ws) {
BLangForkJoin forkJoin = (BLangForkJoin) this.forkJoinNodesStack.pop();
forkJoin.pos = pos;
forkJoin.addWS(ws);
this.addStmtToCurrentBlock(forkJoin);
}
use of org.wso2.ballerinalang.compiler.util.diagnotic.DiagnosticPos in project ballerina by ballerina-lang.
the class BLangPackageBuilder method endStreamingInputNode.
public void endStreamingInputNode(String alias, DiagnosticPos pos, Set<Whitespace> ws) {
BLangStreamingInput streamingInput = (BLangStreamingInput) this.streamingInputStack.peek();
streamingInput.pos = pos;
streamingInput.addWS(ws);
if (this.whereClauseStack.size() == 2) {
streamingInput.setAfterStreamingCondition(this.whereClauseStack.pop());
streamingInput.setBeforeStreamingCondition(this.whereClauseStack.pop());
} else if (this.whereClauseStack.size() == 1) {
if (streamingInput.isWindowTraversedAfterWhere()) {
streamingInput.setBeforeStreamingCondition(this.whereClauseStack.pop());
} else {
streamingInput.setAfterStreamingCondition(this.whereClauseStack.pop());
}
}
if (!this.windowClausesStack.empty()) {
streamingInput.setWindowClause(this.windowClausesStack.pop());
}
streamingInput.setStreamReference(this.exprNodeStack.pop());
streamingInput.setAlias(alias);
}
Aggregations