Compile an Mod produced from ruff parser
(
ast: ruff_python_ast::Mod,
source_file: SourceFile,
mode: Mode,
opts: CompileOpts,
)
| 246 | |
| 247 | /// Compile an Mod produced from ruff parser |
| 248 | pub 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 |
| 265 | pub fn compile_program( |
no test coverage detected