Support declaring keyword property Gecko coverage as inexhaustive.

This allows us to control whether the catchall case in the match expression
that maps Gecko const to Servo enum will be generated.

MozReview-Commit-ID: L65IjTONdfl
This commit is contained in:
Cameron McCormack 2016-12-05 13:47:09 -10:00
parent 75418b7005
commit 0ff7b5f2de
9 changed files with 21 additions and 4 deletions

View file

@ -255,7 +255,9 @@ def set_gecko_property(ffi_name, expr):
% for value in keyword.values_for('gecko'):
structs::${keyword.gecko_constant(value)} => Keyword::${to_rust_ident(value)},
% endfor
% if keyword.gecko_inexhaustive:
x => panic!("Found unexpected value in style struct for ${ident} property: {:?}", x),
% endif
}
}
</%def>
@ -1027,7 +1029,8 @@ fn static_assert() {
"table-header-group table-footer-group table-row table-column-group " +
"table-column table-cell table-caption list-item flex none " +
"-moz-box -moz-inline-box",
gecko_enum_prefix="StyleDisplay") %>
gecko_enum_prefix="StyleDisplay",
gecko_inexhaustive=True) %>
${impl_keyword('display', 'mDisplay', display_keyword, True)}
// overflow-y is implemented as a newtype of overflow-x, so we need special handling.