Esempio n. 1
0
def map_sum(viper_ast: ViperAST, ref, key_type, pos=None, info=None):
    type_vars = {viper_ast.TypeVar(mangled.MAP_KEY_VAR): key_type}
    type = viper_ast.Int
    msum = mangled.MAP_SUM
    domain = mangled.MAP_INT_DOMAIN
    return viper_ast.DomainFuncApp(msum, [ref], type, pos, info, domain,
                                   type_vars)
Esempio n. 2
0
def array_init(viper_ast: ViperAST,
               arg,
               size: int,
               element_type,
               pos=None,
               info=None):
    arr_type = array_type(viper_ast, element_type)
    type_vars = {viper_ast.TypeVar(mangled.ARRAY_ELEMENT_VAR): element_type}
    size = viper_ast.IntLit(size, pos, info)
    init = mangled.ARRAY_INIT
    domain = mangled.ARRAY_DOMAIN
    return viper_ast.DomainFuncApp(init, [arg, size], arr_type, pos, info,
                                   domain, type_vars)
Esempio n. 3
0
def _struct_type_var_map(viper_ast: ViperAST, member_type):
    member = viper_ast.TypeVar(mangled.STRUCT_OPS_VALUE_VAR)
    return {member: member_type}
Esempio n. 4
0
def _map_type_var_map(viper_ast: ViperAST, key_type, value_type):
    key = viper_ast.TypeVar(mangled.MAP_KEY_VAR)
    value = viper_ast.TypeVar(mangled.MAP_VALUE_VAR)
    return {key: key_type, value: value_type}