Handle the ValueSpec when trying to resolve an AST tree node

Signed-off-by: Cosmin Cojocar <cosmin.cojocar@gmx.ch>
This commit is contained in:
Cosmin Cojocar 2019-10-04 13:22:41 +02:00 committed by Cosmin Cojocar
parent c1970ff5c9
commit f413f1436d
2 changed files with 2 additions and 2 deletions

View file

@ -73,7 +73,7 @@ func resolveCallExpr(n *ast.CallExpr, c *Context) bool {
return false
}
// TryResolve will attempt, given a subtree starting at some ATS node, to resolve
// TryResolve will attempt, given a subtree starting at some AST node, to resolve
// all values contained within to a known constant. It is used to check for any
// unknown values in compound expressions.
func TryResolve(n ast.Node, c *Context) bool {

View file

@ -91,6 +91,7 @@ var _ = Describe("Resolve ast node to concrete value", func() {
Expect(target).ShouldNot(BeNil())
Expect(gosec.TryResolve(target, ctx)).Should(BeTrue())
})
It("should successfully resolve value spec", func() {
var value *ast.ValueSpec
pkg := testutils.NewTestPackage()
@ -111,7 +112,6 @@ var _ = Describe("Resolve ast node to concrete value", func() {
Expect(value).ShouldNot(BeNil())
Expect(gosec.TryResolve(value, ctx)).Should(BeTrue())
})
})
})