25 lines
581 B
Rust
25 lines
581 B
Rust
use crate::{ast, rules::NodeRule};
|
|
|
|
pub struct ManualInherit;
|
|
|
|
impl NodeRule for ManualInherit {
|
|
type Node = ast::Binding;
|
|
|
|
const ID: &'static str = "manual_inherit";
|
|
|
|
fn select(data: &ast::NodeData) -> Option<&Self::Node> {
|
|
let ast::NodeData::Binding(binding) = data;
|
|
|
|
Some(binding)
|
|
}
|
|
|
|
fn check(node: &Self::Node) -> Option<&'static str> {
|
|
match &node.value {
|
|
ast::Expr::Ident(value) if node.key == *value => {
|
|
Some("Use `inherit` for this assignment")
|
|
}
|
|
_ => None,
|
|
}
|
|
}
|
|
}
|