Chromium Code Reviews| Index: client/dom/scripts/databasebuilder.py |
| diff --git a/client/dom/scripts/databasebuilder.py b/client/dom/scripts/databasebuilder.py |
| index 89b4f253c180ea13b1b93c19b34dbcb6fd5588c4..bc9d99d2adb5435620322061d79c25267de93113 100755 |
| --- a/client/dom/scripts/databasebuilder.py |
| +++ b/client/dom/scripts/databasebuilder.py |
| @@ -479,14 +479,43 @@ class DatabaseBuilder(object): |
| for module in idl_file.modules: |
| for interface in module.interfaces: |
| + if not self._is_node_enabled(interface, import_options.idl_defines): |
| + _logger.info('skipping interface %s/%s (source=%s file=%s)' |
| + % (module.id, interface.id, import_options.source, |
| + file_path)) |
| + continue |
| + |
| _logger.info('importing interface %s/%s (source=%s file=%s)' |
| % (module.id, interface.id, import_options.source, |
| file_path)) |
| - self._imported_interfaces.append( |
| - (interface, module.id, import_options)) |
| + interface.attributes = [attribute for attribute in interface.attributes |
| + if self._is_node_enabled(attribute, import_options.idl_defines)] |
|
sra1
2012/02/03 20:53:56
you might define a local function and use filter:
podivilov
2012/02/06 12:09:40
Done.
|
| + interface.operations = [operation for operation in interface.operations |
| + if self._is_node_enabled(operation, import_options.idl_defines)] |
| + self._imported_interfaces.append((interface, module.id, import_options)) |
| + |
| for implStmt in module.implementsStatements: |
| self._impl_stmts.append((implStmt, import_options)) |
| + def _is_node_enabled(self, node, idl_defines): |
| + if not 'Conditional' in node.ext_attrs: |
| + return True |
| + |
| + def enabled(condition): |
| + return 'ENABLE_%s' % condition in idl_defines |
| + |
| + conditional = node.ext_attrs['Conditional'] |
| + if conditional.find('&') != -1: |
| + for condition in conditional.split('&'): |
|
sra1
2012/02/03 20:53:56
can & and | occur together?
podivilov
2012/02/06 12:09:40
AFAIK they could not, and webkit code generators d
|
| + if not enabled(condition): |
| + return False |
| + return True |
| + |
| + for condition in conditional.split('|'): |
| + if enabled(condition): |
| + return True |
| + return False |
| + |
| def import_idl_directory(self, directory_path, |
| import_options=DatabaseBuilderOptions()): |
| """Parses, loads into memory and cleans up all IDL files in a given |