예제 #1
0
def idl_file_to_global_names(idl_filename):
    """Returns global names, if any, for an IDL file.

    If the [Global] or [PrimaryGlobal] extended attribute is declared with an
    identifier list argument, then those identifiers are the interface's global
    names; otherwise, the interface has a single global name, which is the
    interface's identifier (http://heycam.github.io/webidl/#Global).
    """
    interface_name = idl_filename_to_interface_name(idl_filename)
    full_path = os.path.realpath(idl_filename)
    idl_file_contents = get_file_contents(full_path)
    extended_attributes = get_interface_extended_attributes_from_idl(idl_file_contents)

    global_keys = GLOBAL_EXTENDED_ATTRIBUTES.intersection(
        extended_attributes.iterkeys())
    if not global_keys:
        return
    if len(global_keys) > 1:
        raise ValueError('The [Global] and [PrimaryGlobal] extended attributes '
                         'MUST NOT be declared on the same interface.')
    global_key = next(iter(global_keys))

    global_value = extended_attributes[global_key]
    if global_value:
        return global_value.strip('()').split(',')
    return [interface_name]
예제 #2
0
def idl_files_to_interface_name_global_names(idl_files):
    """Yields pairs (interface_name, global_names) found in IDL files."""
    for idl_filename in idl_files:
        interface_name = idl_filename_to_interface_name(idl_filename)
        global_names = idl_file_to_global_names(idl_filename)
        if global_names:
            yield interface_name, global_names
def extract_meta_data(file_paths):
    """Extracts interface name from each IDL file."""
    meta_data_list = []

    for file_path in file_paths:
        if not file_path.endswith('.idl'):
            print 'WARNING: non-IDL file passed: "%s"' % file_path
            continue
        if not os.path.exists(file_path):
            print 'WARNING: file not found: "%s"' % file_path
            continue

        idl_file_contents = get_file_contents(file_path)
        if not should_generate_impl_file_from_idl(idl_file_contents):
            continue

        # Extract interface name from file name
        interface_name = idl_filename_to_interface_name(file_path)

        meta_data = {
            'name': interface_name,
        }
        meta_data_list.append(meta_data)

    return meta_data_list
예제 #4
0
    def load_global_pickles(self, global_entries):
        # List of all interfaces and callbacks for global code generation.
        world = {'interfaces': [], 'callbacks': []}

        # Load all pickled data for each interface.
        for (directory, file_list) in global_entries:
            for filename in file_list:
                if os.path.splitext(filename)[1] == '.dart':
                    # Special case: any .dart files in the list should be added
                    # to dart_sky.dart directly, but don't need to be processed.
                    interface_name = os.path.splitext(os.path.basename(filename))[0]
                    world['interfaces'].append({'name': "Custom" + interface_name})
                    continue
                interface_name = idl_filename_to_interface_name(filename)
                idl_pickle_filename = interface_name + "_globals.pickle"
                idl_pickle_filename = os.path.join(directory, idl_pickle_filename)
                if not os.path.exists(idl_pickle_filename):
                    logging.warn("Missing %s" % idl_pickle_filename)
                    continue
                with open(idl_pickle_filename) as idl_pickle_file:
                    idl_world = pickle.load(idl_pickle_file)
                    if 'interface' in idl_world:
                        # FIXME: Why are some of these None?
                        if idl_world['interface']:
                            world['interfaces'].append(idl_world['interface'])
                    if 'callback' in idl_world:
                        # FIXME: Why are some of these None?
                        if idl_world['callback']:
                            world['callbacks'].append(idl_world['callback'])

        world['interfaces'] = sorted(world['interfaces'], key=lambda (x): x['name'])
        world['callbacks'] = sorted(world['callbacks'], key=lambda (x): x['name'])
        return world
def idl_files_to_interface_name_global_names(idl_files):
    """Yields pairs (interface_name, global_names) found in IDL files."""
    for idl_filename in idl_files:
        interface_name = idl_filename_to_interface_name(idl_filename)
        global_names = idl_file_to_global_names(idl_filename)
        if global_names:
            yield interface_name, global_names
