feat: add ability to reference validators in tests closes #632

This commit is contained in:
rvcas
2023-07-12 18:29:03 -04:00
parent 13ee62c05c
commit e7c1b28b52
5 changed files with 86 additions and 34 deletions

View File

@@ -88,6 +88,23 @@ impl<'a> CodeGenerator<'a> {
self.defined_functions = IndexMap::new();
}
pub fn insert_function(
&mut self,
module_name: String,
function_name: String,
variant_name: String,
value: &'a TypedFunction,
) -> Option<&'a TypedFunction> {
self.functions.insert(
FunctionAccessKey {
module_name,
function_name,
variant_name,
},
value,
)
}
pub fn generate(
&mut self,
TypedValidator {

View File

@@ -162,7 +162,7 @@ impl fmt::Display for Token {
Token::Fn => "fn",
Token::If => "if",
Token::Else => "else",
Token::Use => "import",
Token::Use => "use",
Token::Let => "let",
Token::Opaque => "opaque",
Token::Pub => "pub",