Browse Source

Optimize shotness nested nodes detection

Signed-off-by: Vadim Markovtsev <vadim@sourced.tech>
Vadim Markovtsev 7 years ago
parent
commit
fcbd3d72fc
1 changed files with 3 additions and 0 deletions
  1. 3 0
      shotness.go

+ 3 - 0
shotness.go

@@ -428,6 +428,9 @@ func (shotness *ShotnessAnalysis) extractNodes(root *uast.Node) (map[string]*uas
 	// otherwise due to UAST quirks there may be false positives
 	internal := map[*uast.Node]bool{}
 	for _, mainNode := range structs {
+		if internal[mainNode] {
+			continue
+		}
 		subs, err := tools.Filter(mainNode, shotness.XpathStruct)
 		if err != nil {
 			return nil, err