def record_global_constructors(idl_filename):
    interface_name = idl_filename_to_interface_name(idl_filename)
    full_path = os.path.realpath(idl_filename)
    idl_file_contents = get_file_contents(full_path)
    extended_attributes = get_interface_extended_attributes_from_idl(idl_file_contents)

    # An interface property is produced for every non-callback interface
    # that does not have [NoInterfaceObject].
    # Callback interfaces with constants also have interface properties,
    # but there are none of these in Blink.
    # http://heycam.github.io/webidl/#es-interfaces
    if (is_callback_interface_from_idl(idl_file_contents) or
        'NoInterfaceObject' in extended_attributes):
        return

    exposed_arguments = get_interface_exposed_arguments(idl_file_contents)
    if exposed_arguments:
        # Exposed(Arguments) case
        for argument in exposed_arguments:
            if 'RuntimeEnabled' in extended_attributes:
                raise ValueError('RuntimeEnabled should not be used with Exposed(Arguments)')
            attributes = extended_attributes.copy()
            attributes['RuntimeEnabled'] = argument['runtime_enabled']
            new_constructors_list = generate_global_constructors_list(interface_name, attributes)
            global_name_to_constructors[argument['exposed']].extend(new_constructors_list)
    else:
        # Exposed=env or Exposed=(env1,...) case
        exposed_global_names = extended_attributes.get('Exposed', 'Window').strip('()').split(',')
        new_constructors_list = generate_global_constructors_list(interface_name, extended_attributes)
        for name in exposed_global_names:
            global_name_to_constructors[name].extend(new_constructors_list)
def compute_info_individual(idl_filename, component_dir):
    full_path = os.path.realpath(idl_filename)
    idl_file_contents = get_file_contents(full_path)

    extended_attributes = get_interface_extended_attributes_from_idl(
        idl_file_contents)
    implemented_as = extended_attributes.get('ImplementedAs')
    this_include_path = include_path(idl_filename, component_dir,
                                     implemented_as)

    # Handle partial interfaces
    partial_interface_name = get_partial_interface_name_from_idl(
        idl_file_contents)
    if partial_interface_name:
        add_paths_to_partials_dict(partial_interface_name, full_path,
                                   this_include_path)
        return

    # If not a partial interface, the basename is the interface name
    interface_name = idl_filename_to_interface_name(idl_filename)

    # 'implements' statements can be included in either the file for the
    # implement*ing* interface (lhs of 'implements') or implement*ed* interface
    # (rhs of 'implements'). Store both for now, then merge to implement*ing*
    # interface later.
    left_interfaces, right_interfaces = get_implements_from_idl(
        idl_file_contents, interface_name)

    interfaces_info[interface_name] = {
        'component_dir':
        component_dir,
        'extended_attributes':
        extended_attributes,
        'full_path':
        full_path,
        'implemented_as':
        implemented_as,
        'implemented_by_interfaces':
        left_interfaces,  # private, merged to next
        'implements_interfaces':
        right_interfaces,
        'include_path':
        this_include_path,
        # FIXME: temporary private field, while removing old treatement of
        # 'implements': http://crbug.com/360435
        'is_legacy_treat_as_partial_interface':
        'LegacyTreatAsPartialInterface' in extended_attributes,
        'is_callback_interface':
        is_callback_interface_from_idl(idl_file_contents),
        'parent':
        get_parent_interface(idl_file_contents),
        # Interfaces that are referenced (used as types) and that we introspect
        # during code generation (beyond interface-level data ([ImplementedAs],
        # is_callback_interface, ancestors, and inherited extended attributes):
        # deep dependencies.
        # These cause rebuilds of referrers, due to the dependency, so these
        # should be minimized; currently only targets of [PutForwards].
        'referenced_interfaces':
        get_put_forward_interfaces_from_idl(idl_file_contents),
    }
예제 #8
0
def idl_file_to_global_names(idl_filename):
    """Returns global names, if any, for an IDL file.

    If the [Global] or [PrimaryGlobal] extended attribute is declared with an
    identifier list argument, then those identifiers are the interface's global
    names; otherwise, the interface has a single global name, which is the
    interface's identifier (http://heycam.github.io/webidl/#Global).
    """
    interface_name = idl_filename_to_interface_name(idl_filename)
    full_path = os.path.realpath(idl_filename)
    idl_file_contents = get_file_contents(full_path)
    extended_attributes = get_interface_extended_attributes_from_idl(
        idl_file_contents)

    global_keys = GLOBAL_EXTENDED_ATTRIBUTES.intersection(
        extended_attributes.iterkeys())
    if not global_keys:
        return
    if len(global_keys) > 1:
        raise ValueError(
            'The [Global] and [PrimaryGlobal] extended attributes '
            'MUST NOT be declared on the same interface.')
    global_key = next(iter(global_keys))

    global_value = extended_attributes[global_key]
    if global_value:
        return global_value.strip('()').split(',')
    return [interface_name]
