Skip to content

Commit f7e37ed

Browse files
committed
feat: add anonymous symbol.
1 parent 72143b7 commit f7e37ed

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

tigerc/src/ident_pool.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ symbols! {
2626
TOK_LET: "let",
2727
TOK_IN: "in",
2828
TOK_END: "end",
29+
// use for inner symbol
30+
REVERSED_ANONYMOUS: "__anonymous",
2931
}
3032
}
3133

tigerc/src/ir.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::hash::Hash;
22

3-
use crate::ident_pool::Symbol;
3+
use crate::ident_pool::{kw, Symbol};
44
use crate::temp::{Label, Temp};
55

66
// Identify different symbol with same name
@@ -24,6 +24,10 @@ impl LowerIdent {
2424
},
2525
}
2626
}
27+
28+
pub fn new_anonymous() -> LowerIdent {
29+
LowerIdent::new(kw::REVERSED_ANONYMOUS)
30+
}
2731
}
2832

2933
impl PartialEq for LowerIdent {

0 commit comments

Comments
 (0)