def _get_self_visibility(context, module_):
    for ptd in module_get_payloadtypedecl_children(module_):
        n = payloadtypedecl_get_declaration_name(ptd)
        context = context.add_visible_payload(n, ptd)
    for gpd in module_get_globalprotocoldecl_children(module_):
        n = globalprotocoldecl_get_name(gpd)
        context = context.add_visible_global(n, gpd)
    for lpd in module_get_localprotocoldecl_children(module_):
        n = localprotocoldecl_get_name(lpd)
        context = context.add_visible_local(n, lpd)
    importmembers = module_get_importmember_children(module_)
    for im in importmembers:
        util.report_error("TODO: member import: " + im)
        # FIXME: members
    return context
Beispiel #2
0
def _get_self_visibility(context, module_):
    for ptd in module_get_payloadtypedecl_children(module_):
        n = payloadtypedecl_get_declaration_name(ptd)
        context = context.add_visible_payload(n, ptd)
    for gpd in module_get_globalprotocoldecl_children(module_):
        n = globalprotocoldecl_get_name(gpd)
        context = context.add_visible_global(n, gpd)
    for lpd in module_get_localprotocoldecl_children(module_):
        n = localprotocoldecl_get_name(lpd)
        context = context.add_visible_local(n, lpd)
    importmembers = module_get_importmember_children(module_)
    for im in importmembers:
        util.report_error("TODO: member import: " + im)
        # FIXME: members
    return context
def _add_all_members(context_, fmn, module_):
    for ptd in module_get_payloadtypedecl_children(module_):
        n = payloadtypedecl_get_declaration_name(ptd)
        f = fmn + '.' + n
        context_ = context_.add_member(f, ptd)
    for gpd in module_get_globalprotocoldecl_children(module_):
        n = globalprotocoldecl_get_name(gpd)
        f = fmn + '.' + n
        context_ = context_.add_member(f, gpd)
    for lpd in module_get_localprotocoldecl_children(module_):
        n = localprotocoldecl_get_name(lpd)
        f = fmn + '.' + n
        context_ = context_.add_member(f, lpd)
    importmembers = module_get_importmember_children(module_)
    for im in importmembers:
        # TODO: members
        util.report_error("TODO member import: " + im)
    return context_
def _add_all_members(context_, fmn, module_):
    for ptd in module_get_payloadtypedecl_children(module_):
        n = payloadtypedecl_get_declaration_name(ptd)
        f = fmn + "." + n
        context_ = context_.add_member(f, ptd)
    for gpd in module_get_globalprotocoldecl_children(module_):
        n = globalprotocoldecl_get_name(gpd)
        f = fmn + "." + n
        context_ = context_.add_member(f, gpd)
    for lpd in module_get_localprotocoldecl_children(module_):
        n = localprotocoldecl_get_name(lpd)
        f = fmn + "." + n
        context_ = context_.add_member(f, lpd)
    importmembers = module_get_importmember_children(module_)
    for im in importmembers:
        # TODO: members
        util.report_error("TODO member import: " + im)
    return context_
Beispiel #5
0
def _get_module_members(context, dn, module_):
    for ptd in module_get_payloadtypedecl_children(module_):
        n = payloadtypedecl_get_declaration_name(ptd)
        f = dn + '.' + n
        context = context.add_visible_payload(f, ptd)
        #context = context.add_visible_payload(n, ptd)
    for gpd in module_get_globalprotocoldecl_children(module_):
        n = globalprotocoldecl_get_name(gpd)
        f = dn + '.' + n
        context = context.add_visible_global(f, gpd)
        #context = context.add_visible_global(n, gpd)
    for lpd in module_get_localprotocoldecl_children(module_):
        n = localprotocoldecl_get_name(lpd)
        f = dn + '.' + n
        context = context.add_visible_local(f, lpd)
        #context = context.add_visible_local(n, gpd)
    importmembers = module_get_importmember_children(module_)
    for im in importmembers:
        util.report_error("TODO member import: " + im)
        # TODO: members
    return context
def _get_module_members(context, dn, module_):
    for ptd in module_get_payloadtypedecl_children(module_):
        n = payloadtypedecl_get_declaration_name(ptd)
        f = dn + '.' + n
        context = context.add_visible_payload(f, ptd)
        #context = context.add_visible_payload(n, ptd)
    for gpd in module_get_globalprotocoldecl_children(module_):
        n = globalprotocoldecl_get_name(gpd)
        f = dn + '.' + n
        context = context.add_visible_global(f, gpd)
        #context = context.add_visible_global(n, gpd)
    for lpd in module_get_localprotocoldecl_children(module_):
        n = localprotocoldecl_get_name(lpd)
        f = dn + '.' + n
        context = context.add_visible_local(f, lpd)
        #context = context.add_visible_local(n, gpd)
    importmembers = module_get_importmember_children(module_)
    for im in importmembers:
        util.report_error("TODO member import: " + im)
        # TODO: members
    return context
