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

Function compile_top

crates/codegen/src/compile.rs:248–262  ·  view source on GitHub ↗

Compile an Mod produced from ruff parser

(
    ast: ruff_python_ast::Mod,
    source_file: SourceFile,
    mode: Mode,
    opts: CompileOpts,
)

Source from the content-addressed store, hash-verified

246
247/// Compile an Mod produced from ruff parser
248pub fn compile_top(
249 ast: ruff_python_ast::Mod,
250 source_file: SourceFile,
251 mode: Mode,
252 opts: CompileOpts,
253) -> CompileResult<CodeObject> {
254 match ast {
255 ruff_python_ast::Mod::Module(module) => match mode {
256 Mode::Exec | Mode::Eval => compile_program(&module, source_file, opts),
257 Mode::Single => compile_program_single(&module, source_file, opts),
258 Mode::BlockExpr => compile_block_expression(&module, source_file, opts),
259 },
260 ruff_python_ast::Mod::Expression(expr) => compile_expression(&expr, source_file, opts),
261 }
262}
263
264/// Compile a standard Python program to bytecode
265pub fn compile_program(

Callers 2

_compileFunction · 0.85
compileFunction · 0.85

Calls 4

compile_programFunction · 0.85
compile_program_singleFunction · 0.85
compile_block_expressionFunction · 0.85
compile_expressionFunction · 0.85

Tested by

no test coverage detected