def consider_call_site(descs, args, s_result, op): cnt, keys, star = rawshape(args) shape = cnt + 1, keys, star # account for the extra 'self' row = build_calltable_row(descs, args, op) family = descs[0].getcallfamily() family.calltable_add_row(shape, row) descs[0].mergecallfamilies(*descs[1:])
def variant_for_call_site(bookkeeper, family, descs, args, op): shape = rawshape(args) bookkeeper.enter(None) try: row = FunctionDesc.row_to_consider(descs, args, op) finally: bookkeeper.leave() index = family.calltable_lookup_row(shape, row) return shape, index
def test_rawshape(self): args = MockArgs([1, 2, 3]) assert rawshape(args) == (3, (), False) args = MockArgs([1, 2, 3, 4, 5]) assert rawshape(args) == (5, (), False) args = MockArgs([1], {'c': 3, 'b': 2}) assert rawshape(args) == (1, ('b', 'c'), False) args = MockArgs([1], {'c': 5}) assert rawshape(args) == (1, ('c', ), False) args = MockArgs([1], {'c': 5, 'd': 7}) assert rawshape(args) == (1, ('c', 'd'), False) args = MockArgs([1, 2, 3, 4, 5], {'e': 5, 'd': 7}) assert rawshape(args) == (5, ('d', 'e'), False)
def test_rawshape(self): space = DummySpace() args = make_arguments_for_translation(space, [1,2,3]) assert rawshape(args) == (3, (), False, False) args = make_arguments_for_translation(space, [1]) assert rawshape(args, 2) == (3, (), False, False) args = make_arguments_for_translation(space, [1,2,3,4,5]) assert rawshape(args) == (5, (), False, False) args = make_arguments_for_translation(space, [1], {'c': 3, 'b': 2}) assert rawshape(args) == (1, ('b', 'c'), False, False) args = make_arguments_for_translation(space, [1], {'c': 5}) assert rawshape(args) == (1, ('c', ), False, False) args = make_arguments_for_translation(space, [1], {'c': 5, 'd': 7}) assert rawshape(args) == (1, ('c', 'd'), False, False) args = make_arguments_for_translation(space, [1,2,3,4,5], {'e': 5, 'd': 7}) assert rawshape(args) == (5, ('d', 'e'), False, False)
def consider_call_site(bookkeeper, family, descs, args, s_result, op): cnt, keys, star = rawshape(args) shape = cnt + 1, keys, star # account for the extra 'self' row = FunctionDesc.row_to_consider(descs, args, op) family.calltable_add_row(shape, row)
def consider_call_site(bookkeeper, family, descs, args, s_result, op): shape = rawshape(args) row = FunctionDesc.row_to_consider(descs, args, op) family.calltable_add_row(shape, row)
def find_row(self, bookkeeper, descs, args, op): shape = rawshape(args) with bookkeeper.at_position(None): row = build_calltable_row(descs, args, op) index = self.calltable_lookup_row(shape, row) return shape, index
def consider_call_site(descs, args, s_result, op): family = descs[0].getcallfamily() shape = rawshape(args) row = build_calltable_row(descs, args, op) family.calltable_add_row(shape, row) descs[0].mergecallfamilies(*descs[1:])
def consider_call_site(descs, args, s_result, op): shape = rawshape(args) row = FunctionDesc.row_to_consider(descs, args, op) family = descs[0].getcallfamily() family.calltable_add_row(shape, row)