Skip to content

Commit

Permalink
Rename Id<T> to AstId.
Browse files Browse the repository at this point in the history
  • Loading branch information
maloneymr committed Jul 24, 2024
1 parent 0d8357f commit e40e994
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::phase::sourceq::SpanIdx;
use crate::phase::id::PackageId;

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct Ast<T>(Arc<T>, SpanIdx, Id<T>);
pub struct Ast<T>(Arc<T>, SpanIdx, AstId);

impl<T> std::ops::Deref for Ast<T> {
type Target = T;
Expand Down Expand Up @@ -41,8 +41,8 @@ impl AstGen {
}
}

fn id<T>(&mut self) -> Id<T> {
let ast_id = Id(self.next_id, PhantomData::default());
fn id(&mut self) -> AstId {
let ast_id = AstId(self.next_id);
self.next_id += 1;
ast_id
}
Expand All @@ -54,10 +54,8 @@ impl AstGen {
}
}

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct Id<T>(usize, PhantomData<T>);

impl<T: Clone> Copy for Id<T> {}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Copy)]
pub struct AstId(usize);

#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Package {
Expand Down Expand Up @@ -223,7 +221,7 @@ pub struct WordLit {
pub struct DocComment(pub String);

impl<T: Clone> Ast<T> {
pub fn id(&self) -> Id<T> {
pub fn id(&self) -> AstId {
self.2.clone()
}
}

0 comments on commit e40e994

Please sign in to comment.