Skip to main content

member_default

Function member_default 

Source
pub fn member_default(
    ast: &Ast,
    node: &MemberNode,
    type_: Id<TypeNode>,
    place: Expr,
) -> Result<Vec<Statement>, EncodeError>
Expand description

One member’s default: its @default, or its type’s.

§7.2.2.4.4.4.9 puts the explicit one first — “An explicit definition associates a default value with the member at the time where the aggregated type is defined” — and falls back to “the default value of the member type. See Table 9.”

§Errors

EncodeError::NoWriter where a @default names a value this column cannot spell as a Java expression. Refused rather than silently replaced by Table 9’s zero: a member the designer gave a default and a member that got a zero instead are different samples.