Chromium Code Reviews| 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 |