A receiver chain the resolver can type (TS `KOTLIN_RECEIVER_CHAIN`): whitespace stripped, `?.` read as `.`, then `this` or an identifier followed by one to three `.identifier` segments.
(text: &str)
| 91 | /// whitespace stripped, `?.` read as `.`, then `this` or an identifier |
| 92 | /// followed by one to three `.identifier` segments. |
| 93 | fn kotlin_receiver_chain(text: &str) -> Option<String> { |
| 94 | let chain = strip_js_ws(text).replace("?.", "."); |
| 95 | let segments: Vec<&str> = chain.split('.').collect(); |
| 96 | if segments.len() < 2 || segments.len() > 4 { |
| 97 | return None; |
| 98 | } |
| 99 | let ident = |s: &str| { |
| 100 | let b = s.as_bytes(); |
| 101 | !b.is_empty() |
| 102 | && (b[0].is_ascii_alphabetic() || b[0] == b'_') |
| 103 | && b.iter().all(|c| c.is_ascii_alphanumeric() || *c == b'_') |
| 104 | }; |
| 105 | if segments.iter().all(|s| ident(s)) { |
| 106 | Some(chain) |
| 107 | } else { |
| 108 | None |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | /// A property's CODE children: the named child right after the `=` token, a |
| 113 | /// `property_delegate` (`by lazy { … }`), an explicit backing field (`field = |
no test coverage detected