lang: Small fixes about send/recv

This commit is contained in:
James Shubin
2019-03-09 16:07:22 -05:00
parent 0ca57d6a09
commit d69eb27557

View File

@@ -1611,7 +1611,7 @@ func (obj *StmtEdge) Output() (*interfaces.Output, error) {
type StmtEdgeHalf struct { type StmtEdgeHalf struct {
Kind string // kind of resource, eg: pkg, file, svc, etc... Kind string // kind of resource, eg: pkg, file, svc, etc...
Name interfaces.Expr // unique name for the res of this kind Name interfaces.Expr // unique name for the res of this kind
SendRecv string // name of field to send/recv from, empty to ignore SendRecv string // name of field to send/recv from/to, empty to ignore
} }
// Apply is a general purpose iterator method that operates on any AST node. It // Apply is a general purpose iterator method that operates on any AST node. It
@@ -1670,6 +1670,15 @@ func (obj *StmtEdgeHalf) Unify() ([]interfaces.Invariant, error) {
return nil, fmt.Errorf("missing resource kind in edge") return nil, fmt.Errorf("missing resource kind in edge")
} }
if obj.SendRecv != "" {
// FIXME: write this function (get expected type of field)
//invar, err := StructFieldInvariant(obj.Kind, obj.SendRecv)
//if err != nil {
// return nil, err
//}
//invariants = append(invariants, invar...)
}
invars, err := obj.Name.Unify() invars, err := obj.Name.Unify()
if err != nil { if err != nil {
return nil, err return nil, err