use of org.wso2.ballerinalang.compiler.tree.BLangObject 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.BLangObject in project ballerina by ballerina-lang.
the class BLangPackageBuilder method addFieldToObject.
void addFieldToObject(DiagnosticPos pos, Set<Whitespace> ws, String identifier, boolean exprAvailable, int annotCount, boolean isPrivate) {
Set<Whitespace> wsForSemiColon = removeNthFromLast(ws, 0);
BLangObject objectNode = (BLangObject) this.objectStack.peek();
objectNode.addWS(wsForSemiColon);
BLangVariable field = addVar(pos, ws, identifier, exprAvailable, annotCount);
if (!isPrivate) {
field.flagSet.add(Flag.PUBLIC);
}
}
use of org.wso2.ballerinalang.compiler.tree.BLangObject in project ballerina by ballerina-lang.
the class TreeVisitor method visit.
@Override
public void visit(BLangObject objectNode) {
BSymbol objectSymbol = objectNode.symbol;
SymbolEnv objectEnv = SymbolEnv.createPkgLevelSymbolEnv(objectNode, objectSymbol.scope, symbolEnv);
blockOwnerStack.push(objectNode);
this.cursorPositionResolver = ObjectTypeScopeResolver.class;
objectNode.fields.forEach(field -> acceptNode(field, objectEnv));
// TODO: visit annotation and doc attachments
objectNode.functions.forEach(f -> acceptNode(f, objectEnv));
blockOwnerStack.pop();
this.cursorPositionResolver = TopLevelNodeScopeResolver.class;
}
use of org.wso2.ballerinalang.compiler.tree.BLangObject in project ballerina by ballerina-lang.
the class SymbolEnter method visit.
@Override
public void visit(BLangObject objectNode) {
BSymbol objectSymbol = Symbols.createObjectSymbol(Flags.asMask(objectNode.flagSet), names.fromIdNode(objectNode.name), env.enclPkg.symbol.pkgID, null, env.scope.owner);
objectNode.symbol = objectSymbol;
// Create struct type
objectNode.symbol.type = new BStructType((BTypeSymbol) objectNode.symbol);
defineSymbol(objectNode.pos, objectSymbol);
}
use of org.wso2.ballerinalang.compiler.tree.BLangObject in project ballerina by ballerina-lang.
the class TaintAnalyzer method visit.
public void visit(BLangObject objectNode) {
BSymbol objectSymbol = objectNode.symbol;
SymbolEnv objectEnv = SymbolEnv.createPkgLevelSymbolEnv(objectNode, objectSymbol.scope, env);
objectNode.fields.forEach(field -> analyzeNode(field, objectEnv));
analyzeNode(objectNode.initFunction, objectEnv);
objectNode.functions.forEach(f -> analyzeNode(f, objectEnv));
}
Aggregations