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

Unified Diff: tools/json_schema_compiler/schema_loader.py

Issue 197873009: Support scoped types in PPAPI IDL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed tests. Created 6 years, 9 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/schema_loader.py
diff --git a/tools/json_schema_compiler/schema_loader.py b/tools/json_schema_compiler/schema_loader.py
index 9fea1ab8250229a47172e7a18dabd26968ee6166..358381f847f4766c0fbbe57da4e0db205963ef05 100644
--- a/tools/json_schema_compiler/schema_loader.py
+++ b/tools/json_schema_compiler/schema_loader.py
@@ -3,11 +3,12 @@
# found in the LICENSE file.
import os
+import re
import sys
import idl_schema
import json_schema
-from model import Model
+from model import Model, UnixName
class SchemaLoader(object):
'''Resolves a type name into the namespace the type belongs to.
@@ -30,8 +31,13 @@ class SchemaLoader(object):
return default_namespace
namespace_name, type_name = name_parts
real_name = None
+ # Try to find the file defining the namespace. Eg. for
+ # nameSpace.sub_name_space.Type' the following heuristics looks for:
+ # 1. name_space_sub_name_space.json,
+ # 2. name_space_sub_name_space.idl.
for ext in ['json', 'idl']:
- filename = '%s.%s' % (namespace_name, ext)
+ basename = UnixName(namespace_name)
+ filename = '%s.%s' % (basename, ext)
filepath = os.path.join(self._real_path, filename);
if os.path.exists(filepath):
real_name = filename
« no previous file with comments | « tools/json_schema_compiler/idl_schema_test.py ('k') | tools/json_schema_compiler/test/error_generation_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698