tools/generate-wire.py: allow consecutive fields to use same len var.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2017-06-06 12:32:46 +09:30
parent 6f181e0dc1
commit cb5ad91788

View File

@ -410,7 +410,11 @@ for line in fileinput.input(options.files):
# commit_sig,0,channel-id,u64
for m in messages:
if m.name == parts[0]:
m.addField(Field(parts[0], parts[2], parts[3], comments, prevfield))
f = Field(parts[0], parts[2], parts[3], comments, prevfield)
m.addField(f)
# If it used prevfield as lenvar, keep that for next
# time (multiple fields can use the same lenvar).
if not f.lenvar:
prevfield = parts[2]
break
comments=[]