Skip to content

Commit

Permalink
feat(sol-hir): remove old code
Browse files Browse the repository at this point in the history
  • Loading branch information
aripiprazole committed May 20, 2024
1 parent e84345c commit a7cf176
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 222 deletions.
26 changes: 13 additions & 13 deletions sol-hir/src/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ mod impls {
impl HirFormatter for stmt::Block {
fn hir_fmt(&self, db: &dyn HirDb, f: &mut Formatter, scope: &Scope) -> std::fmt::Result {
code_block(db, scope, f, |db, f, scope| {
for statement in self.statements(db) {
for statement in self.statements.iter() {
statement.hir_fmt(db, f, scope)?;
}
Ok(())
Expand Down Expand Up @@ -420,14 +420,14 @@ mod impls {

impl HirFormatter for pattern::ConstructorPattern {
fn hir_fmt(&self, db: &dyn HirDb, f: &mut Formatter, scope: &Scope) -> std::fmt::Result {
let arguments = self.arguments(db);
let arguments = self.arguments.clone();
if arguments.is_empty() {
self.name(db).hir_fmt(db, f, scope)?;
self.name.clone().hir_fmt(db, f, scope)?;
write!(f, " ")?;
scope.punctuated(db, f, arguments, ", ")
} else {
write!(f, "(")?;
self.name(db).hir_fmt(db, f, scope)?;
self.name.hir_fmt(db, f, scope)?;
write!(f, " ")?;
scope.punctuated(db, f, arguments, ", ")?;
write!(f, ")")
Expand Down Expand Up @@ -515,13 +515,13 @@ mod impls {
impl HirFormatter for expr::CallExpr {
fn hir_fmt(&self, db: &dyn HirDb, f: &mut Formatter, scope: &Scope) -> std::fmt::Result {
write!(f, "(")?;
self.callee(db).hir_fmt(db, f, scope)?;
let arguments = self.arguments(db);
self.callee.hir_fmt(db, f, scope)?;
let arguments = self.arguments.clone();
if !arguments.is_empty() {
write!(f, " ")?;
scope.punctuated(db, f, arguments, " ")?;
}
if let Some(block) = self.do_notation(db) {
if let Some(block) = self.do_notation.clone() {
write!(f, " ")?;
block.hir_fmt(db, f, scope)?;
}
Expand All @@ -535,18 +535,18 @@ mod impls {
fn hir_fmt(&self, db: &dyn HirDb, f: &mut Formatter, scope: &Scope) -> std::fmt::Result {
write!(f, "λ")?;
write!(f, " ")?;
scope.punctuated(db, f, self.parameters(db), ", ")?;
scope.punctuated(db, f, self.parameters.clone(), ", ")?;
write!(f, ".")?;
write!(f, " ")?;
self.value(db).hir_fmt(db, f, scope)
self.value.hir_fmt(db, f, scope)
}
}

impl HirFormatter for expr::AnnExpr {
fn hir_fmt(&self, db: &dyn HirDb, f: &mut Formatter, scope: &Scope) -> std::fmt::Result {
self.value(db).hir_fmt(db, f, scope)?;
self.value.hir_fmt(db, f, scope)?;
write!(f, " : ")?;
self.type_rep(db).hir_fmt(db, f, scope)
self.type_rep.hir_fmt(db, f, scope)
}
}

Expand All @@ -562,11 +562,11 @@ mod impls {
fn hir_fmt(&self, db: &dyn HirDb, f: &mut Formatter, scope: &Scope) -> std::fmt::Result {
write!(f, "match")?;
write!(f, " ")?;
self.scrutinee(db).hir_fmt(db, f, scope)?;
self.scrutinee.hir_fmt(db, f, scope)?;
write!(f, " ")?;
write!(f, "{{")?;
code_block(db, scope, f, |db, f, scope| {
scope.unlined(db, f, self.clauses(db), ", ")
scope.unlined(db, f, self.clauses.clone(), ", ")
})?;
write!(f, "}}")
}
Expand Down
8 changes: 4 additions & 4 deletions sol-hir/src/reference.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,17 +142,17 @@ impl<'db, U: Checkable> HirListener for ReferenceWalker<'db, U> {
}

fn enter_block(&mut self, block: stmt::Block) {
self.enter_scope(self.db, block.location(self.db), block.scope(self.db));
self.stack.push(block.scope(self.db));
self.enter_scope(self.db, block.location(self.db), block.scope.clone());
self.stack.push(block.scope.clone());
}

fn exit_block(&mut self, _: stmt::Block) {
self.stack.pop();
}

fn enter_abs_expr(&mut self, abs_expr: expr::AbsExpr) {
self.enter_scope(self.db, abs_expr.location(self.db), abs_expr.scope(self.db));
self.stack.push(abs_expr.scope(self.db));
self.enter_scope(self.db, abs_expr.location(self.db), abs_expr.scope.clone());
self.stack.push(abs_expr.scope.clone());
}

fn exit_abs_expr(&mut self, _: expr::AbsExpr) {
Expand Down
Loading

0 comments on commit a7cf176

Please sign in to comment.