def check_wellformedness_visit(checker, node_):
    ##
    # Section 4.2 -- Simple name and filename of module condition checked in moduledecl_ (also currently checked earlier by moduleLoader)

    ##
    # Section 4.2 -- Distinct module names condition
    fmn = moduledecl_get_full_name(get_moduledecl_child(node_))
    smn_from_fmn = util.get_simple_module_name_from_full_module_name(fmn)
    names = [smn_from_fmn]
    for im in get_importmodule_children(node_):
        name = importmodule_get_declaration_name(im)
        if name in names:
            util.report_error("Bad module import declaration name: " + name)
        names.append(name)

    ##
    # Section 4.2 -- Distinct member names condition
    names = []
    for ptd in get_payloadtypedecl_children(node_):
        name = payloadtypedecl_get_declaration_name(ptd)
        if name in names:
            util.report_error("Bad payload type declaration name: " + name)
        names.append(name)
    for gpd in get_globalprotocoldecl_children(node_):
        name = globalprotocoldecl_get_name(gpd)
        if name in names:
            util.report_error("Bad global protocol declaration name: " + name)
        names.append(name)
    for lpd in get_localprotocoldecl_children(node_):
        name = localprotocoldecl_get_name(lpd)
        if name in names:
            util.report_error("Bad local protocol declaration name: " + name)
        names.append(name)
    for im in get_importmember_children(node_):
        # TODO: import member declaration names
        util.report_error("TODO member import: " + im)

    ##
    # Section 4.2 -- Well-formed import declarations and members
    #
    # Same visiting structure as traverse; in the general case, however,
    # well-formedness visiting needs to visit each child with a separate
    # context, so cannot directly reuse the traverse routine here
    visited = []
    moduledecl_ = get_moduledecl_child(node_)
    visited.append(checker.visit(moduledecl_))
    for im in get_importmodule_children(node_):
        visited.append(checker.visit(im))
    for im in get_importmember_children(node_):
        util.report_error("Member Import not supported yet.")
    # FIXME: also members
    for ptd in get_payloadtypedecl_children(node_):
        visited.append(checker.visit(ptd))
    for gpd in get_globalprotocoldecl_children(node_):
        visited.append(checker.visit(gpd))
    for lpd in get_localprotocoldecl_children(node_):
        # visited.append(checker.visit(lpd))
        # TODO
        util.report_warning("[WellformednessChecker] Skipping localprotocoldecl: " + localprotocoldecl_get_name(lpd))
        # print "Skipped:\n", localprotocoldecl_pretty_print(lpd)
    # rebuild using new children
    return util.antlr_dupnode_and_replace_children(node_, visited)
def check_wellformedness_visit(checker, node_):
    ##
    # Section 4.2 -- Simple name and filename of module condition checked in moduledecl_ (also currently checked earlier by moduleLoader)

    ##
    # Section 4.2 -- Distinct module names condition
    fmn = moduledecl_get_full_name(get_moduledecl_child(node_))
    smn_from_fmn = util.get_simple_module_name_from_full_module_name(fmn)
    names = [smn_from_fmn]
    for im in get_importmodule_children(node_):
        name = importmodule_get_declaration_name(im)
        if name in names:
            util.report_error("Bad module import declaration name: " + name)
        names.append(name)

    ##
    # Section 4.2 -- Distinct member names condition
    names = []
    for ptd in get_payloadtypedecl_children(node_):
        name = payloadtypedecl_get_declaration_name(ptd)
        if name in names:
            util.report_error("Bad payload type declaration name: " + name)
        names.append(name)
    for gpd in get_globalprotocoldecl_children(node_):
        name = globalprotocoldecl_get_name(gpd)
        if name in names:
            util.report_error("Bad global protocol declaration name: " + name)
        names.append(name)
    for lpd in get_localprotocoldecl_children(node_):
        name = localprotocoldecl_get_name(lpd)
        if name in names:
            util.report_error("Bad local protocol declaration name: " + name)
        names.append(name)
    for im in get_importmember_children(node_):
        # TODO: import member declaration names
        util.report_error("TODO member import: " + im)

    ##
    # Section 4.2 -- Well-formed import declarations and members
    #
    # Same visiting structure as traverse; in the general case, however,
    # well-formedness visiting needs to visit each child with a separate
    # context, so cannot directly reuse the traverse routine here
    visited = []
    moduledecl_ = get_moduledecl_child(node_)
    visited.append(checker.visit(moduledecl_))
    for im in get_importmodule_children(node_):
        visited.append(checker.visit(im))
    for im in get_importmember_children(node_):
        util.report_error("Member Import not supported yet.")
    # FIXME: also members
    for ptd in get_payloadtypedecl_children(node_):
        visited.append(checker.visit(ptd))
    for gpd in get_globalprotocoldecl_children(node_):
        visited.append(checker.visit(gpd))
    for lpd in get_localprotocoldecl_children(node_):
        #visited.append(checker.visit(lpd))
        # TODO
        util.report_warning("[WellformednessChecker] Skipping localprotocoldecl: " \
                            + localprotocoldecl_get_name(lpd))
        #print "Skipped:\n", localprotocoldecl_pretty_print(lpd)
    # rebuild using new children
    return util.antlr_dupnode_and_replace_children(node_, visited)