Skip to content

Commit

Permalink
Handle additional keyword name.
Browse files Browse the repository at this point in the history
  • Loading branch information
psftw committed Jun 11, 2019
1 parent 3d0a53d commit ca82b35
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions generator/src/codegen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,10 @@ fn generate_field_type(namespace_opt: Option<&str>, spec: &PropertySpecification
fn mutate_field_name(name: &str) -> String {
let mut field_name = name.to_snake_case();

if field_name == "type" {
field_name = "type_".into();
for keyword in vec!["match", "type"] {
if field_name == keyword {
field_name = (field_name + "_").into();
}
}

field_name
Expand Down

0 comments on commit ca82b35

Please sign in to comment.