mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-11-27 02:24:15 +03:00
Remove symbol table from OutputItem; clippy
This commit is contained in:
parent
027bd24cd5
commit
80ff280df7
@ -102,7 +102,6 @@ struct OutputItem {
|
||||
struct CompileOutput {
|
||||
pub output: Vec<OutputItem>,
|
||||
pub initial_ast: String,
|
||||
pub symbol_table: String,
|
||||
}
|
||||
|
||||
/// Get the path of the `input_file` given in `input` into `list`.
|
||||
@ -132,9 +131,9 @@ fn collect_all_inputs(test: &Test) -> Result<Vec<PathBuf>, String> {
|
||||
Ok(list)
|
||||
}
|
||||
|
||||
fn compile_and_process<'a>(parsed: &'a mut Compiler<'a>) -> Result<SymbolTable<'_>, LeoError> {
|
||||
let mut st = parsed.symbol_table_pass()?;
|
||||
parsed.type_checker_pass(&mut st)?;
|
||||
fn compile_and_process<'a>(parsed: &'a mut Compiler<'a>) -> Result<SymbolTable, LeoError> {
|
||||
let st = parsed.symbol_table_pass()?;
|
||||
let st = parsed.type_checker_pass(st)?;
|
||||
Ok(st)
|
||||
}
|
||||
|
||||
@ -198,6 +197,7 @@ fn run_test(test: Test, handler: &Handler, err_buf: &BufferEmitter) -> Result<Va
|
||||
let mut output_items = Vec::with_capacity(inputs.len());
|
||||
|
||||
if inputs.is_empty() {
|
||||
handler.extend_if_error(compile_and_process(&mut parsed))?;
|
||||
output_items.push(OutputItem {
|
||||
initial_input_ast: "no input".to_string(),
|
||||
});
|
||||
@ -205,14 +205,13 @@ fn run_test(test: Test, handler: &Handler, err_buf: &BufferEmitter) -> Result<Va
|
||||
for input in inputs {
|
||||
let mut parsed = parsed.clone();
|
||||
handler.extend_if_error(parsed.parse_input(input))?;
|
||||
handler.extend_if_error(compile_and_process(&mut parsed))?;
|
||||
let initial_input_ast = hash_file("/tmp/output/initial_input_ast.json");
|
||||
|
||||
output_items.push(OutputItem { initial_input_ast });
|
||||
}
|
||||
}
|
||||
|
||||
let symbol_table = handler.extend_if_error(compile_and_process(&mut parsed))?;
|
||||
|
||||
let initial_ast = hash_file("/tmp/output/initial_ast.json");
|
||||
|
||||
if fs::read_dir("/tmp/output").is_ok() {
|
||||
@ -222,7 +221,6 @@ fn run_test(test: Test, handler: &Handler, err_buf: &BufferEmitter) -> Result<Va
|
||||
let final_output = CompileOutput {
|
||||
output: output_items,
|
||||
initial_ast,
|
||||
symbol_table: hash_content(&symbol_table.to_string()),
|
||||
};
|
||||
Ok(serde_yaml::to_value(&final_output).expect("serialization failed"))
|
||||
}
|
||||
|
@ -163,9 +163,9 @@ impl Sample {
|
||||
compiler
|
||||
.parse_program_from_string(input, name)
|
||||
.expect("Failed to parse program");
|
||||
let mut symbol_table = compiler.symbol_table_pass().expect("failed to generate symbol table");
|
||||
let symbol_table = compiler.symbol_table_pass().expect("failed to generate symbol table");
|
||||
let start = Instant::now();
|
||||
let out = compiler.type_checker_pass(&mut symbol_table);
|
||||
let out = compiler.type_checker_pass(symbol_table);
|
||||
time += start.elapsed();
|
||||
out.expect("failed to run type check pass")
|
||||
});
|
||||
@ -190,9 +190,9 @@ impl Sample {
|
||||
compiler
|
||||
.parse_program_from_string(input, name)
|
||||
.expect("Failed to parse program");
|
||||
let mut symbol_table = compiler.symbol_table_pass().expect("failed to generate symbol table");
|
||||
let symbol_table = compiler.symbol_table_pass().expect("failed to generate symbol table");
|
||||
compiler
|
||||
.type_checker_pass(&mut symbol_table)
|
||||
.type_checker_pass(symbol_table)
|
||||
.expect("failed to run type check pass");
|
||||
time += start.elapsed();
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user