Skip to content

Commit

Permalink
Make generate function assist generate a function as a constructor if…
Browse files Browse the repository at this point in the history
… the name of function is new
  • Loading branch information
Kohei316 committed Apr 25, 2024
1 parent 7dad0a2 commit 44800d1
Show file tree
Hide file tree
Showing 2 changed files with 264 additions and 26 deletions.
8 changes: 8 additions & 0 deletions crates/hir/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1489,6 +1489,14 @@ impl Adt {
.map(|arena| arena.1.clone())
}

pub fn as_struct(&self) -> Option<Struct> {
if let Self::Struct(v) = self {
Some(*v)
} else {
None
}
}

pub fn as_enum(&self) -> Option<Enum> {
if let Self::Enum(v) = self {
Some(*v)
Expand Down

0 comments on commit 44800d1

Please sign in to comment.