Improve IR debug printing for dev backends

This commit is contained in:
Brian Carroll 2021-11-21 20:39:49 +00:00
parent 2db18890d2
commit ee1c4478da
2 changed files with 32 additions and 12 deletions

View file

@ -5,6 +5,9 @@ use roc_can::builtins::builtin_defs_map;
use roc_collections::all::MutMap; use roc_collections::all::MutMap;
use tempfile::tempdir; use tempfile::tempdir;
#[allow(unused_imports)]
use roc_mono::ir::PRETTY_PRINT_IR_SYMBOLS;
#[allow(dead_code)] #[allow(dead_code)]
fn promote_expr_to_module(src: &str) -> String { fn promote_expr_to_module(src: &str) -> String {
let mut buffer = String::from("app \"test\" provides [ main ] to \"./platform\"\n\nmain =\n"); let mut buffer = String::from("app \"test\" provides [ main ] to \"./platform\"\n\nmain =\n");
@ -77,7 +80,14 @@ pub fn helper(
// while you're working on the dev backend! // while you're working on the dev backend!
{ {
// println!("=========== Procedures =========="); // println!("=========== Procedures ==========");
// println!("{:?}", procedures); // if PRETTY_PRINT_IR_SYMBOLS {
// println!("");
// for proc in procedures.values() {
// println!("{}", proc.to_pretty(200));
// }
// } else {
// println!("{:?}", procedures.values());
// }
// println!("=================================\n"); // println!("=================================\n");
// println!("=========== Interns =========="); // println!("=========== Interns ==========");

View file

@ -17,6 +17,9 @@ use roc_gen_wasm::wasm_module::{
}; };
use roc_gen_wasm::MEMORY_NAME; use roc_gen_wasm::MEMORY_NAME;
#[allow(unused_imports)]
use roc_mono::ir::PRETTY_PRINT_IR_SYMBOLS;
const TEST_WRAPPER_NAME: &str = "test_wrapper"; const TEST_WRAPPER_NAME: &str = "test_wrapper";
std::thread_local! { std::thread_local! {
@ -83,19 +86,26 @@ pub fn helper_wasm<'a, T: Wasm32TestResult>(
// You can comment and uncomment this block out to get more useful information // You can comment and uncomment this block out to get more useful information
// while you're working on the wasm backend! // while you're working on the wasm backend!
// { {
// println!("=========== Procedures =========="); // println!("=========== Procedures ==========");
// println!("{:?}", procedures); // if PRETTY_PRINT_IR_SYMBOLS {
// println!("=================================\n"); // println!("");
// for proc in procedures.values() {
// println!("{}", proc.to_pretty(200));
// }
// } else {
// println!("{:?}", procedures.values());
// }
// println!("=================================\n");
// println!("=========== Interns =========="); // println!("=========== Interns ==========");
// println!("{:?}", interns); // println!("{:?}", interns);
// println!("=================================\n"); // println!("=================================\n");
// println!("=========== Exposed =========="); // println!("=========== Exposed ==========");
// println!("{:?}", exposed_to_host); // println!("{:?}", exposed_to_host);
// println!("=================================\n"); // println!("=================================\n");
// } }
debug_assert_eq!(exposed_to_host.len(), 1); debug_assert_eq!(exposed_to_host.len(), 1);