mirror of
https://github.com/reactos/syzkaller.git
synced 2025-02-22 20:52:27 +00:00
pkg/compiler: refactor checkNames
Too complex. Split into 2 functions. Update #538
This commit is contained in:
parent
3a4641d90c
commit
af15ef43a8
@ -14,6 +14,7 @@ import (
|
||||
)
|
||||
|
||||
func (comp *compiler) typecheck() {
|
||||
comp.checkDirectives()
|
||||
comp.checkNames()
|
||||
comp.checkFields()
|
||||
comp.checkTypedefs()
|
||||
@ -31,11 +32,10 @@ func (comp *compiler) check() {
|
||||
comp.checkDupConsts()
|
||||
}
|
||||
|
||||
func (comp *compiler) checkNames() {
|
||||
func (comp *compiler) checkDirectives() {
|
||||
includes := make(map[string]bool)
|
||||
incdirs := make(map[string]bool)
|
||||
defines := make(map[string]bool)
|
||||
calls := make(map[string]*ast.Call)
|
||||
for _, decl := range comp.desc.Nodes {
|
||||
switch n := decl.(type) {
|
||||
case *ast.Include:
|
||||
@ -59,6 +59,14 @@ func (comp *compiler) checkNames() {
|
||||
comp.error(n.Pos, "duplicate define %v", name)
|
||||
}
|
||||
defines[path] = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (comp *compiler) checkNames() {
|
||||
calls := make(map[string]*ast.Call)
|
||||
for _, decl := range comp.desc.Nodes {
|
||||
switch n := decl.(type) {
|
||||
case *ast.Resource, *ast.Struct, *ast.TypeDef:
|
||||
pos, typ, name := decl.Info()
|
||||
if reservedName[name] {
|
||||
|
Loading…
x
Reference in New Issue
Block a user