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

Function compile_exec_with_options

crates/codegen/src/compile.rs:10748–10766  ·  view source on GitHub ↗
(source: &str, opts: CompileOpts)

Source from the content-addressed store, hash-verified

10746 }
10747
10748 fn compile_exec_with_options(source: &str, opts: CompileOpts) -> CodeObject {
10749 let source_file = SourceFileBuilder::new("source_path", source).finish();
10750 let parsed = ruff_python_parser::parse(
10751 source_file.source_text(),
10752 ruff_python_parser::Mode::Module.into(),
10753 )
10754 .unwrap();
10755 let ast = parsed.into_syntax();
10756 let ast = match ast {
10757 ruff_python_ast::Mod::Module(stmts) => stmts,
10758 _ => unreachable!(),
10759 };
10760 let symbol_table = SymbolTable::scan_program(&ast, source_file.clone())
10761 .map_err(|e| e.into_codegen_error(source_file.name().to_owned()))
10762 .unwrap();
10763 let mut compiler = Compiler::new(opts, source_file, "<module>".to_owned());
10764 compiler.compile_program(&ast, symbol_table).unwrap();
10765 compiler.exit_scope()
10766 }
10767
10768 fn find_code<'a>(code: &'a CodeObject, name: &str) -> Option<&'a CodeObject> {
10769 if code.obj_name == name {

Callers 2

compile_execFunction · 0.85
compile_exec_optimizedFunction · 0.85

Calls 10

newFunction · 0.85
into_codegen_errorMethod · 0.80
compile_programMethod · 0.80
exit_scopeMethod · 0.80
parseFunction · 0.50
finishMethod · 0.45
unwrapMethod · 0.45
cloneMethod · 0.45
to_ownedMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected