Esempio n. 1
0
    def visit_RelClear(self, node):
        if node.rel not in self.rels:
            return node

        code = (node, )
        clear_code = (L.RelClear(self.result_var), )
        code = L.insert_rel_maint(code, clear_code, L.SetRemove())
        return code
Esempio n. 2
0
    def visit_MapClear(self, node):
        sfm = self.setfrommaps_by_map.get(node.map, None)
        if sfm is None:
            return node

        code = (node, )
        clear_code = (L.RelClear(sfm.rel), )
        code = L.insert_rel_maint(code, clear_code, L.SetRemove())
        return code
Esempio n. 3
0
    def visit_RelClear(self, node):
        code = (node, )

        auxmaps = self.auxmaps_by_rel.get(node.rel, set())
        for auxmap in auxmaps:
            clear_code = (L.MapClear(auxmap.map), )
            code = L.insert_rel_maint(code, clear_code, L.SetRemove())

        wraps = self.wraps_by_rel.get(node.rel, set())
        for wrap in wraps:
            clear_code = (L.RelClear(wrap.rel), )
            code = L.insert_rel_maint(code, clear_code, L.SetRemove())

        return code
Esempio n. 4
0
    def visit_ResetDemand(self, node):
        if len(node.names) == 0:
            demand_sets = [
                query.demand_set for query in self.queries
                if query.demand_set is not None
            ]
        else:
            demand_sets = [
                query.demand_set for query in self.queries
                if query.name in node.names if query.demand_set is not None
            ]

        code = tuple(L.RelClear(ds) for ds in demand_sets)
        return code
Esempio n. 5
0
    def visit_SetClear(self, node):
        if not (isinstance(node.target, L.Name)
                and node.target.id in self.rels):
            return node

        return L.RelClear(node.target.id)