Browse Source

bolt-gen: make needs-context not recursive

originally done so that any field within a subtype needed context,
that would be reflected at the top-most layer. in reality, we
allocate subtype fields off of the instance of the subtype, so
there's no need to check beneath the 'top' layer of field/types
in a message to determine whether or not to pass in a context.
pull/2938/head
lisa neigut 6 years ago
committed by Rusty Russell
parent
commit
40154b35f0
  1. 5
      tools/generate-bolts.py

5
tools/generate-bolts.py

@ -87,8 +87,7 @@ class Field(object):
return self.len_field
def needs_context(self):
""" A field needs a context if its type needs context
or if it's varsized """
""" A field needs a context if it's varsized """
return self.is_varlen() or self.type_obj.needs_context()
def arg_desc_to(self):
@ -286,7 +285,7 @@ class Type(FieldSet):
return self.name in self.truncated_typedefs
def needs_context(self):
return self.is_varsize() or any([field.needs_context() for field in self.fields.values()])
return self.is_varsize()
def is_assignable(self):
""" Generally typedef's and enums """

Loading…
Cancel
Save