File tree Expand file tree Collapse file tree
crates/codegraph-core/src/ast_analysis Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1748,6 +1748,22 @@ mod tests {
17481748 assert_eq ! ( m. cyclomatic, 3 ) ;
17491749 }
17501750
1751+ #[ test]
1752+ fn lua_method_declaration ( ) {
1753+ // Greptile follow-up to #1782: colon-syntax method declarations
1754+ // (`function Obj:method(x)`) have a `method_index_expression` name
1755+ // field but are still `function_declaration` nodes, so `function_nodes`
1756+ // already covers them — this pins that native/TS parity explicitly.
1757+ // Mirrors the TS test 'method declaration (colon syntax) is
1758+ // recognized as a function'.
1759+ let m = compute_lua (
1760+ "local Obj = {}\n function Obj:method(x)\n if x > 0 then\n return x\n end\n end" ,
1761+ ) ;
1762+ assert_eq ! ( m. cognitive, 1 ) ;
1763+ assert_eq ! ( m. cyclomatic, 2 ) ;
1764+ assert_eq ! ( m. max_nesting, 1 ) ;
1765+ }
1766+
17511767 #[ test]
17521768 fn lua_nested_if ( ) {
17531769 let m = compute_lua (
You can’t perform that action at this time.
0 commit comments