(typemap, func_ir, var, accept_stride=False)
return True
return True if var can be determined to be a whole slice
return True if var can be determined to be a whole slice
return True if var can be determined to be a whole slice
def is_whole_slice(typemap, func_ir, var, accept_stride=False):
    """ return True if var can be determined to be a whole slice """
    require(typemap[var.name] == types.slice2_type
            or (accept_stride and typemap[var.name] == types.slice3_type))
    call_expr = get_definition(func_ir, var)
    require(isinstance(call_expr, ir.Expr) and call_expr.op == 'call')
    assert (len(call_expr.args) == 2
            or (accept_stride and len(call_expr.args) == 3))
    assert find_callname(func_ir, call_expr) == ('slice', 'builtins')
    arg0_def = get_definition(func_ir, call_expr.args[0])
    arg1_def = get_definition(func_ir, call_expr.args[1])
    require(isinstance(arg0_def, ir.Const) and arg0_def.value is None)
    require(isinstance(arg1_def, ir.Const) and arg1_def.value is None)
    return True
def is_whole_slice ( typemap , func_ir , var , accept_stride = False ) : require ( typemap [ var . name ] == types . slice2_type or ( accept_stride and typemap [ var . name ] == types . slice3_type ) ) call_expr = get_definition ( func_ir , var ) require ( isinstance ( call_expr , ir . Expr ) and call_expr . op == 'call' ) assert ( len ( call_expr . args ) == 2 or ( accept_stride and len ( call_expr . args ) == 3 ) ) assert find_callname ( func_ir , call_expr ) == ( 'slice' , 'builtins' ) arg0_def = get_definition ( func_ir , call_expr . args [ 0 ] ) arg1_def = get_definition ( func_ir , call_expr . args [ 1 ] ) require ( isinstance ( arg0_def , ir . Const ) and arg0_def . value is None ) require ( isinstance ( arg1_def , ir . Const ) and arg1_def . value is None ) return True