ink-analyzer-ir 0.3.0

Intermediate representations (IRs) and abstractions of ink! smart contract code for ink! analyzer.
Documentation
//! ink! contract event `topic` IR.

use ink_analyzer_macro::{FromInkAttribute, FromSyntax};
use ra_ap_syntax::ast::RecordField;

use crate::{FromInkAttribute, FromSyntax, InkAttrData, InkAttribute};

/// An ink! contract event `topic`.
#[derive(Debug, Clone, PartialEq, Eq, FromInkAttribute, FromSyntax)]
pub struct Topic {
    /// ink! attribute IR data.
    #[arg_kind(Topic)]
    ink_attr: InkAttrData<RecordField>,
}

impl Topic {
    /// Returns the `field` item (if any) for the ink! contract event `topic`.
    pub fn field(&self) -> Option<&RecordField> {
        self.ink_attr.parent_ast()
    }
}