def record_global_constructors(idl_filename):
    interface_name = idl_filename_to_interface_name(idl_filename)
    full_path = os.path.realpath(idl_filename)
    idl_file_contents = get_file_contents(full_path)
    extended_attributes = get_interface_extended_attributes_from_idl(idl_file_contents)

    # An interface property is produced for every non-callback interface
    # that does not have [NoInterfaceObject].
    # Callback interfaces with constants also have interface properties,
    # but there are none of these in Blink.
    # http://heycam.github.io/webidl/#es-interfaces
    if (is_callback_interface_from_idl(idl_file_contents) or
        'NoInterfaceObject' in extended_attributes):
        return

    # The [Exposed] extended attribute MUST take an identifier list. Each
    # identifier in the list MUST be a global name. An interface or interface
    # member the extended attribute applies to will be exposed only on objects
    # associated with ECMAScript global environments whose global object
    # implements an interface that has a matching global name.
    # FIXME: In spec names are comma-separated, but that makes parsing very
    # difficult (https://www.w3.org/Bugs/Public/show_bug.cgi?id=24959).
    exposed_global_names = extended_attributes.get('Exposed', 'Window').split('&')
    new_constructors_list = generate_global_constructors_list(interface_name, extended_attributes)
    for exposed_global_name in exposed_global_names:
        global_name_to_constructors[exposed_global_name].extend(new_constructors_list)
예제 #10
0
def idl_file_to_global_names(idl_filename):
    """Returns global names, if any, for an IDL file.

    If the [Global] or [PrimaryGlobal] extended attribute is declared with an
    identifier list argument, then those identifiers are the interface's global
    names; otherwise, the interface has a single global name, which is the
    interface's identifier (http://heycam.github.io/webidl/#Global).
    """
    interface_name = idl_filename_to_interface_name(idl_filename)
    full_path = os.path.realpath(idl_filename)
    idl_file_contents = get_file_contents(full_path)
    extended_attributes = get_interface_extended_attributes_from_idl(
        idl_file_contents)

    global_keys = GLOBAL_EXTENDED_ATTRIBUTES.intersection(
        extended_attributes.iterkeys())
    if not global_keys:
        return
    if len(global_keys) > 1:
        raise ValueError(
            'The [Global] and [PrimaryGlobal] extended attributes '
            'MUST NOT be declared on the same interface.')
    global_key = next(iter(global_keys))

    global_value = extended_attributes[global_key]
    if global_value:
        # FIXME: In spec names are comma-separated, which makes parsing very
        # difficult (https://www.w3.org/Bugs/Public/show_bug.cgi?id=24959).
        return global_value.split('&')
    return [interface_name]
def main():
    options, filenames = parse_options()
    component = options.component
    idl_filenames = read_idl_files_list_from_file(filenames[0], is_gyp_format=False)
    interface_names = [idl_filename_to_interface_name(file_path) for file_path in idl_filenames]
    file_contents = generate_content(component, interface_names)
    write_content(file_contents, filenames[1])
예제 #12
0
    def load_global_pickles(self, global_entries):
        # List of all interfaces and callbacks for global code generation.
        world = {'interfaces': [], 'callbacks': []}

        # Load all pickled data for each interface.
        for (directory, file_list) in global_entries:
            for idl_filename in file_list:
                interface_name = idl_filename_to_interface_name(idl_filename)
                idl_pickle_filename = interface_name + "_globals.pickle"
                idl_pickle_filename = os.path.join(directory,
                                                   idl_pickle_filename)
                if not os.path.exists(idl_pickle_filename):
                    logging.warn("Missing %s" % idl_pickle_filename)
                    continue
                with open(idl_pickle_filename) as idl_pickle_file:
                    idl_world = pickle.load(idl_pickle_file)
                    if 'interface' in idl_world:
                        # FIXME: Why are some of these None?
                        if idl_world['interface']:
                            world['interfaces'].append(idl_world['interface'])
                    if 'callback' in idl_world:
                        # FIXME: Why are some of these None?
                        if idl_world['callback']:
                            world['callbacks'].append(idl_world['callback'])

        world['interfaces'] = sorted(world['interfaces'],
                                     key=lambda (x): x['name'])
        world['callbacks'] = sorted(world['callbacks'],
                                    key=lambda (x): x['name'])
        return world
