diff --git a/src/compile.rs b/src/compile.rs index dc4cec7..739be8e 100644 --- a/src/compile.rs +++ b/src/compile.rs @@ -6,6 +6,7 @@ //! https://github.com/micropython/micropython/blob/master/py/compile.c use crate::error::{CompileError, CompileErrorType}; +use crate::ir::{self, CodeInfo}; pub use crate::mode::Mode; use crate::symboltable::{make_symbol_table, statements_to_symbol_table, SymbolScope, SymbolTable}; use indexmap::IndexSet; @@ -13,78 +14,10 @@ use itertools::Itertools; use num_complex::Complex64; use num_traits::ToPrimitive; use rustpython_ast as ast; -use rustpython_bytecode::{self as bytecode, CodeObject, ConstantData, Instruction, Label}; +use rustpython_bytecode::{self as bytecode, CodeObject, ConstantData, Instruction}; type CompileResult = Result; -struct CodeInfo { - code: CodeObject, - instructions: Vec, - locations: Vec, - constants: Vec, - name_cache: IndexSet, - varname_cache: IndexSet, - cellvar_cache: IndexSet, - freevar_cache: IndexSet, - label_map: Vec