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 objc generation for Bytes property and for hash methods with switch statements #222

Merged
merged 2 commits into from
Mar 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions stone/backends/obj_c_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

_primitive_table = {
Boolean: 'NSNumber *',
Bytes: 'NSData',
Bytes: 'NSString *',
Float32: 'NSNumber *',
Float64: 'NSNumber *',
Int32: 'NSNumber *',
Expand All @@ -48,7 +48,7 @@

_primitive_table_user_interface = {
Boolean: 'BOOL',
Bytes: 'NSData',
Bytes: 'NSString *',
Float32: 'double',
Float64: 'double',
Int32: 'int',
Expand All @@ -64,7 +64,7 @@

_serial_table = {
Boolean: 'DBBoolSerializer',
Bytes: 'DBNSDataSerializer',
Bytes: 'DBStringSerializer',
Float32: 'DBNSNumberSerializer',
Float64: 'DBNSNumberSerializer',
Int32: 'DBNSNumberSerializer',
Expand Down
2 changes: 1 addition & 1 deletion stone/backends/obj_c_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,7 @@ def _generate_hash_func(self, data_type):
enum_field_name = fmt_enum_name(field.name, data_type)
self.emit('case {}:'.format(enum_field_name))
self._generate_hash_func_helper(data_type, field)
self.emit('break;')
elif is_struct_type(data_type):
for field in data_type.all_fields:
self._generate_hash_func_helper(data_type, field)
Expand All @@ -786,7 +787,6 @@ def _generate_hash_check(self, data_type, field):
self.emit('result = prime * result + [[self tagName] hash];')
else:
self.emit('result = prime * result + [self.{} hash];'.format(fmt_var(field.name)))

def _generate_equality_func(self, data_type):
is_equal_func_name = 'isEqualTo{}'.format(fmt_camel_upper(data_type.name))
with self.block_func(func='isEqual',
Expand Down