5#include <nlohmann/json.hpp>
14#include <unordered_map>
33 const nlohmann::json &function_node,
36 exprt &function_body);
41 const exprt &value_expr,
42 const typet &annotated_type)
const;
45 const exprt &value_expr,
46 const typet &annotated_type,
47 const std::vector<typet> &allowed_types,
48 const std::string &context_name,
53 const exprt &value_expr,
54 const typet &annotated_type,
55 const std::vector<typet> &allowed_types,
56 const std::string &context_name,
63 const std::string &class_name,
64 const std::string &expected_base)
const;
67 exprt build_none_check(
const exprt &value_expr)
const;
70 std::unordered_map<std::string, std::vector<typet>> annotation_type_cache_;
Definition std_code.h:243
Definition std_types.h:280
Main converter for transforming Python AST into ESBMC's intermediate representation.
Definition python_converter.h:76
void inject_parameter_type_assertions(const nlohmann::json &function_node, const symbol_id &function_id, const code_typet &type, exprt &function_body)
Definition python_typechecking.cpp:361
python_typechecking(python_converter &converter)
Definition python_typechecking.cpp:13
void cache_annotation_types(symbolt &symbol, const nlohmann::json &annotation)
Definition python_typechecking.cpp:105
exprt build_isinstance_check(const exprt &value_expr, const typet &annotated_type) const
Definition python_typechecking.cpp:161
bool class_derives_from(const std::string &class_name, const std::string &expected_base) const
Definition python_typechecking.cpp:451
void emit_type_annotation_assertion(const exprt &value_expr, const typet &annotated_type, const std::vector< typet > &allowed_types, const std::string &context_name, const locationt &location, codet &target_block)
Definition python_typechecking.cpp:340
std::string get_constructor_name(const nlohmann::json &func_node) const
Definition python_typechecking.cpp:437
bool build_type_assertion(const exprt &value_expr, const typet &annotated_type, const std::vector< typet > &allowed_types, const std::string &context_name, const locationt &location, code_assertt &out_assert) const
Definition python_typechecking.cpp:253
std::vector< typet > get_annotation_types(const std::string &symbol_id) const
Definition python_typechecking.cpp:128
bool should_skip_type_assertion(const typet &annotated_type) const
Definition python_typechecking.cpp:136
std::vector< typet > collect_annotation_types(const nlohmann::json &annotation) const
Definition python_typechecking.cpp:18