MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / this_subscript_of

Method this_subscript_of

codegraph-kernel/src/tsjs/extractors.rs:1802–1812  ·  view source on GitHub ↗

A receiver subscripting the enclosing class's object: `this. [k]` → `this. []`, `this['svc']` → `this.svc`; None for any other subscript. Mirrors tsThisSubscriptReceiver.

(&self, receiver: Node<'t>)

Source from the content-addressed store, hash-verified

1800 /// → `this.<field>[]`, `this['svc']` → `this.svc`; None for any other
1801 /// subscript. Mirrors tsThisSubscriptReceiver.
1802 fn this_subscript_of(&self, receiver: Node<'t>) -> Option<String> {
1803 if receiver.kind() != "subscript_expression" {
1804 return None;
1805 }
1806 let object = peel_receiver(receiver.child_by_field_name("object")?);
1807 if object.kind() == "this" {
1808 let key = self.quoted_identifier(receiver.child_by_field_name("index")?)?;
1809 return Some(format!("this.{key}"));
1810 }
1811 self.this_field_of(object).map(|field| format!("this.{field}[]"))
1812 }
1813
1814 /// `await f<T>(x)` parses with `await f` as the callee (#2586), and a
1815 /// prefix operator over a generic call the same way

Callers 1

extract_callMethod · 0.80

Calls 4

peel_receiverFunction · 0.85
quoted_identifierMethod · 0.80
mapMethod · 0.80
this_field_ofMethod · 0.80

Tested by

no test coverage detected