Skip to content

Commit

Permalink
perf: avoid return drop ProgramScope in recursion
Browse files Browse the repository at this point in the history
Signed-off-by: never <[email protected]>
  • Loading branch information
NeverRaR committed Nov 13, 2023
1 parent 52a244f commit 9380624
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions kclvm/sema/src/resolver/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl<'ctx> Resolver<'ctx> {
}

/// The check main function.
pub(crate) fn check(&mut self, pkgpath: &str) -> ProgramScope {
pub(crate) fn check(&mut self, pkgpath: &str) {
self.check_import(pkgpath);
self.init_global_types();
match self.program.pkgs.get(pkgpath) {
Expand All @@ -91,16 +91,16 @@ impl<'ctx> Resolver<'ctx> {
}
None => {}
}
ProgramScope {
}

pub(crate) fn check_and_lint(&mut self, pkgpath: &str) -> ProgramScope {
self.check(pkgpath);
let mut scope = ProgramScope {
scope_map: self.scope_map.clone(),
import_names: self.ctx.import_names.clone(),
node_ty_map: self.node_ty_map.clone(),
handler: self.handler.clone(),
}
}

pub(crate) fn check_and_lint(&mut self, pkgpath: &str) -> ProgramScope {
let mut scope = self.check(pkgpath);
};
self.lint_check_scope_map();
for diag in &self.linter.handler.diagnostics {
scope.handler.diagnostics.insert(diag.clone());
Expand Down

0 comments on commit 9380624

Please sign in to comment.