(source: &str, opts: CompileOpts)
| 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 { |
no test coverage detected