diff options
author | reillyg <reillyg@chromium.org> | 2015-05-05 19:34:27 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-06 02:35:09 +0000 |
commit | 89a17f7839bfedeee84ae1dbc178fb13dfe03eba (patch) | |
tree | b82af8b83a26b7d0894a97fe5da2758ce4a014c0 /tools/json_schema_compiler/cc_generator.py | |
parent | 123d3e51878397d4a001530cfb5279bbd506bf7c (diff) | |
download | chromium_src-89a17f7839bfedeee84ae1dbc178fb13dfe03eba.zip chromium_src-89a17f7839bfedeee84ae1dbc178fb13dfe03eba.tar.gz chromium_src-89a17f7839bfedeee84ae1dbc178fb13dfe03eba.tar.bz2 |
Add support for passing errors through PopulateArrayFromList.
When a JSON schema includes an array of objects PopulateArrayFromList
calls a specialized PopulateItem instance for the generated object
type. When compiled with generate_error_messages=True the generated
type's Populate method expects to receive an error parameter. This
patch adds versions of the PopulateArrayFromList and PopulateItem
functions that pass through and provide that parameter.
This capability is required for a new manifest key that will include
an array of objects being added as part of issue 468955.
Review URL: https://codereview.chromium.org/1128523003
Cr-Commit-Position: refs/heads/master@{#328471}
Diffstat (limited to 'tools/json_schema_compiler/cc_generator.py')
-rw-r--r-- | tools/json_schema_compiler/cc_generator.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/tools/json_schema_compiler/cc_generator.py b/tools/json_schema_compiler/cc_generator.py index 6faac39..4fa55be 100644 --- a/tools/json_schema_compiler/cc_generator.py +++ b/tools/json_schema_compiler/cc_generator.py @@ -778,10 +778,9 @@ class _Generator(object): failure_value, is_ptr=is_ptr)) else: - c.Sblock('if (!%s) {' % self._util_cc_helper.PopulateArrayFromList( - 'list', - dst_var, - is_ptr)) + c.Sblock('if (!%s(%s)) {' % ( + self._util_cc_helper.PopulateArrayFromListFunction(is_ptr), + self._GenerateArgs(('*list', '&%(dst_var)s')))) c.Concat(self._GenerateError( '"unable to populate array \'%%(parent_key)s\'"')) if is_ptr and self._generate_error_messages: |