yog-script-analyze 0.4.0

Yog Script (.ys, .yns) analyzed: its lexer, parser and syntax tree, names resolved, the class index model — what the build and the editors read a source with.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
//! A method's message template parameter (`[StructuredMessageTemplate(
//! nameof(message))]`), read off its declaration (`typeck/templates.rs`).

use yog_script_ids::system::STRUCTURED_MESSAGE_TEMPLATE;

use super::threads::{attributes, text};
use crate::ast::Decl;

/// The parameter `d` marks a message template, if it marks one.
pub(super) fn template(d: &Decl) -> Option<String> {
    let a = attributes(d, STRUCTURED_MESSAGE_TEMPLATE).next()?;
    text(&a.args.first()?.value.kind)
}