Fixing python to_css codegen error

This commit is contained in:
David Raifaizen 2016-04-18 21:18:51 -04:00 committed by Simon Sapin
parent dc829da07e
commit f38607967e

View file

@ -600,7 +600,7 @@ impl Shorthand {
pub fn name(&self) -> &'static str { pub fn name(&self) -> &'static str {
match *self { match *self {
% for property in SHORTHANDS: % for property in data.shorthands:
Shorthand::${property.camel_case} => "${property.name}", Shorthand::${property.camel_case} => "${property.name}",
% endfor % endfor
} }
@ -764,8 +764,8 @@ impl fmt::Display for PropertyDeclarationName {
impl ToCss for PropertyDeclaration { impl ToCss for PropertyDeclaration {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
match *self { match *self {
% for property in LONGHANDS: % for property in data.longhands:
% if property.derived_from is None: % if not property.derived_from:
PropertyDeclaration::${property.camel_case}(ref value) => PropertyDeclaration::${property.camel_case}(ref value) =>
value.to_css(dest), value.to_css(dest),
% endif % endif
@ -844,7 +844,7 @@ impl PropertyDeclaration {
/// This is the case of custom properties and values that contain unsubstituted variables. /// This is the case of custom properties and values that contain unsubstituted variables.
pub fn value_is_unparsed(&self) -> bool { pub fn value_is_unparsed(&self) -> bool {
match *self { match *self {
% for property in LONGHANDS: % for property in data.longhands:
PropertyDeclaration::${property.camel_case}(ref value) => { PropertyDeclaration::${property.camel_case}(ref value) => {
matches!(*value, DeclaredValue::WithVariables { .. }) matches!(*value, DeclaredValue::WithVariables { .. })
}, },
@ -965,7 +965,7 @@ impl PropertyDeclaration {
// first generate longhand to shorthands lookup map // first generate longhand to shorthands lookup map
<% <%
longhand_to_shorthand_map = {} longhand_to_shorthand_map = {}
for shorthand in SHORTHANDS: for shorthand in data.shorthands:
for sub_property in shorthand.sub_properties: for sub_property in shorthand.sub_properties:
if sub_property.ident not in longhand_to_shorthand_map: if sub_property.ident not in longhand_to_shorthand_map:
longhand_to_shorthand_map[sub_property.ident] = [] longhand_to_shorthand_map[sub_property.ident] = []
@ -977,7 +977,7 @@ impl PropertyDeclaration {
%> %>
// based on lookup results for each longhand, create result arrays // based on lookup results for each longhand, create result arrays
% for property in LONGHANDS: % for property in data.longhands:
static ${property.ident.upper()}: &'static [Shorthand] = &[ static ${property.ident.upper()}: &'static [Shorthand] = &[
% for shorthand in longhand_to_shorthand_map.get(property.ident, []): % for shorthand in longhand_to_shorthand_map.get(property.ident, []):
Shorthand::${shorthand}, Shorthand::${shorthand},
@ -986,7 +986,7 @@ impl PropertyDeclaration {
% endfor % endfor
match *self { match *self {
% for property in LONGHANDS: % for property in data.longhands:
PropertyDeclaration::${property.camel_case}(_) => ${property.ident.upper()}, PropertyDeclaration::${property.camel_case}(_) => ${property.ident.upper()},
% endfor % endfor
PropertyDeclaration::Custom(_, _) => &[] PropertyDeclaration::Custom(_, _) => &[]