MCPcopy Create free account
hub / github.com/PRQL/prql / insert

Method insert

prqlc/prqlc/src/semantic/module.rs:68–83  ·  view source on GitHub ↗
(&mut self, fq_ident: Ident, decl: Decl)

Source from the content-addressed store, hash-verified

66 }
67
68 pub fn insert(&mut self, fq_ident: Ident, decl: Decl) -> Result<Option<Decl>, Error> {
69 if fq_ident.path.is_empty() {
70 Ok(self.names.insert(fq_ident.name, decl))
71 } else {
72 let (top_level, remaining) = fq_ident.pop_front();
73 let entry = self.names.entry(top_level).or_default();
74
75 if let DeclKind::Module(inner) = &mut entry.kind {
76 inner.insert(remaining.unwrap(), decl)
77 } else {
78 Err(Error::new_simple(
79 "path does not resolve to a module or a table",
80 ))
81 }
82 }
83 }
84
85 pub fn get_mut(&mut self, ident: &Ident) -> Option<&mut Decl> {
86 let mut ns = self;

Callers 15

translate_select_itemFunction · 0.45
excludeFunction · 0.45
deduplicate_select_itemsFunction · 0.45
split_off_backFunction · 0.45
anchor_splitFunction · 0.45
is_split_requiredFunction · 0.45
alias_last_sortingMethod · 0.45
fold_sql_queryMethod · 0.45
assign_namesFunction · 0.45
fold_relMethod · 0.45
register_computeMethod · 0.45

Calls 2

is_emptyMethod · 0.80
pop_frontMethod · 0.80