Skip to content

Commit

Permalink
feat: add anonymous symbol.
Browse files Browse the repository at this point in the history
  • Loading branch information
Shylock-Hg committed Jan 30, 2025
1 parent 72143b7 commit f7e37ed
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions tigerc/src/ident_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ symbols! {
TOK_LET: "let",
TOK_IN: "in",
TOK_END: "end",
// use for inner symbol
REVERSED_ANONYMOUS: "__anonymous",
}
}

Expand Down
6 changes: 5 additions & 1 deletion tigerc/src/ir.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::hash::Hash;

use crate::ident_pool::Symbol;
use crate::ident_pool::{kw, Symbol};
use crate::temp::{Label, Temp};

// Identify different symbol with same name
Expand All @@ -24,6 +24,10 @@ impl LowerIdent {
},
}
}

pub fn new_anonymous() -> LowerIdent {
LowerIdent::new(kw::REVERSED_ANONYMOUS)
}
}

impl PartialEq for LowerIdent {
Expand Down

0 comments on commit f7e37ed

Please sign in to comment.