use of org.wso2.ballerinalang.compiler.semantics.model.symbols.BAnnotationAttributeSymbol in project ballerina by ballerina-lang.
the class SymbolEnter method visit.
public void visit(BLangAnnotAttribute annotationAttribute) {
BAnnotationAttributeSymbol annotationAttributeSymbol = Symbols.createAnnotationAttributeSymbol(names.fromIdNode(annotationAttribute.name), env.enclPkg.symbol.pkgID, null, env.scope.owner);
annotationAttributeSymbol.docTag = DocTag.FIELD;
annotationAttributeSymbol.expr = annotationAttribute.expr;
annotationAttribute.symbol = annotationAttributeSymbol;
((BAnnotationSymbol) env.scope.owner).attributes.add(annotationAttributeSymbol);
defineSymbol(annotationAttribute.pos, annotationAttributeSymbol);
}
use of org.wso2.ballerinalang.compiler.semantics.model.symbols.BAnnotationAttributeSymbol in project ballerina by ballerina-lang.
the class SemanticAnalyzer method visit.
@Override
public void visit(BLangDocumentation docNode) {
Set<BLangIdentifier> visitedAttributes = new HashSet<>();
for (BLangDocumentationAttribute attribute : docNode.attributes) {
if (!visitedAttributes.add(attribute.documentationField)) {
this.dlog.warning(attribute.pos, DiagnosticCode.DUPLICATE_DOCUMENTED_ATTRIBUTE, attribute.documentationField);
continue;
}
Name attributeName = names.fromIdNode(attribute.documentationField);
BSymbol attributeSymbol = this.env.scope.lookup(attributeName).symbol;
if (attributeSymbol == null) {
this.dlog.warning(attribute.pos, DiagnosticCode.NO_SUCH_DOCUMENTABLE_ATTRIBUTE, attribute.documentationField, attribute.docTag.getValue());
continue;
}
int ownerSymTag = env.scope.owner.tag;
if ((ownerSymTag & SymTag.ANNOTATION) == SymTag.ANNOTATION) {
if (attributeSymbol.tag != SymTag.ANNOTATION_ATTRIBUTE || ((BAnnotationAttributeSymbol) attributeSymbol).docTag != attribute.docTag) {
this.dlog.warning(attribute.pos, DiagnosticCode.NO_SUCH_DOCUMENTABLE_ATTRIBUTE, attribute.documentationField, attribute.docTag.getValue());
continue;
}
} else {
if (attributeSymbol.tag != SymTag.VARIABLE || ((BVarSymbol) attributeSymbol).docTag != attribute.docTag) {
this.dlog.warning(attribute.pos, DiagnosticCode.NO_SUCH_DOCUMENTABLE_ATTRIBUTE, attribute.documentationField, attribute.docTag.getValue());
continue;
}
}
attribute.type = attributeSymbol.type;
}
}
Aggregations