oxilean_codegen/dart_backend/
dartannotation_traits.rs1use crate::lcnf::*;
12
13use super::functions::{fmt_args, fmt_typed_params};
14use super::types::DartAnnotation;
15use std::fmt;
16
17impl fmt::Display for DartAnnotation {
18 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
19 match self {
20 DartAnnotation::Override => write!(f, "@override"),
21 DartAnnotation::Deprecated => write!(f, "@deprecated"),
22 DartAnnotation::VisibleForTesting => write!(f, "@visibleForTesting"),
23 DartAnnotation::Immutable => write!(f, "@immutable"),
24 DartAnnotation::Sealed => write!(f, "@sealed"),
25 DartAnnotation::Custom(name, args) => {
26 if args.is_empty() {
27 write!(f, "@{}", name)
28 } else {
29 write!(f, "@{}({})", name, args.join(", "))
30 }
31 }
32 }
33 }
34}