ink-analyzer-ir 0.3.0

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

use ink_analyzer_macro::{FromInkAttribute, FromSyntax};
use ra_ap_syntax::ast::Impl as ASTImpl;

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

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

impl Impl {
    /// Returns the `impl` item (if any) for the ink! `contract` implementation.
    pub fn impl_item(&self) -> Option<&ASTImpl> {
        self.ink_attr.parent_ast()
    }
}