diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2018-07-31 20:47:36 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2018-07-31 20:47:36 +0200 |
| commit | 1477993e1b6aae37085eb2ead17aae4ab827c0b5 (patch) | |
| tree | 8618725ca2eaa5e2304cbdea79be622cd8bc3678 /pkg | |
| parent | 8ef497b65213b43164bcb9437d0c5bdd986cd52c (diff) | |
pkg/compiler: work around vet crash
vetshadow not works, so enable it.
Update https://github.com/golang/go/issues/26725
Update #538
Diffstat (limited to 'pkg')
| -rw-r--r-- | pkg/compiler/check.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/pkg/compiler/check.go b/pkg/compiler/check.go index 04c934c2d..a0d0f7fed 100644 --- a/pkg/compiler/check.go +++ b/pkg/compiler/check.go @@ -85,12 +85,13 @@ func (comp *compiler) checkNames() { name, typ, prev.Pos) continue } - if res, ok := decl.(*ast.Resource); ok { - comp.resources[name] = res - } else if n, ok := decl.(*ast.TypeDef); ok { + switch n := decl.(type) { + case *ast.Resource: + comp.resources[name] = n + case *ast.TypeDef: comp.typedefs[name] = n - } else if str, ok := decl.(*ast.Struct); ok { - comp.structs[name] = str + case *ast.Struct: + comp.structs[name] = n } case *ast.IntFlags: name := n.Name.Name |
