mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-03 18:57:06 +01:00
bolt-gen: formatting cleanups
add brackets for clarity when printing subtypes; also remove unnecessary exception (`find_` will raise an exception if the key is not present)
This commit is contained in:
parent
316edb39a4
commit
ff82c918a5
2 changed files with 4 additions and 3 deletions
|
@ -51,7 +51,9 @@ void print${options.enum_name}_message(const u8 *msg)
|
||||||
printf("[");
|
printf("[");
|
||||||
for (size_t i = 0; i < ${f.size()}; i++) {
|
for (size_t i = 0; i < ${f.size()}; i++) {
|
||||||
% if f.type_obj.is_subtype():
|
% if f.type_obj.is_subtype():
|
||||||
|
printf("{\n");
|
||||||
printwire_${f.type_obj.name}(tal_fmt(NULL, "%s.${f.name}", fieldname), ${cursor}, ${plen});
|
printwire_${f.type_obj.name}(tal_fmt(NULL, "%s.${f.name}", fieldname), ${cursor}, ${plen});
|
||||||
|
printf("}\n");
|
||||||
% else:
|
% else:
|
||||||
${f.type_obj.type_name()} v;
|
${f.type_obj.type_name()} v;
|
||||||
% if f.type_obj.is_assignable():
|
% if f.type_obj.is_assignable():
|
||||||
|
@ -71,7 +73,9 @@ void print${options.enum_name}_message(const u8 *msg)
|
||||||
% endif
|
% endif
|
||||||
${truncate_check(nested)} \
|
${truncate_check(nested)} \
|
||||||
% elif f.type_obj.is_subtype():
|
% elif f.type_obj.is_subtype():
|
||||||
|
printf("{\n");
|
||||||
printwire_${f.type_obj.name}(tal_fmt(NULL, "%s.${f.name}", fieldname), ${cursor}, ${plen});
|
printwire_${f.type_obj.name}(tal_fmt(NULL, "%s.${f.name}", fieldname), ${cursor}, ${plen});
|
||||||
|
printf("}\n");
|
||||||
% else:
|
% else:
|
||||||
% if f.type_obj.is_assignable():
|
% if f.type_obj.is_assignable():
|
||||||
${f.type_obj.type_name()} ${f.name} = fromwire_${f.type_obj.name}(${cursor}, ${plen});
|
${f.type_obj.type_name()} ${f.name} = fromwire_${f.type_obj.name}(${cursor}, ${plen});
|
||||||
|
|
|
@ -130,9 +130,6 @@ class FieldSet(object):
|
||||||
field.add_count(int(count))
|
field.add_count(int(count))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
len_field = self.find_data_field(count)
|
len_field = self.find_data_field(count)
|
||||||
if not len_field:
|
|
||||||
raise ValueError("No length field found with name {} for {}:{}"
|
|
||||||
.format(count, self.name, field_name))
|
|
||||||
field.add_len_field(len_field)
|
field.add_len_field(len_field)
|
||||||
self.len_fields[len_field.name] = len_field
|
self.len_fields[len_field.name] = len_field
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue