Skip to content

Commit

Permalink
introduce TypeId alias
Browse files Browse the repository at this point in the history
  • Loading branch information
KeenS committed Aug 14, 2022
1 parent d05b296 commit df13e0b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/ast/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,11 @@ pub struct SymbolTable {
pub constructors: HashMap<Symbol, Symbol>,
}

type TypeId = u64;

#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Type {
Variable(u64),
Variable(TypeId),
Char,
Int,
Real,
Expand Down
4 changes: 2 additions & 2 deletions src/ast/typing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ struct TypePool {

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
enum Typing {
Variable(u64),
Variable(TypeId),
Char,
Int,
Real,
Expand Down Expand Up @@ -282,7 +282,7 @@ impl TyEnv {
self.env.insert(k, v)
}

fn polymorphic_variables(&self, ty: NodeId) -> Vec<u64> {
fn polymorphic_variables(&self, ty: NodeId) -> Vec<TypeId> {
use Typing::*;
match self.pool.pool.value_of(ty) {
Variable(id) => vec![*id],
Expand Down

0 comments on commit df13e0b

Please sign in to comment.