mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 16:21:11 +00:00
Add config variables for printing IR during mono stages
This commit is contained in:
parent
e655ab7d3b
commit
8d372edda1
3 changed files with 57 additions and 17 deletions
|
@ -20,7 +20,13 @@ use roc_types::subs::{Content, FlatType, StorageSubs, Subs, Variable, VariableSu
|
|||
use std::collections::HashMap;
|
||||
use ven_pretty::{BoxAllocator, DocAllocator, DocBuilder};
|
||||
|
||||
pub const PRETTY_PRINT_IR_SYMBOLS: bool = false;
|
||||
fn pretty_print_ir_symbols() -> bool {
|
||||
#[cfg(debug_assertions)]
|
||||
if std::env::var("PRETTY_PRINT_IR_SYMBOLS") == Ok("1".into()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// if your changes cause this number to go down, great!
|
||||
// please change it to the lower number.
|
||||
|
@ -268,7 +274,7 @@ impl<'a> Proc<'a> {
|
|||
.iter()
|
||||
.map(|(_, symbol)| symbol_to_doc(alloc, *symbol));
|
||||
|
||||
if PRETTY_PRINT_IR_SYMBOLS {
|
||||
if pretty_print_ir_symbols() {
|
||||
alloc
|
||||
.text("procedure : ")
|
||||
.append(symbol_to_doc(alloc, self.name))
|
||||
|
@ -1119,7 +1125,7 @@ impl<'a> BranchInfo<'a> {
|
|||
tag_id,
|
||||
scrutinee,
|
||||
layout: _,
|
||||
} if PRETTY_PRINT_IR_SYMBOLS => alloc
|
||||
} if pretty_print_ir_symbols() => alloc
|
||||
.hardline()
|
||||
.append(" BranchInfo: { scrutinee: ")
|
||||
.append(symbol_to_doc(alloc, *scrutinee))
|
||||
|
@ -1128,7 +1134,7 @@ impl<'a> BranchInfo<'a> {
|
|||
.append("} "),
|
||||
|
||||
_ => {
|
||||
if PRETTY_PRINT_IR_SYMBOLS {
|
||||
if pretty_print_ir_symbols() {
|
||||
alloc.text(" <no branch info>")
|
||||
} else {
|
||||
alloc.text("")
|
||||
|
@ -1463,7 +1469,7 @@ where
|
|||
{
|
||||
use roc_module::ident::ModuleName;
|
||||
|
||||
if PRETTY_PRINT_IR_SYMBOLS {
|
||||
if pretty_print_ir_symbols() {
|
||||
alloc.text(format!("{:?}", symbol))
|
||||
} else {
|
||||
let text = format!("{}", symbol);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue