-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflags.go
More file actions
31 lines (27 loc) · 926 Bytes
/
Copy pathflags.go
File metadata and controls
31 lines (27 loc) · 926 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package analysis
type Flag uint64
const (
SingleFileModule Flag = 1 << iota
BootstrapModule // Module used inside the Klar compiler
REPLModule // Module used for the REPL. Allow unused values
VariadicParam // *Variable is a variadic function param
HasDefault // Func param or struct field has a default value
ModuleWithErrors // Module has errors and cannot be imported
// [*Expr] refers to a constant or is supposed to be constant
ConstExpr
// When parsing types, only types declared in this module are allowed
LocalOnly
ImplicitVar
// Passed to [Checker.parseType] to avoid errors for a generic without params
genericLHS
UsageOptional // No warnings if unused0
)
func parseFlags[T ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64](flags []T) (flag T) {
for _, fl := range flags {
flag |= fl
}
return
}
func (f Flag) Has(flag Flag) bool {
return (f & flag) != 0
}