예제 #13
0
def record_global_constructors(idl_filename):
    interface_name = idl_filename_to_interface_name(idl_filename)
    full_path = os.path.realpath(idl_filename)
    idl_file_contents = get_file_contents(full_path)
    extended_attributes = get_interface_extended_attributes_from_idl(
        idl_file_contents)

    # An interface property is produced for every non-callback interface
    # that does not have [NoInterfaceObject].
    # Callback interfaces with constants also have interface properties,
    # but there are none of these in Blink.
    # http://heycam.github.io/webidl/#es-interfaces
    if (is_callback_interface_from_idl(idl_file_contents)
            or 'NoInterfaceObject' in extended_attributes):
        return

    # The [Exposed] extended attribute MUST take an identifier list. Each
    # identifier in the list MUST be a global name. An interface or interface
    # member the extended attribute applies to will be exposed only on objects
    # associated with ECMAScript global environments whose global object
    # implements an interface that has a matching global name.
    # FIXME: In spec names are comma-separated, but that makes parsing very
    # difficult (https://www.w3.org/Bugs/Public/show_bug.cgi?id=24959).
    exposed_global_names = extended_attributes.get('Exposed',
                                                   'Window').split('&')
    new_constructors_list = generate_global_constructors_list(
        interface_name, extended_attributes)
    for exposed_global_name in exposed_global_names:
        global_name_to_constructors[exposed_global_name].extend(
            new_constructors_list)
예제 #14
0
def record_global_constructors(idl_filename):
    interface_name = idl_filename_to_interface_name(idl_filename)
    full_path = os.path.realpath(idl_filename)
    idl_file_contents = get_file_contents(full_path)
    extended_attributes = get_interface_extended_attributes_from_idl(idl_file_contents)

    # An interface property is produced for every non-callback interface
    # that does not have [NoInterfaceObject].
    # Callback interfaces with constants also have interface properties,
    # but there are none of these in Blink.
    # http://heycam.github.io/webidl/#es-interfaces
    if ((not should_generate_impl_file_from_idl(idl_file_contents)) or
        is_callback_interface_from_idl(idl_file_contents) or
        'NoInterfaceObject' in extended_attributes):
        return

    exposed_arguments = get_interface_exposed_arguments(idl_file_contents)
    if exposed_arguments:
        # Exposed(Arguments) case
        for argument in exposed_arguments:
            if 'RuntimeEnabled' in extended_attributes:
                raise ValueError('RuntimeEnabled should not be used with Exposed(Arguments)')
            attributes = extended_attributes.copy()
            attributes['RuntimeEnabled'] = argument['runtime_enabled']
            new_constructors_list = generate_global_constructors_list(interface_name, attributes)
            global_name_to_constructors[argument['exposed']].extend(new_constructors_list)
    else:
        # Exposed=env or Exposed=(env1,...) case
        exposed_global_names = extended_attributes.get('Exposed', 'Window').strip('()').split(',')
        new_constructors_list = generate_global_constructors_list(interface_name, extended_attributes)
        for name in exposed_global_names:
            global_name_to_constructors[name].extend(new_constructors_list)
예제 #15
0
def idl_file_to_global_names(idl_filename):
    """Returns global names, if any, for an IDL file.

    If the [Global] or [PrimaryGlobal] extended attribute is declared with an
    identifier list argument, then those identifiers are the interface's global
    names; otherwise, the interface has a single global name, which is the
    interface's identifier (http://heycam.github.io/webidl/#Global).
    """
    interface_name = idl_filename_to_interface_name(idl_filename)
    full_path = os.path.realpath(idl_filename)
    idl_file_contents = get_file_contents(full_path)
    extended_attributes = get_interface_extended_attributes_from_idl(idl_file_contents)

    global_keys = GLOBAL_EXTENDED_ATTRIBUTES.intersection(extended_attributes.iterkeys())
    if not global_keys:
        return
    if len(global_keys) > 1:
        raise ValueError(
            "The [Global] and [PrimaryGlobal] extended attributes " "MUST NOT be declared on the same interface."
        )
    global_key = next(iter(global_keys))

    global_value = extended_attributes[global_key]
    if global_value:
        # FIXME: In spec names are comma-separated, which makes parsing very
        # difficult (https://www.w3.org/Bugs/Public/show_bug.cgi?id=24959).
        return global_value.split("&")
    return [interface_name]
