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

Method this_subscript_of

codegraph-kernel/src/tsjs/extractors.rs:2342–2352  ·  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

2340 /// → `this.<field>[]`, `this['svc']` → `this.svc`; None for any other
2341 /// subscript. Mirrors tsThisSubscriptReceiver.
2342 fn this_subscript_of(&self, receiver: Node<'t>) -> Option<String> {
2343 if receiver.kind() != "subscript_expression" {
2344 return None;
2345 }
2346 let object = peel_receiver(receiver.child_by_field_name("object")?);
2347 if object.kind() == "this" {
2348 let key = self.quoted_identifier(receiver.child_by_field_name("index")?)?;
2349 return Some(format!("this.{key}"));
2350 }
2351 self.this_field_of(object).map(|field| format!("this.{field}[]"))
2352 }
2353
2354 /// `await f<T>(x)` parses with `await f` as the callee (#2586), and a
2355 /// 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