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