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

Function compile_expression

crates/codegen/src/compile.rs:308–319  ·  view source on GitHub ↗
(
    ast: &ast::ModExpression,
    source_file: SourceFile,
    opts: CompileOpts,
)

Source from the content-addressed store, hash-verified

306}
307
308pub fn compile_expression(
309 ast: &ast::ModExpression,
310 source_file: SourceFile,
311 opts: CompileOpts,
312) -> CompileResult<CodeObject> {
313 let symbol_table = SymbolTable::scan_expr(ast, source_file.clone())
314 .map_err(|e| e.into_codegen_error(source_file.name().to_owned()))?;
315 let mut compiler = Compiler::new(opts, source_file, "<module>".to_owned());
316 compiler.compile_eval(ast, symbol_table)?;
317 let code = compiler.exit_scope();
318 Ok(code)
319}
320
321macro_rules! emit {
322 // Struct variant with single identifier (e.g., Foo::A { arg })

Callers 1

compile_topFunction · 0.85

Calls 7

newFunction · 0.85
into_codegen_errorMethod · 0.80
compile_evalMethod · 0.80
exit_scopeMethod · 0.80
cloneMethod · 0.45
to_ownedMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected