Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix multiple nested levels #30

Merged
merged 2 commits into from
Feb 9, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
add brackets when generating sizes
tafia committed Feb 9, 2017
commit fac99c81511176ae7e4dcd714b9a20186585f298
6 changes: 3 additions & 3 deletions codegen/src/types.rs
Original file line number Diff line number Diff line change
@@ -234,14 +234,14 @@ impl FieldType {
match *self {
FieldType::Int32 | FieldType::Sint32 | FieldType::Int64 |
FieldType::Sint64 | FieldType::Uint32 | FieldType::Uint64 |
FieldType::Bool | FieldType::Enum(_) => format!("sizeof_varint(*{} as u64)", s),
FieldType::Bool | FieldType::Enum(_) => format!("sizeof_varint(*({}) as u64)", s),

FieldType::Fixed64 | FieldType::Sfixed64 | FieldType::Double => "8".to_string(),
FieldType::Fixed32 | FieldType::Sfixed32 | FieldType::Float => "4".to_string(),

FieldType::String_ | FieldType::Bytes => format!("sizeof_len({}.len())", s),
FieldType::String_ | FieldType::Bytes => format!("sizeof_len(({}).len())", s),

FieldType::Message(_) => format!("sizeof_len({}.get_size())", s),
FieldType::Message(_) => format!("sizeof_len(({}).get_size())", s),

FieldType::Map(ref m) => {
let &(ref k, ref v) = &**m;