Index: tools/json_schema_compiler/cpp_util.py |
diff --git a/tools/json_schema_compiler/cpp_util.py b/tools/json_schema_compiler/cpp_util.py |
index 1e7c3707883bccdce8fd80279e210ad0620bee36..e7c29ac0777de2efdc31ec7bc5a77e2e67d95b69 100644 |
--- a/tools/json_schema_compiler/cpp_util.py |
+++ b/tools/json_schema_compiler/cpp_util.py |
@@ -110,6 +110,10 @@ def OpenNamespace(namespace): |
"""Get opening root namespace declarations. |
""" |
c = Code() |
+ # In lieu of GYP supporting None for the namespace variable the '' namespace |
+ # implies there is no root namespace. |
+ if namespace == '': |
+ return c |
for component in namespace.split('::'): |
c.Append('namespace %s {' % component) |
return c |
@@ -119,6 +123,10 @@ def CloseNamespace(namespace): |
"""Get closing root namespace declarations. |
""" |
c = Code() |
+ # In lieu of GYP supporting None for the namespace variable the '' namespace |
+ # implies there is no root namespace. |
+ if namespace == '': |
+ return c |
for component in reversed(namespace.split('::')): |
c.Append('} // namespace %s' % component) |
return c |