diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2017-06-20 18:15:13 -0400 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2017-06-21 15:17:36 -0400 |
commit | cecff01b54fd5bf3cc8a78b3912c042bfaa9e360 (patch) | |
tree | a475c5ec2b20d367ea31a0914a63adb54fac63ba | |
parent | b48463277e49c8ce50f0dfa41077449e82a6976b (diff) | |
download | mongo-cecff01b54fd5bf3cc8a78b3912c042bfaa9e360.tar.gz |
SERVER-29758 IDL should support a static function serializer
-rw-r--r-- | buildscripts/idl/idl/generator.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/buildscripts/idl/idl/generator.py b/buildscripts/idl/idl/generator.py index 5ac49cda708..7febd25d000 100644 --- a/buildscripts/idl/idl/generator.py +++ b/buildscripts/idl/idl/generator.py @@ -841,9 +841,15 @@ class _CppSourceFileWriter(_CppFileWriterBase): # Call a method like class::method(BSONArrayBuilder*) self._writer.write_template('item.${method_name}(&arrayBuilder);') else: - # Call a method like class::method(StringData, BSONObjBuilder*) - self._writer.write_template( - '${access_member}.${method_name}(${field_name}, builder);') + if writer.is_function(field.serializer): + # Call a method like method(value, StringData, BSONObjBuilder*) + self._writer.write_template( + '${method_name}(${access_member}, ${field_name}, builder);') + else: + # Call a method like class::method(StringData, BSONObjBuilder*) + self._writer.write_template( + '${access_member}.${method_name}(${field_name}, builder);') + else: method_name = writer.get_method_name(field.serializer) template_params['method_name'] = method_name |