From 97c30126e9d77a2398572409e73734cee5b37182 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Fabianski?= Date: Mon, 19 Feb 2024 11:29:10 +0100 Subject: [PATCH] fix(java): skip cast expression (#1502) --- internal/languages/java/analyzer/analyzer.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/internal/languages/java/analyzer/analyzer.go b/internal/languages/java/analyzer/analyzer.go index 6cf35989a..723a35078 100644 --- a/internal/languages/java/analyzer/analyzer.go +++ b/internal/languages/java/analyzer/analyzer.go @@ -66,6 +66,8 @@ func (analyzer *analyzer) Analyze(node *sitter.Node, visitChildren func() error) return analyzer.analyzeParameter(node, visitChildren) case "resource": return analyzer.analyzeResource(node, visitChildren) + case "cast_expression": + return analyzer.analyzeCastExpression(node, visitChildren) case "switch_expression": return analyzer.analyzeSwitch(node, visitChildren) case "switch_block": @@ -107,6 +109,16 @@ func (analyzer *analyzer) analyzeAssignment(node *sitter.Node, visitChildren fun return err } +func (analyzer *analyzer) analyzeCastExpression(node *sitter.Node, visitChildren func() error) error { + value := node.ChildByFieldName("value") + + analyzer.builder.Alias(node, value) + + analyzer.lookupVariable(value) + + return visitChildren() +} + // the "foo = 1" part in: // // class X {