@@ -1094,17 +1094,32 @@ impl PropertyDeclaration {
10941094 /// Given a property declaration, return the property declaration id.
10951095 pub fn id( & self ) -> PropertyDeclarationId {
10961096 match * self {
1097+ PropertyDeclaration :: Custom ( ref name, _) => {
1098+ return PropertyDeclarationId : : Custom ( name)
1099+ }
1100+ PropertyDeclaration :: CSSWideKeyword ( id, _) |
1101+ PropertyDeclaration : : WithVariables ( id, _) => {
1102+ return PropertyDeclarationId :: Longhand ( id)
1103+ }
1104+ _ => { }
1105+ }
1106+ let longhand_id = match * self {
10971107 % for property in data. longhands:
10981108 PropertyDeclaration :: ${ property. camel_case } ( ..) => {
1099- PropertyDeclarationId :: Longhand ( LonghandId :: ${ property. camel_case } )
1109+ LonghandId :: ${ property. camel_case }
11001110 }
11011111 % endfor
1102- PropertyDeclaration :: CSSWideKeyword ( id, _) => PropertyDeclarationId :: Longhand ( id) ,
1103- PropertyDeclaration :: WithVariables ( id, _) => PropertyDeclarationId :: Longhand ( id) ,
1104- PropertyDeclaration :: Custom ( ref name, _) => {
1105- PropertyDeclarationId :: Custom ( name)
1112+ PropertyDeclaration :: CSSWideKeyword ( ..) |
1113+ PropertyDeclaration :: WithVariables ( ..) |
1114+ PropertyDeclaration :: Custom ( ..) => {
1115+ debug_assert ! ( false , "unreachable" ) ;
1116+ // This value is never used, but having an expression of the same "shape"
1117+ // as for other variants helps the optimizer compile this `match` expression
1118+ // to a lookup table.
1119+ LonghandId :: BackgroundColor
11061120 }
1107- }
1121+ } ;
1122+ PropertyDeclarationId :: Longhand ( longhand_id)
11081123 }
11091124
11101125 fn with_variables_from_shorthand( & self , shorthand: ShorthandId ) -> Option < & str> {
0 commit comments