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

Unified Diff: tools/json_schema_compiler/cpp_type_generator.py

Issue 12041098: Initial commit of the Dart Chrome Extension APIs generators (Closed) Base URL: http://git.chromium.org/chromium/src.git@file_path_bugfix
Patch Set: Small style & structure fixes to dart_generator, and similar. Created 7 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
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 f15bae86e468a4444367f18ee18b9ed26cde7643..3dbccf5f4d16c2f3c55f4a4fed6edb204a8af3e3 100644
--- a/tools/json_schema_compiler/cpp_type_generator.py
+++ b/tools/json_schema_compiler/cpp_type_generator.py
@@ -33,16 +33,19 @@ class CppTypeGenerator(object):
self._type_namespaces = {}
self._root_namespace = root_namespace.split('::')
self._cpp_namespaces = {}
+ self._namespace = None
if namespace and cpp_namespace:
- self._namespace = namespace
self.AddNamespace(namespace, cpp_namespace)
- else:
- self._namespace = None
def AddNamespace(self, namespace, cpp_namespace):
"""Maps a model.Namespace to its C++ namespace name. All mappings are
beneath the root namespace.
"""
+ # If this is the first namespace added, save it.
+ # TODO(sashab,kalman): Is this the correct behaviour of self._namespace?
not at google - send to devlin 2013/02/02 00:45:48 What was wrong with the way it was before?
sashab 2013/02/04 05:09:27 The old code did stuff like: (for a single schema
+ if self._namespace is None:
+ self._namespace = namespace
+
self._cpp_namespaces[namespace] = cpp_namespace
for type_name in namespace.types:
# Allow $refs to refer to just 'Type' within namespaces. Otherwise they

Powered by Google App Engine
This is Rietveld 408576698