diff options
| author | Paul Chaignon <paul.chaignon@gmail.com> | 2023-11-19 23:51:35 +0100 |
|---|---|---|
| committer | Aleksandr Nogikh <nogikh@google.com> | 2023-11-29 15:13:40 +0000 |
| commit | 91df311f3d62a7add7cd9340026cfc6290ce55dc (patch) | |
| tree | 72ba4de582a51c66fca70427f9d70e02134ff26b /pkg/compiler | |
| parent | 6e78f9ceb50e5cafa8ebe0e313c32e1293871a34 (diff) | |
compiler: remove dead code around structFieldAttrs
structFieldAttrs is filled with empty attrDesc structs and is never
changed at runtime. structFieldAttrs[X].CheckConsts is therefore
always nil.
Signed-off-by: Paul Chaignon <paul.chaignon@gmail.com>
Diffstat (limited to 'pkg/compiler')
| -rw-r--r-- | pkg/compiler/attrs.go | 4 | ||||
| -rw-r--r-- | pkg/compiler/check.go | 4 |
2 files changed, 3 insertions, 5 deletions
diff --git a/pkg/compiler/attrs.go b/pkg/compiler/attrs.go index dc10dbc9b..d24c38a6d 100644 --- a/pkg/compiler/attrs.go +++ b/pkg/compiler/attrs.go @@ -14,7 +14,9 @@ type attrDesc struct { Name string // For now we assume attributes can have only 1 argument and it's an integer, // enough to cover existing cases. - HasArg bool + HasArg bool + // This function is not invoked for per-field attributes, only for whole + // structs/unions. CheckConsts func(comp *compiler, parent ast.Node, attr *ast.Type) } diff --git a/pkg/compiler/check.go b/pkg/compiler/check.go index 645a73220..b5ced7a13 100644 --- a/pkg/compiler/check.go +++ b/pkg/compiler/check.go @@ -326,10 +326,6 @@ func (comp *compiler) checkAttributeValues() { for _, f := range st.Fields { isOut := hasOutOverlay for _, attr := range f.Attrs { - desc := structFieldAttrs[attr.Ident] - if desc.CheckConsts != nil { - desc.CheckConsts(comp, f, attr) - } switch attr.Ident { case attrOutOverlay.Name: hasOutOverlay = true |
