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

Method this_subscript_of

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

1953 /// → `this.<field>[]`, `this['svc']` → `this.svc`; None for any other
1954 /// subscript. Mirrors tsThisSubscriptReceiver.
1955 fn this_subscript_of(&self, receiver: Node<'t>) -> Option<String> {
1956 if receiver.kind() != "subscript_expression" {
1957 return None;
1958 }
1959 let object = peel_receiver(receiver.child_by_field_name("object")?);
1960 if object.kind() == "this" {
1961 let key = self.quoted_identifier(receiver.child_by_field_name("index")?)?;
1962 return Some(format!("this.{key}"));
1963 }
1964 self.this_field_of(object).map(|field| format!("this.{field}[]"))
1965 }
1966
1967 /// `await f<T>(x)` parses with `await f` as the callee (#2586), and a
1968 /// 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