ESBMC
Efficient SMT-based Context-Bounded Model Checker
Loading...
Searching...
No Matches
preprocessor.decorator_lowering Namespace Reference

Functions

 _decorator_root (decorator)
 _is_user_decorator (decorator, user_functions)
 _refuse (node, what, module_name)
 _returns_lambda (function)
 _check_decorators (function, defined, original, module_name)
 _rebind (function, defined, original, module_name)
 _refuse_later_decorators (function, user_functions, defined, module_name)
 _refuse_local_decorators (module, module_name)
 _refuse_nested_decorators (module, user_functions, module_name)
 lower_user_decorators (module, module_name)

Variables

str UNDECORATED_PREFIX = "ESBMC_undecorated_"

Detailed Description

Apply a decorator the program itself defines (#8419).

`@d def f` binds `f` to `d(f)`. The converter otherwise ignored a decorator,
so the undecorated function ran instead of what the decorator returns.

Function Documentation

◆ _check_decorators()

preprocessor.decorator_lowering._check_decorators ( function,
defined,
original,
module_name )
protected

◆ _decorator_root()

preprocessor.decorator_lowering._decorator_root ( decorator)
protected

◆ _is_user_decorator()

preprocessor.decorator_lowering._is_user_decorator ( decorator,
user_functions )
protected

◆ _rebind()

preprocessor.decorator_lowering._rebind ( function,
defined,
original,
module_name )
protected
`def f` renamed, then `f = d1(d2(renamed))`, as Python applies them.

Each application calls its own copy of the decorator. A nested function
is one static function here, so the function a wrapper captures would
otherwise be shared by every function the decorator is applied to.

◆ _refuse()

preprocessor.decorator_lowering._refuse ( node,
what,
module_name )
protected

◆ _refuse_later_decorators()

preprocessor.decorator_lowering._refuse_later_decorators ( function,
user_functions,
defined,
module_name )
protected
Refuse a decorator this program defines only further down.

◆ _refuse_local_decorators()

preprocessor.decorator_lowering._refuse_local_decorators ( module,
module_name )
protected
Refuse a decorator a function body defines: it would be ignored.

◆ _refuse_nested_decorators()

preprocessor.decorator_lowering._refuse_nested_decorators ( module,
user_functions,
module_name )
protected
Refuse a decorator this program defines anywhere but on a top-level def.

◆ _returns_lambda()

preprocessor.decorator_lowering._returns_lambda ( function)
protected

◆ lower_user_decorators()

preprocessor.decorator_lowering.lower_user_decorators ( module,
module_name )
Rebind each top-level function decorated by a top-level function of this
module, using the definition of the decorator that precedes it. Such a
decorator anywhere else, or defined only further down, is refused, since it
would be ignored.

Variable Documentation

◆ UNDECORATED_PREFIX

str preprocessor.decorator_lowering.UNDECORATED_PREFIX = "ESBMC_undecorated_"