mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Code generate Swift wrappers for protocol buffers.
This commit is contained in:
parent
aefbc3c0b2
commit
73f22ae62e
2 changed files with 1169 additions and 1168 deletions
|
@ -52,6 +52,8 @@ class LineWriter:
|
|||
|
||||
def pop_indent(self):
|
||||
self.current_indent = self.current_indent - 1
|
||||
if self.current_indent < 0:
|
||||
raise Exception('Invalid indentation')
|
||||
|
||||
def all_context_proto_names(self):
|
||||
return [context.proto_name for context in self.contexts]
|
||||
|
@ -194,8 +196,7 @@ class BaseContext(object):
|
|||
elif field.rules == 'repeated':
|
||||
return '[%s]' % base_type
|
||||
else:
|
||||
# TODO: fail
|
||||
return base_type
|
||||
raise Exception('Unknown field type')
|
||||
|
||||
def is_field_primitive(self, field):
|
||||
return field.proto_type in ('uint64',
|
||||
|
@ -441,6 +442,7 @@ class MessageContext(BaseContext):
|
|||
writer.newline()
|
||||
elif field.rules == 'repeated':
|
||||
writer.add('@objc public var %s: %s {' % (field.name_swift, field.type_swift_not_optional))
|
||||
writer.push_indent()
|
||||
writer.add('return proto.%s' % field.name_swift )
|
||||
writer.pop_indent()
|
||||
writer.add('}')
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue