MCPcopy Create free account
hub / github.com/astral-sh/ruff / intern

Method intern

crates/ruff_python_parser/src/parser/mod.rs:49–57  ·  view source on GitHub ↗

Returns an inline name directly, or a shared clone of a heap-allocated name.

(&mut self, text: &str)

Source from the content-addressed store, hash-verified

47impl NameInterner {
48 /// Returns an inline name directly, or a shared clone of a heap-allocated name.
49 fn intern(&mut self, text: &str) -> Name {
50 if let Some(name) = Name::new_inline(text) {
51 return name;
52 }
53
54 self.names
55 .get_or_insert_with(text, |text| Name::new_heap(text))
56 .clone()
57 }
58}
59
60#[derive(Debug)]

Callers 3

intern_nameMethod · 0.45
parse_dotted_nameMethod · 0.45

Calls 1

cloneMethod · 0.45

Tested by

no test coverage detected