Replace 'bool' with 'TraceLevel' in codegen

Co-authored-by: KtorZ <matthias.benkort@gmail.com>
This commit is contained in:
microproofs
2024-01-17 11:53:29 -05:00
committed by KtorZ
parent d27ea98a8f
commit f79b37d551
5 changed files with 115 additions and 118 deletions

View File

@@ -217,7 +217,11 @@ impl Validator {
mod tests {
use std::collections::HashMap;
use aiken_lang::{self, builtins};
use aiken_lang::{
self,
ast::{TraceLevel, Tracing},
builtins,
};
use uplc::ast as uplc_ast;
use crate::tests::TestProject;
@@ -240,7 +244,7 @@ mod tests {
&project.functions,
&project.data_types,
&project.module_types,
true,
Tracing::All(TraceLevel::Verbose),
);
let (validator, def) = modules

View File

@@ -22,10 +22,7 @@ use crate::blueprint::{
Blueprint,
};
use aiken_lang::{
ast::{
Definition, Function, ModuleKind, TraceLevel, Tracing, TypedDataType, TypedFunction,
Validator,
},
ast::{Definition, Function, ModuleKind, Tracing, TypedDataType, TypedFunction, Validator},
builtins,
gen_uplc::builder::{DataTypeKey, FunctionAccessKey},
tipo::TypeInfo,
@@ -285,10 +282,7 @@ where
&self.functions,
&self.data_types,
&self.module_types,
match options.tracing.trace_level(true) {
TraceLevel::Silent => false,
TraceLevel::Verbose => true,
},
options.tracing,
);
let blueprint = Blueprint::new(&self.config, &self.checked_modules, &mut generator)
@@ -317,15 +311,8 @@ where
verbose,
exact_match,
} => {
let tests = self.collect_tests(
verbose,
match_tests,
exact_match,
match options.tracing.trace_level(true) {
TraceLevel::Silent => false,
TraceLevel::Verbose => true,
},
)?;
let tests =
self.collect_tests(verbose, match_tests, exact_match, options.tracing)?;
if !tests.is_empty() {
self.event_listener.handle_event(Event::RunningTests);
@@ -688,7 +675,7 @@ where
verbose: bool,
match_tests: Option<Vec<String>>,
exact_match: bool,
code_gen_tracing: bool,
tracing: Tracing,
) -> Result<Vec<Script>, Error> {
let mut scripts = Vec::new();
let mut testable_validators = Vec::new();
@@ -791,7 +778,7 @@ where
&self.functions,
&self.data_types,
&self.module_types,
code_gen_tracing,
tracing,
);
for (module_name, testable_validator) in &testable_validators {

View File

@@ -1,7 +1,7 @@
use crate::error::Error;
use aiken_lang::{
ast::{
DataType, Definition, Function, Located, ModuleKind, TypedDataType, TypedFunction,
DataType, Definition, Function, Located, ModuleKind, Tracing, TypedDataType, TypedFunction,
TypedModule, TypedValidator, UntypedModule, Validator,
},
gen_uplc::{
@@ -358,7 +358,7 @@ impl CheckedModules {
builtin_functions: &'a IndexMap<FunctionAccessKey, TypedFunction>,
builtin_data_types: &'a IndexMap<DataTypeKey, TypedDataType>,
module_types: &'a HashMap<String, TypeInfo>,
tracing: bool,
tracing: Tracing,
) -> CodeGenerator<'a> {
let mut functions = IndexMap::new();
for (k, v) in builtin_functions {
@@ -412,7 +412,7 @@ impl CheckedModules {
data_types,
module_types_index,
module_src,
tracing,
tracing.trace_level(true),
)
}
}