impl Buildable for HIRBuilder, Transpiler

This commit is contained in:
Shunsuke Shibayama 2022-12-12 00:21:27 +09:00
parent 87d13b8f09
commit e07b0dfa67
3 changed files with 40 additions and 4 deletions

View file

@ -2,6 +2,7 @@ use std::fmt;
use erg_common::traits::Stream;
use crate::context::Context;
use crate::error::CompileErrors;
use crate::hir::HIR;
@ -77,6 +78,12 @@ impl ErrorArtifact {
}
}
pub trait Buildable {
fn build(&mut self, src: String, mode: &str) -> Result<CompleteArtifact, IncompleteArtifact>;
pub trait Buildable<T = HIR> {
fn build(
&mut self,
src: String,
mode: &str,
) -> Result<CompleteArtifact<T>, IncompleteArtifact<T>>;
fn pop_context(&mut self) -> Option<Context>;
fn get_context(&self) -> Option<&Context>;
}