def extract_meta_data(file_paths):
    """Extracts conditional and interface name from each IDL file."""
    meta_data_list = []

    for file_path in file_paths:
        if not file_path.endswith('.idl'):
            print 'WARNING: non-IDL file passed: "%s"' % file_path
            continue
        if not os.path.exists(file_path):
            print 'WARNING: file not found: "%s"' % file_path
            continue

        idl_file_contents = get_file_contents(file_path)
        if not should_generate_impl_file_from_idl(idl_file_contents):
            continue

        # Extract interface name from file name
        interface_name = idl_filename_to_interface_name(file_path)

        meta_data = {
            'conditional': extract_conditional(idl_file_contents),
            'name': interface_name,
        }
        meta_data_list.append(meta_data)

    return meta_data_list
예제 #17
0
def main():
    options, filenames = parse_options()
    component = options.component
    idl_filenames = read_idl_files_list_from_file(abs(filenames[0]),
                                                  is_gyp_format=False)
    interface_names = [
        idl_filename_to_interface_name(file_path)
        for file_path in idl_filenames
    ]
    file_contents = generate_content(component, interface_names)
    write_content(file_contents, abs(filenames[1]))
예제 #18
0
    def compile_and_write(self, idl_filename):
        interface_name = idl_filename_to_interface_name(idl_filename)
        definitions = self.reader.read_idl_definitions(idl_filename)
        target_definitions = definitions[self.target_component]
        output_code_list = self.code_generator.generate_code(
            target_definitions, interface_name)

        # Generator may choose to omit the file.
        if output_code_list is None:
            return

        for output_path, output_code in output_code_list:
            write_file(output_code, output_path)
예제 #19
0
    def compile_and_write(self, idl_filename):
        interface_name = idl_filename_to_interface_name(idl_filename)
        definitions = self.reader.read_idl_definitions(idl_filename)
        # Merge all component definitions into a single list, since we don't really
        # care about components in Cobalt.
        assert len(definitions) == 1
        output_code_list = self.code_generator.generate_code(
            definitions.values()[0], interface_name)

        # Generator may choose to omit the file.
        if output_code_list is None:
            return

        for output_path, output_code in output_code_list:
            write_file(output_code, output_path)
def compute_info_individual(idl_filename, component_dir):
    full_path = os.path.realpath(idl_filename)
    idl_file_contents = get_file_contents(full_path)

    extended_attributes = get_interface_extended_attributes_from_idl(idl_file_contents)
    implemented_as = extended_attributes.get('ImplementedAs')
    relative_dir = relative_dir_posix(idl_filename)
    this_include_path = None if 'NoImplHeader' in extended_attributes else include_path(idl_filename, implemented_as)

    # Handle partial interfaces
    partial_interface_name = get_partial_interface_name_from_idl(idl_file_contents)
    if partial_interface_name:
        add_paths_to_partials_dict(partial_interface_name, full_path, this_include_path)
        return

    # If not a partial interface, the basename is the interface name
    interface_name = idl_filename_to_interface_name(idl_filename)

    # 'implements' statements can be included in either the file for the
    # implement*ing* interface (lhs of 'implements') or implement*ed* interface
    # (rhs of 'implements'). Store both for now, then merge to implement*ing*
    # interface later.
    left_interfaces, right_interfaces = get_implements_from_idl(idl_file_contents, interface_name)

    interfaces_info[interface_name] = {
        'component_dir': component_dir,
        'extended_attributes': extended_attributes,
        'full_path': full_path,
        'implemented_as': implemented_as,
        'implemented_by_interfaces': left_interfaces,  # private, merged to next
        'implements_interfaces': right_interfaces,
        'include_path': this_include_path,
        'is_callback_interface': is_callback_interface_from_idl(idl_file_contents),
        'is_dictionary': is_dictionary_from_idl(idl_file_contents),
        # FIXME: temporary private field, while removing old treatement of
        # 'implements': http://crbug.com/360435
        'is_legacy_treat_as_partial_interface': 'LegacyTreatAsPartialInterface' in extended_attributes,
        'parent': get_parent_interface(idl_file_contents),
        # Interfaces that are referenced (used as types) and that we introspect
        # during code generation (beyond interface-level data ([ImplementedAs],
        # is_callback_interface, ancestors, and inherited extended attributes):
        # deep dependencies.
        # These cause rebuilds of referrers, due to the dependency, so these
        # should be minimized; currently only targets of [PutForwards].
        'referenced_interfaces': get_put_forward_interfaces_from_idl(idl_file_contents),
        'relative_dir': relative_dir,
    }
