Search in sources :

Example 1 with BAnnotationType

use of org.wso2.ballerinalang.compiler.semantics.model.types.BAnnotationType in project ballerina by ballerina-lang.

the class SymbolEnter method visit.

public void visit(BLangAnnotation annotationNode) {
    BSymbol annotationSymbol = Symbols.createAnnotationSymbol(Flags.asMask(annotationNode.flagSet), names.fromIdNode(annotationNode.name), env.enclPkg.symbol.pkgID, null, env.scope.owner);
    annotationSymbol.type = new BAnnotationType((BAnnotationSymbol) annotationSymbol);
    annotationNode.attachmentPoints.forEach(point -> ((BAnnotationSymbol) annotationSymbol).attachmentPoints.add(point));
    annotationNode.symbol = annotationSymbol;
    defineSymbol(annotationNode.pos, annotationSymbol);
    SymbolEnv annotationEnv = SymbolEnv.createAnnotationEnv(annotationNode, annotationSymbol.scope, env);
    annotationNode.attributes.forEach(att -> this.defineNode(att, annotationEnv));
    if (annotationNode.typeNode != null) {
        BType structType = this.symResolver.resolveTypeNode(annotationNode.typeNode, annotationEnv);
        ((BAnnotationSymbol) annotationSymbol).attachedType = structType.tsymbol;
    }
}
Also used : BSymbol(org.wso2.ballerinalang.compiler.semantics.model.symbols.BSymbol) BAnnotationType(org.wso2.ballerinalang.compiler.semantics.model.types.BAnnotationType) BType(org.wso2.ballerinalang.compiler.semantics.model.types.BType) SymbolEnv(org.wso2.ballerinalang.compiler.semantics.model.SymbolEnv) BAnnotationSymbol(org.wso2.ballerinalang.compiler.semantics.model.symbols.BAnnotationSymbol)

Aggregations

SymbolEnv (org.wso2.ballerinalang.compiler.semantics.model.SymbolEnv)1 BAnnotationSymbol (org.wso2.ballerinalang.compiler.semantics.model.symbols.BAnnotationSymbol)1 BSymbol (org.wso2.ballerinalang.compiler.semantics.model.symbols.BSymbol)1 BAnnotationType (org.wso2.ballerinalang.compiler.semantics.model.types.BAnnotationType)1 BType (org.wso2.ballerinalang.compiler.semantics.model.types.BType)1