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

Unified Diff: mojo/public/bindings/mojom_bindings_generator.py

Issue 159983003: Fix a bug with mojom imports where 2 imports with the same namespace would (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 | « mojo/public/bindings/generators/mojom_js_generator.py ('k') | mojo/public/bindings/pylib/generate/mojom.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/bindings/mojom_bindings_generator.py
diff --git a/mojo/public/bindings/mojom_bindings_generator.py b/mojo/public/bindings/mojom_bindings_generator.py
index c060de4bd83c2c158b952da0f7d7c675e8e6d536..87b055d6053278d79fbe3f365533b5f103a2e438 100755
--- a/mojo/public/bindings/mojom_bindings_generator.py
+++ b/mojo/public/bindings/mojom_bindings_generator.py
@@ -46,7 +46,11 @@ def LoadGenerators(generators_string):
def ProcessFile(args, generator_modules, filename, processed_files):
# Ensure we only visit each file once.
- processed_files.append(filename)
+ if filename in processed_files:
+ if processed_files[filename] is None:
+ raise Exception("Circular dependency: " + filename)
+ return processed_files[filename]
+ processed_files[filename] = None
dirname, name = os.path.split(filename)
name = os.path.splitext(name)[0]
@@ -61,9 +65,8 @@ def ProcessFile(args, generator_modules, filename, processed_files):
# We use these to generate proper type info.
for import_data in mojom['imports']:
import_filename = os.path.join(dirname, import_data['filename'])
- if import_filename not in processed_files:
- import_data['module'] = ProcessFile(
- args, generator_modules, import_filename, processed_files)
+ import_data['module'] = ProcessFile(
+ args, generator_modules, import_filename, processed_files)
Matt Perry 2014/02/11 19:46:05 I made this change because multiple files could im
module = mojom_data.OrderedModuleFromData(mojom)
for generator_module in generator_modules:
@@ -71,6 +74,7 @@ def ProcessFile(args, generator_modules, filename, processed_files):
args.output_dir)
generator.GenerateFiles()
+ processed_files[filename] = module
return module
def Main():
@@ -95,7 +99,7 @@ def Main():
os.makedirs(args.output_dir)
for filename in args.filename:
- ProcessFile(args, generator_modules, filename, [])
+ ProcessFile(args, generator_modules, filename, {})
return 0
« no previous file with comments | « mojo/public/bindings/generators/mojom_js_generator.py ('k') | mojo/public/bindings/pylib/generate/mojom.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698