lang: ast: Remove unnecessary metaparam exclusive
Originally, I considered having more than one way to express the meta param. After thinking about it for longer, it probably makes sense to have a second meta param if necessary, and to avoid the exclusive.
This commit is contained in:
@@ -1065,13 +1065,9 @@ func (obj *StmtRes) metaparams(table map[interfaces.Func]types.Value, res engine
|
||||
meta.Realize = v.Bool() // must not panic
|
||||
|
||||
case "reverse":
|
||||
if v.Type().Cmp(types.TypeBool) == nil {
|
||||
if rm != nil {
|
||||
rm.Disabled = !v.Bool() // must not panic
|
||||
}
|
||||
} else {
|
||||
// TODO: read values from struct into rm.XXX
|
||||
}
|
||||
|
||||
case "autoedge":
|
||||
if aem != nil {
|
||||
@@ -1132,11 +1128,7 @@ func (obj *StmtRes) metaparams(table map[interfaces.Func]types.Value, res engine
|
||||
meta.Realize = val.Bool() // must not panic
|
||||
}
|
||||
if val, exists := v.Struct()["reverse"]; exists && rm != nil {
|
||||
if val.Type().Cmp(types.TypeBool) == nil {
|
||||
rm.Disabled = !val.Bool() // must not panic
|
||||
} else {
|
||||
// TODO: read values from struct into rm.XXX
|
||||
}
|
||||
}
|
||||
if val, exists := v.Struct()["autoedge"]; exists && aem != nil {
|
||||
aem.Disabled = !val.Bool() // must not panic
|
||||
@@ -1962,18 +1954,8 @@ func (obj *StmtResMeta) Unify(kind string) ([]interfaces.Invariant, error) {
|
||||
invar = static(types.TypeBool)
|
||||
|
||||
case "reverse":
|
||||
ors := []interfaces.Invariant{}
|
||||
|
||||
invarBool := static(types.TypeBool)
|
||||
ors = append(ors, invarBool)
|
||||
|
||||
// TODO: decide what fields we might want here
|
||||
//invarStruct := static(types.NewType("struct{edges str}"))
|
||||
//ors = append(ors, invarStruct)
|
||||
|
||||
invar = &interfaces.ExclusiveInvariant{
|
||||
Invariants: ors, // one and only one of these should be true
|
||||
}
|
||||
// TODO: We might want more parameters about how to reverse.
|
||||
invar = static(types.TypeBool)
|
||||
|
||||
case "autoedge":
|
||||
invar = static(types.TypeBool)
|
||||
@@ -1989,15 +1971,8 @@ func (obj *StmtResMeta) Unify(kind string) ([]interfaces.Invariant, error) {
|
||||
wrap := func(reverse *types.Type) *types.Type {
|
||||
return types.NewType(fmt.Sprintf("struct{noop bool; retry int; retryreset bool; delay int; poll int; limit float; burst int; reset bool; sema []str; rewatch bool; realize bool; reverse %s; autoedge bool; autogroup bool}", reverse.String()))
|
||||
}
|
||||
ors := []interfaces.Invariant{}
|
||||
invarBool := static(wrap(types.TypeBool))
|
||||
ors = append(ors, invarBool)
|
||||
// TODO: decide what fields we might want here
|
||||
//invarStruct := static(wrap(types.NewType("struct{edges str}")))
|
||||
//ors = append(ors, invarStruct)
|
||||
invar = &interfaces.ExclusiveInvariant{
|
||||
Invariants: ors, // one and only one of these should be true
|
||||
}
|
||||
// TODO: We might want more parameters about how to reverse.
|
||||
invar = static(wrap(types.TypeBool))
|
||||
|
||||
default:
|
||||
return nil, fmt.Errorf("unknown property: %s", p)
|
||||
|
||||
Reference in New Issue
Block a user