MCPcopy Index your code
hub / github.com/RustPython/RustPython / compile_string

Method compile_string

crates/derive-impl/src/compile_bytecode.rs:60–74  ·  view source on GitHub ↗
(
        &self,
        source: &str,
        mode: Mode,
        module_name: String,
        compiler: &dyn Compiler,
        origin: F,
    )

Source from the content-addressed store, hash-verified

58
59impl CompilationSource {
60 fn compile_string<D: core::fmt::Display, F: FnOnce() -> D>(
61 &self,
62 source: &str,
63 mode: Mode,
64 module_name: String,
65 compiler: &dyn Compiler,
66 origin: F,
67 ) -> Result<CodeObject, Diagnostic> {
68 compiler.compile(source, mode, module_name).map_err(|err| {
69 Diagnostic::spans_error(
70 self.span,
71 format!("Python compile error from {}: {}", origin(), err),
72 )
73 })
74 }
75
76 fn compile(
77 &self,

Callers 2

compile_singleMethod · 0.80
compile_dirMethod · 0.80

Calls 1

compileMethod · 0.45

Tested by

no test coverage detected