mirror of
https://github.com/roc-lang/roc.git
synced 2024-11-13 09:49:11 +03:00
rename
This commit is contained in:
parent
25561ff757
commit
d3ef35d935
@ -245,7 +245,7 @@ impl Scope {
|
||||
// use that existing IdentId. Otherwise, create a fresh one.
|
||||
let ident_id = match exposed_ident_ids.get_id(&ident) {
|
||||
Some(ident_id) => ident_id,
|
||||
None => all_ident_ids.add(&ident),
|
||||
None => all_ident_ids.add_ident(&ident),
|
||||
};
|
||||
|
||||
let symbol = Symbol::new(self.home, ident_id);
|
||||
@ -262,7 +262,7 @@ impl Scope {
|
||||
///
|
||||
/// Used for record guards like { x: Just _ }
|
||||
pub fn ignore(&mut self, ident: Ident, all_ident_ids: &mut IdentIds) -> Symbol {
|
||||
let ident_id = all_ident_ids.add(&ident);
|
||||
let ident_id = all_ident_ids.add_ident(&ident);
|
||||
Symbol::new(self.home, ident_id)
|
||||
}
|
||||
|
||||
|
@ -225,7 +225,7 @@ impl Scope {
|
||||
region,
|
||||
};
|
||||
|
||||
let ident_id = all_ident_ids.add(&ident);
|
||||
let ident_id = all_ident_ids.add_ident(&ident);
|
||||
let symbol = Symbol::new(self.home, ident_id);
|
||||
|
||||
self.symbols.insert(symbol, region);
|
||||
@ -273,7 +273,7 @@ impl Scope {
|
||||
) -> Result<(Symbol, Option<Symbol>), (Region, Loc<Ident>, Symbol)> {
|
||||
match self.idents.get(&ident) {
|
||||
Some(&(original_symbol, original_region)) => {
|
||||
let shadow_ident_id = all_ident_ids.add(&ident);
|
||||
let shadow_ident_id = all_ident_ids.add_ident(&ident);
|
||||
let shadow_symbol = Symbol::new(self.home, shadow_ident_id);
|
||||
|
||||
self.symbols.insert(shadow_symbol, region);
|
||||
@ -315,7 +315,7 @@ impl Scope {
|
||||
// use that existing IdentId. Otherwise, create a fresh one.
|
||||
let ident_id = match exposed_ident_ids.get_id(&ident) {
|
||||
Some(ident_id) => ident_id,
|
||||
None => all_ident_ids.add(&ident),
|
||||
None => all_ident_ids.add_ident(&ident),
|
||||
};
|
||||
|
||||
let symbol = Symbol::new(self.home, ident_id);
|
||||
@ -330,7 +330,7 @@ impl Scope {
|
||||
///
|
||||
/// Used for record guards like { x: Just _ }
|
||||
pub fn ignore(&mut self, ident: &Ident, all_ident_ids: &mut IdentIds) -> Symbol {
|
||||
let ident_id = all_ident_ids.add(ident);
|
||||
let ident_id = all_ident_ids.add_ident(ident);
|
||||
Symbol::new(self.home, ident_id)
|
||||
}
|
||||
|
||||
|
@ -183,7 +183,7 @@ impl<'a> WasmBackend<'a> {
|
||||
.get_mut(&self.env.module_id)
|
||||
.unwrap();
|
||||
|
||||
let ident_id = ident_ids.add(&Ident::from(debug_name));
|
||||
let ident_id = ident_ids.add_ident(&Ident::from(debug_name));
|
||||
Symbol::new(self.env.module_id, ident_id)
|
||||
}
|
||||
|
||||
|
@ -564,11 +564,11 @@ impl IdentIds {
|
||||
.map(|(index, ident)| (IdentId(index as u32), ident))
|
||||
}
|
||||
|
||||
pub fn add(&mut self, ident_name: &Ident) -> IdentId {
|
||||
pub fn add_ident(&mut self, ident_name: &Ident) -> IdentId {
|
||||
self.add_str(ident_name.as_inline_str().as_str())
|
||||
}
|
||||
|
||||
fn add_str(&mut self, string: &str) -> IdentId {
|
||||
pub fn add_str(&mut self, string: &str) -> IdentId {
|
||||
let offset = self.buffer.len() as u32;
|
||||
let length = string.len() as u16;
|
||||
|
||||
@ -585,7 +585,7 @@ impl IdentIds {
|
||||
pub fn get_or_insert(&mut self, name: &Ident) -> IdentId {
|
||||
match self.get_id(name) {
|
||||
Some(id) => id,
|
||||
None => self.add(name),
|
||||
None => self.add_ident(name),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -396,7 +396,7 @@ impl<'a> CodeGenHelp<'a> {
|
||||
}
|
||||
|
||||
fn create_symbol(&self, ident_ids: &mut IdentIds, debug_name: &str) -> Symbol {
|
||||
let ident_id = ident_ids.add(&Ident::from(debug_name));
|
||||
let ident_id = ident_ids.add_ident(&Ident::from(debug_name));
|
||||
Symbol::new(self.home, ident_id)
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ pub fn start_new_let_value(ed_model: &mut EdModel, new_char: &char) -> EdResult<
|
||||
let val_expr_id = ed_model.module.env.pool.add(val_expr2_node);
|
||||
|
||||
let ident = Ident::from(val_name_string);
|
||||
let ident_id = ed_model.module.env.ident_ids.add(&ident);
|
||||
let ident_id = ed_model.module.env.ident_ids.add_ident(&ident);
|
||||
let var_symbol = Symbol::new(ed_model.module.env.home, ident_id);
|
||||
let body = Expr2::Var(var_symbol);
|
||||
let body_id = ed_model.module.env.pool.add(body);
|
||||
|
@ -28,7 +28,7 @@ pub fn start_new_tld_value(ed_model: &mut EdModel, new_char: &char) -> EdResult<
|
||||
let val_expr_id = ed_model.module.env.pool.add(val_expr_node);
|
||||
|
||||
let ident = Ident::from(new_char.to_string().as_str());
|
||||
let ident_id = ed_model.module.env.ident_ids.add(&ident);
|
||||
let ident_id = ed_model.module.env.ident_ids.add_ident(&ident);
|
||||
|
||||
let module_ident_ids_opt = ed_model
|
||||
.loaded_module
|
||||
@ -38,7 +38,7 @@ pub fn start_new_tld_value(ed_model: &mut EdModel, new_char: &char) -> EdResult<
|
||||
|
||||
if let Some(module_ident_ids_ref) = module_ident_ids_opt {
|
||||
// this might create different IdentId for interns and env.ident_ids which may be a problem
|
||||
module_ident_ids_ref.add(&ident);
|
||||
module_ident_ids_ref.add_ident(&ident);
|
||||
} else {
|
||||
KeyNotFound {
|
||||
key_str: format!("{:?}", ed_model.module.env.home),
|
||||
|
Loading…
Reference in New Issue
Block a user