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

Unified Diff: tools/json_schema_compiler/cc_generator.py

Issue 487533005: Add support for references in different paths in apis (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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 | « extensions/generated_extensions_api.gni ('k') | tools/json_schema_compiler/compiler.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/json_schema_compiler/cc_generator.py
diff --git a/tools/json_schema_compiler/cc_generator.py b/tools/json_schema_compiler/cc_generator.py
index 43434b8892389a788b02b092a9b57c3779d16c06..1d243f03b5ad30fc582e4fb5083a2367eefe1cb7 100644
--- a/tools/json_schema_compiler/cc_generator.py
+++ b/tools/json_schema_compiler/cc_generator.py
@@ -7,25 +7,23 @@ from model import PropertyType
import cpp_util
import schema_util
import util_cc_helper
+from cpp_namespace_environment import CppNamespaceEnvironment
class CCGenerator(object):
- def __init__(self, type_generator, cpp_namespace_pattern):
+ def __init__(self, type_generator):
self._type_generator = type_generator
- self._cpp_namespace_pattern = cpp_namespace_pattern
def Generate(self, namespace):
- return _Generator(namespace,
- self._type_generator,
- self._cpp_namespace_pattern).Generate()
+ return _Generator(namespace, self._type_generator).Generate()
class _Generator(object):
"""A .cc generator for a namespace.
"""
- def __init__(self, namespace, cpp_type_generator, cpp_namespace_pattern):
+ def __init__(self, namespace, cpp_type_generator):
+ assert type(namespace.environment) is CppNamespaceEnvironment
self._namespace = namespace
self._type_helper = cpp_type_generator
- self._cpp_namespace_pattern = cpp_namespace_pattern
self._util_cc_helper = (
util_cc_helper.UtilCCHelper(self._type_helper))
self._generate_error_messages = namespace.compiler_options.get(
@@ -34,8 +32,9 @@ class _Generator(object):
def Generate(self):
"""Generates a Code object with the .cc for a single namespace.
"""
- cpp_namespace = cpp_util.GetCppNamespace(self._cpp_namespace_pattern,
- self._namespace.unix_name)
+ cpp_namespace = cpp_util.GetCppNamespace(
+ self._namespace.environment.namespace_pattern,
+ self._namespace.unix_name)
c = Code()
(c.Append(cpp_util.CHROMIUM_LICENSE)
« no previous file with comments | « extensions/generated_extensions_api.gni ('k') | tools/json_schema_compiler/compiler.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698