Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(255)

Unified Diff: tools/json_schema_compiler/util_cc_helper.py

Issue 851673003: Cleanup: Some simplifications in json_schema_compiler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix_dart_tests
Patch Set: Rebased. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/json_schema_compiler/util.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/json_schema_compiler/util_cc_helper.py
diff --git a/tools/json_schema_compiler/util_cc_helper.py b/tools/json_schema_compiler/util_cc_helper.py
index ee5d6f55baa837e3f88e6f57c627bb508ea7e515..c3acd5fa1d1ac4d9da3e5f52dd1693cd3672b5a0 100644
--- a/tools/json_schema_compiler/util_cc_helper.py
+++ b/tools/json_schema_compiler/util_cc_helper.py
@@ -18,15 +18,12 @@ class UtilCCHelper(object):
src: ListValue*
dst: std::vector or scoped_ptr<std::vector>
"""
- if optional:
- val = '%(namespace)s::PopulateOptionalArrayFromList(*%(src)s, &%(dst)s)'
- else:
- val = '%(namespace)s::PopulateArrayFromList(*%(src)s, &%(dst)s)'
- return val % {
- 'namespace': _API_UTIL_NAMESPACE,
- 'src': src,
- 'dst': dst
- }
+ populate_list_fn = ('PopulateOptionalArrayFromList' if optional
+ else 'PopulateArrayFromList')
+ return ('%s::%s(*%s, &%s)') % (_API_UTIL_NAMESPACE,
+ populate_list_fn,
+ src,
+ dst)
def CreateValueFromArray(self, src, optional):
"""Generates code to create a scoped_pt<Value> from the array at src.
« no previous file with comments | « tools/json_schema_compiler/util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698