예제 #21
0
def validate_blink_idl_definitions(idl_filename, idl_file_basename,
                                   definitions):
    """Validate file contents with filename convention.

       The Blink IDL conventions are:
       - If an IDL file defines an interface, a dictionary, or an exception,
         the IDL file must contain exactly one definition. 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).
       - An IDL file can contain typedefs and enums without having other
         definitions. There is no filename convention in this case.
       - Otherwise, an IDL file is invalid.
    """
    targets = (definitions.interfaces.values() +
               definitions.dictionaries.values())
    number_of_targets = len(targets)
    if number_of_targets > 1:
        raise Exception(
            'Expected exactly 1 definition in file {0}, but found {1}'
            .format(idl_filename, number_of_targets))
    if number_of_targets == 0:
        if not (definitions.enumerations or definitions.typedefs):
            raise Exception(
                'No definition found in %s' % idl_filename)
        return
    target = targets[0]
    idl_interface_name = idl_filename_to_interface_name(idl_filename)
    if not target.is_partial and target.name != idl_interface_name:
        if target.name.lower() == idl_interface_name.lower():
            # Names differ only by capitalization. This could indicate a
            # problem with the special tokens in the snake_case->TitleCase
            # conversion in
            raise Exception(
                '"Unexpected capitalization of definition name "{0}" for IDL file name "{1}". '
                'Does a special token need to be added to '
                'idl_filename_to_interface_name in utilities.py?'
                .format(target.name, os.path.basename(idl_filename)))
        else:
            raise Exception(
                'Definition name "{0}" disagrees with IDL file name "{1}".'
                .format(target.name, os.path.basename(idl_filename)))
def extract_meta_data(file_paths):
    """Extracts conditional and interface name from each IDL file."""
    meta_data_list = []

    for file_path in file_paths:
        if not file_path.endswith('.idl'):
            print 'WARNING: non-IDL file passed: "%s"' % file_path
            continue
        if not os.path.exists(file_path):
            print 'WARNING: file not found: "%s"' % file_path
            continue

        # Extract interface name from file name
        interface_name = idl_filename_to_interface_name(file_path)

        meta_data = {
            'conditional': extract_conditional(file_path),
            'name': interface_name,
        }
        meta_data_list.append(meta_data)

    return meta_data_list
예제 #23
0
    def load_global_pickles(self, global_entries):
        # List of all interfaces and callbacks for global code generation.
        world = {'interfaces': [], 'callbacks': []}

        # Load all pickled data for each interface.
        for (directory, file_list) in global_entries:
            for filename in file_list:
                if os.path.splitext(filename)[1] == '.dart':
                    # Special case: any .dart files in the list should be added
                    # to dart_sky.dart directly, but don't need to be processed.
                    interface_name = os.path.splitext(
                        os.path.basename(filename))[0]
                    world['interfaces'].append(
                        {'name': "Custom" + interface_name})
                    continue
                interface_name = idl_filename_to_interface_name(filename)
                idl_pickle_filename = interface_name + "_globals.pickle"
                idl_pickle_filename = os.path.join(directory,
                                                   idl_pickle_filename)
                if not os.path.exists(idl_pickle_filename):
                    logging.warn("Missing %s" % idl_pickle_filename)
                    continue
                with open(idl_pickle_filename) as idl_pickle_file:
                    idl_world = pickle.load(idl_pickle_file)
                    if 'interface' in idl_world:
                        # FIXME: Why are some of these None?
                        if idl_world['interface']:
                            world['interfaces'].append(idl_world['interface'])
                    if 'callback' in idl_world:
                        # FIXME: Why are some of these None?
                        if idl_world['callback']:
                            world['callbacks'].append(idl_world['callback'])

        world['interfaces'] = sorted(world['interfaces'],
                                     key=lambda (x): x['name'])
        world['callbacks'] = sorted(world['callbacks'],
                                    key=lambda (x): x['name'])
        return world