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

Unified Diff: bindings/scripts/idl_reader.py

Issue 581453002: Dartium Roll 38 roll (Closed) Base URL: https://dart.googlecode.com/svn/third_party/WebCore
Patch Set: Sync'd w/ r 182210 Created 6 years, 3 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 | « bindings/scripts/idl_definitions.py ('k') | bindings/scripts/idl_types.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bindings/scripts/idl_reader.py
diff --git a/bindings/scripts/idl_reader.py b/bindings/scripts/idl_reader.py
index 38286682420e23055e61316665b672f7b153447c..23797a79dd93d1448675af06dec8a74a2eb986c1 100644
--- a/bindings/scripts/idl_reader.py
+++ b/bindings/scripts/idl_reader.py
@@ -70,26 +70,28 @@ class IdlReader(object):
ast = blink_idl_parser.parse_file(self.parser, idl_filename)
if not ast:
raise Exception('Failed to parse %s' % idl_filename)
- definitions = IdlDefinitions(ast)
+ idl_file_basename, _ = os.path.splitext(os.path.basename(idl_filename))
+ definitions = IdlDefinitions(idl_file_basename, ast)
if not self.multi_interface:
# Validate file contents with filename convention
# The Blink IDL filenaming convention is that the file
- # <interface_name>.idl MUST contain exactly 1 interface (or exception),
- # and the interface name must agree with the file's basename,
- # unless it is a partial interface.
+ # <definition_name>.idl MUST contain exactly 1 definition
+ # (interface, dictionary or exception), and the definition name must
+ # agree with the file's basename, unless it is a partial definition.
# (e.g., 'partial interface Foo' can be in FooBar.idl).
- number_of_interfaces = len(definitions.interfaces)
- if number_of_interfaces != 1:
+ targets = (definitions.interfaces.values() +
+ definitions.dictionaries.values())
+ number_of_targets = len(targets)
+ if number_of_targets != 1:
raise Exception(
- 'Expected exactly 1 interface in file {0}, but found {1}'
- .format(idl_filename, number_of_interfaces))
- interface = next(definitions.interfaces.itervalues())
- idl_file_basename, _ = os.path.splitext(os.path.basename(idl_filename))
- if not interface.is_partial and interface.name != idl_file_basename:
+ 'Expected exactly 1 definition in file {0}, but found {1}'
+ .format(idl_filename, number_of_targets))
+ target = targets[0]
+ if not target.is_partial and target.name != idl_file_basename:
raise Exception(
- 'Interface name "{0}" disagrees with IDL file basename "{1}".'
- .format(interface.name, idl_file_basename))
+ 'Definition name "{0}" disagrees with IDL file basename "{1}".'
+ .format(target.name, idl_file_basename))
else:
if len(definitions.interfaces) > 1:
print '----- Supplemental interfaces %s' % len(definitions.interfaces)
« no previous file with comments | « bindings/scripts/idl_definitions.py ('k') | bindings/scripts/idl_types.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698