use crate::common::*;
#[derive(PartialEq, Debug)]
pub(crate) struct Parameter<'src> {
pub(crate) name: Name<'src>,
pub(crate) kind: ParameterKind,
pub(crate) default: Option<Expression<'src>>,
pub(crate) export: bool,
}
impl<'src> Display for Parameter<'src> {
fn fmt(&self, f: &mut Formatter) -> Result<(), fmt::Error> {
let color = Color::fmt(f);
if let Some(prefix) = self.kind.prefix() {
write!(f, "{}", color.annotation().paint(prefix))?;
}
write!(f, "{}", color.parameter().paint(self.name.lexeme()))?;
if let Some(ref default) = self.default {
write!(f, "={}", color.string().paint(&default.to_string()))?;
}
Ok(())
}
}