mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-30 12:51:10 +00:00
Fix lower bugs
This commit is contained in:
parent
201b313cd2
commit
c1d92bc0f4
5 changed files with 48 additions and 41 deletions
|
@ -8,6 +8,7 @@ use crate::error::{CompileError, CompileErrors, TyCheckErrors};
|
|||
// use crate::hir::HIR;
|
||||
use crate::check::Checker;
|
||||
use crate::mod_cache::SharedModuleCache;
|
||||
use crate::reorder::Reorderer;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct HIRBuilder {
|
||||
|
@ -33,6 +34,9 @@ impl HIRBuilder {
|
|||
pub fn build_and_cache(&mut self, var_name: VarName) -> Result<(), CompileErrors> {
|
||||
let mut ast_builder = ASTBuilder::new(self.checker.cfg.copy());
|
||||
let ast = ast_builder.build()?;
|
||||
let ast = Reorderer::new()
|
||||
.reorder(ast)
|
||||
.map_err(|errs| self.convert(errs))?;
|
||||
let (hir, ctx) = self
|
||||
.checker
|
||||
.check(ast, "exec")
|
||||
|
@ -46,6 +50,9 @@ impl HIRBuilder {
|
|||
cfg.input = Input::Str(src);
|
||||
let mut ast_builder = ASTBuilder::new(cfg);
|
||||
let ast = ast_builder.build()?;
|
||||
let ast = Reorderer::new()
|
||||
.reorder(ast)
|
||||
.map_err(|errs| self.convert(errs))?;
|
||||
let (hir, ctx) = self
|
||||
.checker
|
||||
.check(ast, mode)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue