def _get_imported_modules(context, module_):
    importmodules = module_get_importmodule_children(module_)
    for im in importmodules:
        fn = importmodule_get_full_module_name(im)
        # Distinct names already checked
        dn = importmodule_get_declaration_name(im)
        m = context.get_module(fn)

        # Section 4.1.1 -- imported module_ referred to by declaration name
        if dn not in context.get_visible_modules().keys():
            context = context.add_visible_module(dn, m)
            context = _get_module_members(context, dn, m)
    return context
Example #2
0
def _get_imported_modules(context, module_):
    importmodules = module_get_importmodule_children(module_)
    for im in importmodules:
        fn = importmodule_get_full_module_name(im)
        # Distinct names already checked
        dn = importmodule_get_declaration_name(im)
        m = context.get_module(fn)

        # Section 4.1.1 -- imported module_ referred to by declaration name

        # FIXME: transitively import modules -- not working for project all (and do well-formedness?)
        if dn not in context.get_visible_modules().keys():
            context = context.add_visible_module(dn, m)
            context = _get_module_members(context, dn, m)
    return context
def _get_imported_modules(context, module_):
    importmodules = module_get_importmodule_children(module_)
    for im in importmodules:
        fn = importmodule_get_full_module_name(im)
        # Distinct names already checked
        dn = importmodule_get_declaration_name(im)
        m = context.get_module(fn)

        # Section 4.1.1 -- imported module_ referred to by declaration name
        
        # FIXME: transitively import modules -- not working for project all (and do well-formedness?)
        if dn not in context.get_visible_modules().keys():
            context = context.add_visible_module(dn, m)
            context = _get_module_members(context, dn, m)
    return context
def _add_module_and_get_dependencies(context_, filepath, current):
    # Section 4.2 -- Simple moduledecl name and filename of module
    #
    # Move to well-formedness? (Currently also checked for well-formed
    # moduledecl, but commenting this line here causes some problems for
    # mutually recursive imports -- should debug this)
    moduledecl_ = module_get_moduledecl_child(current)
    moduledecl_check_file_name(filepath, moduledecl_)
    fmn = moduledecl_get_full_name(moduledecl_)

    context_ = context_.add_source(fmn, filepath)
    # Make a combined add_source and add_module method for Context? (And move the
    # above name check into there)
    context_ = context_.add_module(fmn, current)
    #context_ = _add_all_members(context_, fmn, current)
        # Done later by memberloader

    importmodules = module_get_importmodule_children(current)
    for i in importmodules:
        fmn = importmodule_get_full_module_name(i)
        # sources and modules keys should match
        if fmn not in context_.get_modules().keys():
            tmp = util.convert_full_module_name_to_filepath(fmn)
            filepath = util.search_importpath_for_file(context_.import_path,
                                                       tmp)
            module_ = util.load_file_and_parse_module(filepath)
            #  # We found a parseable Scribble module at that file path -- but
            #  module decl not checked yet (checked by well-formedness, along
            #  with other well-formedness conditions) We found a parseable
            #  Scribble module at that file path -- but module decl not checked
            #  yet (checked by well-formedness, along with other well-formedness
            #  conditions)
            context_ = _add_module_and_get_dependencies(context_,
                                                        filepath,
                                                        module_)
    """importmembers = module.module_get_importmember_children(current)  # TODO: member imports"""

    return context_
Example #5
0
def _add_module_and_get_dependencies(context_, filepath, current):
    # Section 4.2 -- Simple moduledecl name and filename of module
    #
    # Move to well-formedness? (Currently also checked for well-formed
    # moduledecl, but commenting this line here causes some problems for
    # mutually recursive imports -- should debug this)
    moduledecl_ = module_get_moduledecl_child(current)
    moduledecl_check_file_name(filepath, moduledecl_)
    fmn = moduledecl_get_full_name(moduledecl_)

    context_ = context_.add_source(fmn, filepath)
    # Make a combined add_source and add_module method for Context? (And move the
    # above name check into there)
    context_ = context_.add_module(fmn, current)
    #context_ = _add_all_members(context_, fmn, current)
    # Done later by memberloader

    importmodules = module_get_importmodule_children(current)
    for i in importmodules:
        fmn = importmodule_get_full_module_name(i)
        # sources and modules keys should match
        if fmn not in context_.get_modules().keys():
            tmp = util.convert_full_module_name_to_filepath(fmn)
            filepath = util.search_importpath_for_file(context_.import_path,
                                                       tmp)
            module_ = util.load_file_and_parse_module(filepath)
            #  # We found a parseable Scribble module at that file path -- but
            #  module decl not checked yet (checked by well-formedness, along
            #  with other well-formedness conditions) We found a parseable
            #  Scribble module at that file path -- but module decl not checked
            #  yet (checked by well-formedness, along with other well-formedness
            #  conditions)
            context_ = _add_module_and_get_dependencies(
                context_, filepath, module_)
    """importmembers = module.module_get_importmember_children(current)  # TODO: member imports"""

    return context_