File tree Expand file tree Collapse file tree 4 files changed +21
-1
lines changed Expand file tree Collapse file tree 4 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -103,4 +103,9 @@ pub trait Buildable<T = HIR> {
103103 fn get_context ( & self ) -> Option < & ModuleContext > ;
104104}
105105
106- pub trait BuildRunnable < T = HIR > : Buildable < T > + Runnable + ' static { }
106+ pub trait BuildRunnable < T = HIR > : Buildable < T > + Runnable + ' static {
107+ fn build_module ( & mut self ) -> Result < CompleteArtifact < T > , IncompleteArtifact < T > > {
108+ let src = self . cfg_mut ( ) . input . read ( ) ;
109+ self . build ( src, "exec" )
110+ }
111+ }
Original file line number Diff line number Diff line change @@ -179,6 +179,11 @@ impl HIRBuilder {
179179 self . check ( artifact. ast , mode)
180180 }
181181
182+ pub fn build_module ( & mut self ) -> Result < CompleteArtifact , IncompleteArtifact > {
183+ let src = self . cfg_mut ( ) . input . read ( ) ;
184+ self . build ( src, "exec" )
185+ }
186+
182187 pub fn pop_mod_ctx ( & mut self ) -> Option < ModuleContext > {
183188 self . lowerer . pop_mod_ctx ( )
184189 }
Original file line number Diff line number Diff line change @@ -239,6 +239,11 @@ impl Compiler {
239239 Ok ( CompleteArtifact :: new ( codeobj, arti. warns ) )
240240 }
241241
242+ pub fn compile_module ( & mut self ) -> Result < CompleteArtifact < CodeObj > , ErrorArtifact > {
243+ let src = self . cfg . input . read ( ) ;
244+ self . compile ( src, "exec" )
245+ }
246+
242247 pub fn eval_compile (
243248 & mut self ,
244249 src : String ,
Original file line number Diff line number Diff line change @@ -223,6 +223,11 @@ impl Transpiler {
223223 Ok ( CompleteArtifact :: new ( script, artifact. warns ) )
224224 }
225225
226+ pub fn transpile_module ( & mut self ) -> Result < CompleteArtifact < PyScript > , ErrorArtifact > {
227+ let src = self . cfg . input . read ( ) ;
228+ self . transpile ( src, "exec" )
229+ }
230+
226231 fn build_link_desugar (
227232 & mut self ,
228233 src : String ,
You can’t perform that action at this time.
0 commit comments