use of org.wso2.ballerinalang.compiler.tree.BLangXMLNS.BLangLocalXMLNS in project ballerina by ballerina-lang.
the class CodeGenerator method visit.
@Override
public void visit(BLangLocalXMLNS xmlnsNode) {
RegIndex lvIndex = getLVIndex(TypeTags.STRING);
BLangExpression nsURIExpr = xmlnsNode.namespaceURI;
nsURIExpr.regIndex = createLHSRegIndex(lvIndex);
genNode(nsURIExpr, env);
BXMLNSSymbol nsSymbol = (BXMLNSSymbol) xmlnsNode.symbol;
nsSymbol.nsURIIndex = lvIndex;
}
use of org.wso2.ballerinalang.compiler.tree.BLangXMLNS.BLangLocalXMLNS in project ballerina by ballerina-lang.
the class Desugar method visit.
@Override
public void visit(BLangXMLNS xmlnsNode) {
BLangXMLNS generatedXMLNSNode;
xmlnsNode.namespaceURI = rewriteExpr(xmlnsNode.namespaceURI);
BSymbol ownerSymbol = xmlnsNode.symbol.owner;
// Local namespace declaration in a function/resource/action/worker
if ((ownerSymbol.tag & SymTag.INVOKABLE) == SymTag.INVOKABLE) {
generatedXMLNSNode = new BLangLocalXMLNS();
} else {
generatedXMLNSNode = new BLangPackageXMLNS();
}
generatedXMLNSNode.namespaceURI = xmlnsNode.namespaceURI;
generatedXMLNSNode.prefix = xmlnsNode.prefix;
generatedXMLNSNode.symbol = xmlnsNode.symbol;
result = generatedXMLNSNode;
}
use of org.wso2.ballerinalang.compiler.tree.BLangXMLNS.BLangLocalXMLNS in project ballerina by ballerina-lang.
the class Desugar method visit.
@Override
public void visit(BLangXMLElementLiteral xmlElementLiteral) {
xmlElementLiteral.startTagName = rewriteExpr(xmlElementLiteral.startTagName);
xmlElementLiteral.endTagName = rewriteExpr(xmlElementLiteral.endTagName);
xmlElementLiteral.modifiedChildren = rewriteExprs(xmlElementLiteral.modifiedChildren);
xmlElementLiteral.attributes = rewriteExprs(xmlElementLiteral.attributes);
// Separate the in-line namepsace declarations and attributes.
Iterator<BLangXMLAttribute> attributesItr = xmlElementLiteral.attributes.iterator();
while (attributesItr.hasNext()) {
BLangXMLAttribute attribute = attributesItr.next();
if (!attribute.isNamespaceDeclr) {
continue;
}
// Create local namepace declaration for all in-line namespace declarations
BLangLocalXMLNS xmlns = new BLangLocalXMLNS();
xmlns.namespaceURI = attribute.value.concatExpr;
xmlns.prefix = ((BLangXMLQName) attribute.name).localname;
xmlns.symbol = (BXMLNSSymbol) attribute.symbol;
xmlElementLiteral.inlineNamespaces.add(xmlns);
attributesItr.remove();
}
result = xmlElementLiteral;
}
Aggregations