mirror of
https://github.com/RustPython/Parser.git
synced 2025-07-12 23:55:21 +00:00
Use ahash in the compiler
This commit is contained in:
parent
64fa9ccba9
commit
a0790d4906
5 changed files with 14 additions and 10 deletions
|
@ -16,6 +16,7 @@ num-complex = { version = "0.3", features = ["serde"] }
|
|||
num-traits = "0.2"
|
||||
log = "0.4"
|
||||
arrayvec = "0.5"
|
||||
ahash = "0.6"
|
||||
|
||||
[dev-dependencies]
|
||||
rustpython-parser = { path = "../parser" }
|
||||
|
|
|
@ -9,7 +9,7 @@ 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;
|
||||
use crate::IndexSet;
|
||||
use itertools::Itertools;
|
||||
use num_complex::Complex64;
|
||||
use num_traits::ToPrimitive;
|
||||
|
@ -140,10 +140,10 @@ impl Compiler {
|
|||
blocks: vec![ir::Block::default()],
|
||||
current_block: bytecode::Label(0),
|
||||
constants: Vec::new(),
|
||||
name_cache: IndexSet::new(),
|
||||
varname_cache: IndexSet::new(),
|
||||
cellvar_cache: IndexSet::new(),
|
||||
freevar_cache: IndexSet::new(),
|
||||
name_cache: IndexSet::default(),
|
||||
varname_cache: IndexSet::default(),
|
||||
cellvar_cache: IndexSet::default(),
|
||||
freevar_cache: IndexSet::default(),
|
||||
};
|
||||
Compiler {
|
||||
code_stack: vec![module_code],
|
||||
|
@ -217,8 +217,8 @@ impl Compiler {
|
|||
blocks: vec![ir::Block::default()],
|
||||
current_block: bytecode::Label(0),
|
||||
constants: Vec::new(),
|
||||
name_cache: IndexSet::new(),
|
||||
varname_cache: IndexSet::new(),
|
||||
name_cache: IndexSet::default(),
|
||||
varname_cache: IndexSet::default(),
|
||||
cellvar_cache,
|
||||
freevar_cache,
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use indexmap::IndexSet;
|
||||
use crate::IndexSet;
|
||||
use rustpython_bytecode::{CodeFlags, CodeObject, ConstantData, Instruction, Label, Location};
|
||||
|
||||
pub type BlockIdx = Label;
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
#[macro_use]
|
||||
extern crate log;
|
||||
|
||||
type IndexMap<K, V> = indexmap::IndexMap<K, V, ahash::RandomState>;
|
||||
type IndexSet<T> = indexmap::IndexSet<T, ahash::RandomState>;
|
||||
|
||||
pub mod compile;
|
||||
pub mod error;
|
||||
pub mod ir;
|
||||
|
|
|
@ -8,7 +8,7 @@ Inspirational file: https://github.com/python/cpython/blob/master/Python/symtabl
|
|||
*/
|
||||
|
||||
use crate::error::{CompileError, CompileErrorType};
|
||||
use indexmap::map::IndexMap;
|
||||
use crate::IndexMap;
|
||||
use rustpython_ast::{self as ast, Location};
|
||||
use std::fmt;
|
||||
|
||||
|
@ -58,7 +58,7 @@ impl SymbolTable {
|
|||
typ,
|
||||
line_number,
|
||||
is_nested,
|
||||
symbols: IndexMap::new(),
|
||||
symbols: IndexMap::default(),
|
||||
sub_tables: vec![],
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue