mirror of
https://github.com/github/codeql.git
synced 2026-06-29 16:47:09 +02:00
yeast: Remove dead prepend_field / prepend_field_child
`BuildCtx::prepend_field` and the underlying `Ast::prepend_field_child` existed to support the create-then-mutate pattern in swift.rs (build an output node, then prepend modifiers to its `modifier:` field). The SwiftContext-based refactor on the previous branches eliminated all such call sites: every emitted declaration now carries its modifiers from birth, so the in-place prepend operation has no users. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -158,15 +158,6 @@ impl<'a, C> BuildCtx<'a, C> {
|
||||
self.ast
|
||||
.create_named_token_with_range(kind, generated, self.source_range)
|
||||
}
|
||||
|
||||
/// Prepend a value to a field of an existing node.
|
||||
pub fn prepend_field(&mut self, node_id: Id, field_name: &str, value_id: Id) {
|
||||
let field_id = self
|
||||
.ast
|
||||
.field_id_for_name(field_name)
|
||||
.unwrap_or_else(|| panic!("build: field '{field_name}' not found"));
|
||||
self.ast.prepend_field_child(node_id, field_id, value_id);
|
||||
}
|
||||
}
|
||||
|
||||
impl<C: Clone> BuildCtx<'_, C> {
|
||||
|
||||
@@ -518,15 +518,6 @@ impl Ast {
|
||||
self.create_named_token_with_range(kind, content, None)
|
||||
}
|
||||
|
||||
/// Prepend a child id to the given field of the given node.
|
||||
pub fn prepend_field_child(&mut self, node_id: Id, field_id: FieldId, value_id: Id) {
|
||||
let node = self
|
||||
.nodes
|
||||
.get_mut(node_id.0)
|
||||
.expect("prepend_field_child: invalid node id");
|
||||
node.fields.entry(field_id).or_default().insert(0, value_id);
|
||||
}
|
||||
|
||||
pub fn create_named_token_with_range(
|
||||
&mut self,
|
||||
kind: &'static str,
|
||||
|
||||
Reference in New Issue
Block a user