Commit b8baaeb5 authored by nbarth@chromium.org's avatar nbarth@chromium.org

Merge idl_definitions_builder.py into idl_definitions.py

idl_definitions_builder.py was separate from idl_definitions.py
b/c the latter had lots of Perl compatibility cruft (JSON export etc.)
Now that it's gone, there's no reason to have these separate, as
idl_definitions was almost only class definitions, and
idl_definitions_builder was basically constructors.

Keeping them separate made it harder to read (b/c had to bounce back
and forth), and the calls to the actual constructors were incredibly
long.

This merges them, deleting one file and making the code quite simple.
Net -70 lines, though more like -100 due to adding a few comments
(class diagram).

Change is just merging the functions into constructors (in a few cases
changing an alternative constructor into a class method) and adding
a few comments.

Further cleanup is possible (remove IdlEnum and IdlUnionType),
but involve CG changes, so will do in followup.

BUG=345137
TBR=haraken

Review URL: https://codereview.chromium.org/177233006

git-svn-id: svn://svn.chromium.org/blink/trunk@168582 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 9573ab3b
...@@ -132,7 +132,6 @@ ...@@ -132,7 +132,6 @@
'scripts/blink_idl_lexer.py', 'scripts/blink_idl_lexer.py',
'scripts/blink_idl_parser.py', 'scripts/blink_idl_parser.py',
'scripts/idl_definitions.py', 'scripts/idl_definitions.py',
'scripts/idl_definitions_builder.py',
'scripts/idl_reader.py', 'scripts/idl_reader.py',
'scripts/idl_validator.py', 'scripts/idl_validator.py',
'scripts/interface_dependency_resolver.py', 'scripts/interface_dependency_resolver.py',
......
...@@ -28,10 +28,10 @@ ...@@ -28,10 +28,10 @@
"""Read an IDL file or complete IDL interface, producing an IdlDefinitions object.""" """Read an IDL file or complete IDL interface, producing an IdlDefinitions object."""
import os.path import os
import blink_idl_parser import blink_idl_parser
import idl_definitions_builder from idl_definitions import IdlDefinitions
import idl_validator import idl_validator
import interface_dependency_resolver import interface_dependency_resolver
...@@ -64,7 +64,9 @@ class IdlReader(object): ...@@ -64,7 +64,9 @@ class IdlReader(object):
def read_idl_file(self, idl_filename): def read_idl_file(self, idl_filename):
"""Returns an IdlDefinitions object for an IDL file, without any dependencies.""" """Returns an IdlDefinitions object for an IDL file, without any dependencies."""
ast = blink_idl_parser.parse_file(self.parser, idl_filename) ast = blink_idl_parser.parse_file(self.parser, idl_filename)
definitions = idl_definitions_builder.build_idl_definitions_from_ast(ast) if not ast:
raise Exception('Failed to parse %s' % idl_filename)
definitions = IdlDefinitions(ast)
if not self.extended_attribute_validator: if not self.extended_attribute_validator:
return definitions return definitions
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment