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

Unified Diff: tools/json_schema_compiler/cpp_type_generator.py

Issue 9617010: Move chrome.downloads out of experimental to dev (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 7 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
Index: tools/json_schema_compiler/cpp_type_generator.py
diff --git a/tools/json_schema_compiler/cpp_type_generator.py b/tools/json_schema_compiler/cpp_type_generator.py
index 8a9960ea99df0c18e3269645cdd878289c920270..cffc4986ea896a3ece75f2893c0b317d173615ac 100644
--- a/tools/json_schema_compiler/cpp_type_generator.py
+++ b/tools/json_schema_compiler/cpp_type_generator.py
@@ -7,7 +7,6 @@ from model import PropertyType
import any_helper
import cpp_util
import schema_util
-import string
class CppTypeGenerator(object):
"""Manages the types of properties and provides utilities for getting the
@@ -175,7 +174,8 @@ class CppTypeGenerator(object):
self._root_namespace.
"""
c = Code()
- for namespace, types in sorted(self._NamespaceTypeDependencies().items()):
+ for namespace, types in sorted(self._NamespaceTypeDependencies().items(),
+ key=lambda namespace_types: namespace_types[0].name):
not at google - send to devlin 2012/06/04 04:16:49 Shouldn't we be sorting by namespace name, not typ
benjhayden 2012/06/04 20:33:15 namespace_types is a 2-tuple (namespace, types). I
c.Append('namespace %s {' % namespace.name)
for type_ in types:
not at google - send to devlin 2012/06/04 04:16:49 It occurs to me that these should probably be sort
benjhayden 2012/06/04 20:33:15 Done.
type_name = schema_util.StripSchemaNamespace(type_)
@@ -200,10 +200,13 @@ class CppTypeGenerator(object):
"""Returns the #include lines for self._namespace.
"""
c = Code()
- for dependency in sorted(self._NamespaceTypeDependencies().keys()):
- c.Append('#include "%s/%s.h"' % (
+ filenames = []
+ for dependency in self._NamespaceTypeDependencies().keys():
+ filenames.append('%s/%s.h' % (
dependency.source_file_dir,
self._cpp_namespaces[dependency]))
+ for filename in sorted(filenames):
+ c.Append('#include "%s"' % filename)
return c
def _ResolveTypeNamespace(self, ref_type):

Powered by Google App Engine
This is Rietveld 408576698