コード例 #1
0
ファイル: ssa.py プロジェクト: dkreuter/pycodeanalysis
    def gather(self, writers):
        # TODO: Update to new infrastructure
        writers = list(writers)
        wlocals = (linker.state for linker in writers if linker.ready)
        wlocals = list(wlocals)
        zipped = list(zip_longest(*wlocals, fillvalue="local-width-mismatch"))
        r = tuple(map(frozenset, zipped))
        # print("writers:", writers)
        # print("locallinker-gather:", r)
        self.had_inputs = len(wlocals)
        self.prealloc(len(r))
        if zipped and "local-width-mismatch" in zipped[0]:
            print(len(writers))
            for i, w in enumerate(writers):
                print(i, w.state)
            assert 0

        self.input = self.prephi[:]
        change = False
        for i, a in enumerate(r):
            if len(a) > 1:
                self.input[i]._adj = a
            else:
                self.input[i] = util.only(a)
            change = True
        return change