Skip to content

Commit 2fdcac2

Browse files
committed
Modifying extraction of global statements to omit local function declarations.
Signed-off-by: Adam Storek <[email protected]>
1 parent 726d68e commit 2fdcac2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

capa/features/extractors/ts/query.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ def __init__(self, language: str):
3535
self.namespace = self.language.query(
3636
"(using_directive [(identifier) @namespace (qualified_name) @namespace])"
3737
)
38-
self.global_statement = self.language.query("(global_statement) @global-statement")
38+
self.global_statement = self.language.query(
39+
"(global_statement [(expression_statement) @global-statement (local_declaration_statement) @global-statement])"
40+
)
3941
else:
4042
raise NotImplementedError(f"Tree-sitter queries for {language} are not implemented.")

0 commit comments

Comments
 (0)