Revert "shader: Bug fix: Checking unused variables defined with var"

This reverts commit 4d3d3134d5.

Reason: Test failures
This commit is contained in:
Hajime Hoshi 2020-09-17 17:32:07 +09:00
parent 4d3d3134d5
commit ac971f77c5
2 changed files with 2 additions and 24 deletions

View File

@ -322,11 +322,9 @@ func (cs *compileState) parseDecl(b *block, d ast.Decl) ([]shaderir.Stmt, bool)
continue
}
for _, v := range vs {
b.addNamedLocalVariable(v.name, v.typ, d.Pos())
}
base := b.totalLocalVariableNum()
b.vars = append(b.vars, vs...)
if len(inits) > 0 {
for i := range vs {
stmts = append(stmts, shaderir.Stmt{

View File

@ -588,26 +588,6 @@ func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
`)); err != nil {
t.Error(err)
}
if _, err := NewShader([]byte(`package main
func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
var a int
return vec4(0)
}
`)); err == nil {
t.Errorf("error must be non-nil but was nil")
}
if _, err := NewShader([]byte(`package main
func Fragment(position vec4, texCoord vec2, color vec4) vec4 {
var a, b int
return vec4(0)
}
`)); err == nil {
t.Errorf("error must be non-nil but was nil")
}
}
func TestShaderBlankLhs(t *testing.T) {