From 1089ee080369ce50ccb929fbc1d8bcc3a55c8c6b Mon Sep 17 00:00:00 2001 From: Charles Cooper Date: Sun, 14 Jan 2024 16:47:13 -0500 Subject: [PATCH] add sanity checks --- vyper/codegen/function_definitions/external_function.py | 2 ++ vyper/codegen/function_definitions/internal_function.py | 3 +++ 2 files changed, 5 insertions(+) diff --git a/vyper/codegen/function_definitions/external_function.py b/vyper/codegen/function_definitions/external_function.py index 5539c78e96..2013c8cd73 100644 --- a/vyper/codegen/function_definitions/external_function.py +++ b/vyper/codegen/function_definitions/external_function.py @@ -171,6 +171,8 @@ def generate_ir_for_external_function(code, compilation_target): metadata required for `module.py` to construct the selector table. """ func_t = code._metadata["func_type"] + assert func_t.is_external or func_t.is_constructor # sanity check + context = initialize_context(func_t, compilation_target, func_t.is_constructor) nonreentrant_pre, nonreentrant_post = get_nonreentrant_lock(func_t) diff --git a/vyper/codegen/function_definitions/internal_function.py b/vyper/codegen/function_definitions/internal_function.py index 3bb540980c..e79cce251f 100644 --- a/vyper/codegen/function_definitions/internal_function.py +++ b/vyper/codegen/function_definitions/internal_function.py @@ -41,6 +41,9 @@ def generate_ir_for_internal_function( func_t = code._metadata["func_type"] + # sanity check + assert func_t.is_internal or func_t.is_constructor + context = initialize_context(func_t, module_ctx, is_ctor_context) for arg in func_t.arguments: