getSignature — lua (lua.ts:83-86) / luau (luau.ts:26-35).
(&self, node: Node<'t>)
| 387 | |
| 388 | /// getSignature — lua (lua.ts:83-86) / luau (luau.ts:26-35). |
| 389 | fn signature_of(&self, node: Node<'t>) -> Option<String> { |
| 390 | let params = node.child_by_field_name("parameters")?; |
| 391 | let mut sig = self.text(params).to_string(); |
| 392 | if self.is_luau { |
| 393 | // Return type = the named child AFTER `parameters` (found by |
| 394 | // startIndex match), unless it's the block. |
| 395 | let mut cursor = node.walk(); |
| 396 | let kids: Vec<Node<'t>> = node.named_children(&mut cursor).collect(); |
| 397 | if let Some(idx) = kids.iter().position(|k| k.start_byte() == params.start_byte()) { |
| 398 | if let Some(ret) = kids.get(idx + 1) { |
| 399 | if ret.kind() != "block" { |
| 400 | sig.push_str(": "); |
| 401 | sig.push_str(self.text(*ret)); |
| 402 | } |
| 403 | } |
| 404 | } |
| 405 | } |
| 406 | Some(sig) |
| 407 | } |
| 408 | |
| 409 | /// isExported (luau.ts:23) — the raw 7-unit slice is an ASCII prefix test. |
| 410 | fn is_exported_of(&self, node: Node<'t>) -> Option<bool> { |
no test coverage detected