refractor(aa): ensure methods order in rules definitions.

This commit is contained in:
Alexandre Pujol 2024-06-25 19:56:36 +01:00
parent 272072d2a5
commit 880f0ef37e
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC
19 changed files with 310 additions and 310 deletions

View file

@ -29,24 +29,24 @@ func newComment(rule rule) (Rule, error) {
return &Comment{Base: base}, nil
}
func (r *Comment) Validate() error {
return nil
}
func (r *Comment) Compare(other Rule) int {
return 0 // Comments are always equal to each other as they are not compared
}
func (r *Comment) String() string {
return renderTemplate(r.Kind(), r)
func (r *Comment) Kind() Kind {
return COMMENT
}
func (r *Comment) Constraint() constraint {
return anyKind
}
func (r *Comment) Kind() Kind {
return COMMENT
func (r *Comment) String() string {
return renderTemplate(r.Kind(), r)
}
func (r *Comment) Validate() error {
return nil
}
func (r *Comment) Compare(other Rule) int {
return 0 // Comments are always equal to each other as they are not compared
}
type Abi struct {
@ -77,6 +77,18 @@ func newAbi(q Qualifier, rule rule) (Rule, error) {
}, nil
}
func (r *Abi) Kind() Kind {
return ABI
}
func (r *Abi) Constraint() constraint {
return preambleKind
}
func (r *Abi) String() string {
return renderTemplate(r.Kind(), r)
}
func (r *Abi) Validate() error {
return nil
}
@ -89,18 +101,6 @@ func (r *Abi) Compare(other Rule) int {
return compare(r.IsMagic, o.IsMagic)
}
func (r *Abi) String() string {
return renderTemplate(r.Kind(), r)
}
func (r *Abi) Constraint() constraint {
return preambleKind
}
func (r *Abi) Kind() Kind {
return ABI
}
type Alias struct {
Base
Path string
@ -121,6 +121,18 @@ func newAlias(q Qualifier, rule rule) (Rule, error) {
}, nil
}
func (r *Alias) Kind() Kind {
return ALIAS
}
func (r *Alias) Constraint() constraint {
return preambleKind
}
func (r *Alias) String() string {
return renderTemplate(r.Kind(), r)
}
func (r *Alias) Validate() error {
return nil
}
@ -133,18 +145,6 @@ func (r *Alias) Compare(other Rule) int {
return compare(r.RewrittenPath, o.RewrittenPath)
}
func (r *Alias) String() string {
return renderTemplate(r.Kind(), r)
}
func (r *Alias) Constraint() constraint {
return preambleKind
}
func (r *Alias) Kind() Kind {
return ALIAS
}
type Include struct {
Base
IfExists bool
@ -184,6 +184,18 @@ func newInclude(rule rule) (Rule, error) {
}, nil
}
func (r *Include) Kind() Kind {
return INCLUDE
}
func (r *Include) Constraint() constraint {
return anyKind
}
func (r *Include) String() string {
return renderTemplate(r.Kind(), r)
}
func (r *Include) Validate() error {
return nil
}
@ -206,18 +218,6 @@ func (r *Include) Compare(other Rule) int {
return compare(r.IfExists, o.IfExists)
}
func (r *Include) String() string {
return renderTemplate(r.Kind(), r)
}
func (r *Include) Constraint() constraint {
return anyKind
}
func (r *Include) Kind() Kind {
return INCLUDE
}
type Variable struct {
Base
Name string
@ -252,19 +252,20 @@ func newVariable(rule rule) (Rule, error) {
}, nil
}
func (r *Variable) Validate() error {
return nil
func (r *Variable) Kind() Kind {
return VARIABLE
}
func (r *Variable) Merge(other Rule) bool {
o, _ := other.(*Variable)
func (r *Variable) Constraint() constraint {
return preambleKind
}
if r.Name == o.Name && r.Define == o.Define {
r.Values = merge(r.Kind(), "access", r.Values, o.Values)
b := &r.Base
return b.merge(o.Base)
}
return false
func (r *Variable) String() string {
return renderTemplate(r.Kind(), r)
}
func (r *Variable) Validate() error {
return nil
}
func (r *Variable) Compare(other Rule) int {
@ -278,14 +279,13 @@ func (r *Variable) Compare(other Rule) int {
return compare(r.Values, o.Values)
}
func (r *Variable) String() string {
return renderTemplate(r.Kind(), r)
}
func (r *Variable) Merge(other Rule) bool {
o, _ := other.(*Variable)
func (r *Variable) Constraint() constraint {
return preambleKind
}
func (r *Variable) Kind() Kind {
return VARIABLE
if r.Name == o.Name && r.Define == o.Define {
r.Values = merge(r.Kind(), "access", r.Values, o.Values)
b := &r.Base
return b.merge(o.Base)
}
return false
}