lang: interfaces: API changes for lambdas
Co-authored-by: Samuel Gélineau <gelisam@gmail.com>
This commit is contained in:
@@ -107,7 +107,7 @@ type Expr interface {
|
|||||||
Ordering(map[string]Node) (*pgraph.Graph, map[Node]string, error)
|
Ordering(map[string]Node) (*pgraph.Graph, map[Node]string, error)
|
||||||
|
|
||||||
// SetScope sets the scope here and propagates it downwards.
|
// SetScope sets the scope here and propagates it downwards.
|
||||||
SetScope(*Scope) error
|
SetScope(*Scope, map[string]Expr) error
|
||||||
|
|
||||||
// SetType sets the type definitively, and errors if it is incompatible.
|
// SetType sets the type definitively, and errors if it is incompatible.
|
||||||
SetType(*types.Type) error
|
SetType(*types.Type) error
|
||||||
@@ -122,8 +122,9 @@ type Expr interface {
|
|||||||
Unify() ([]Invariant, error)
|
Unify() ([]Invariant, error)
|
||||||
|
|
||||||
// Graph returns the reactive function graph expressed by this node. It
|
// Graph returns the reactive function graph expressed by this node. It
|
||||||
// also returns the function for this node.
|
// takes in the environment of any functions in scope. It also returns
|
||||||
Graph() (*pgraph.Graph, Func, error)
|
// the function for this node.
|
||||||
|
Graph(env map[string]Func) (*pgraph.Graph, Func, error)
|
||||||
|
|
||||||
// SetValue stores the result of the last computation of this expression
|
// SetValue stores the result of the last computation of this expression
|
||||||
// node.
|
// node.
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ func (obj *ExprAny) Ordering(produces map[string]Node) (*pgraph.Graph, map[Node]
|
|||||||
|
|
||||||
// SetScope does nothing for this struct, because it has no child nodes, and it
|
// SetScope does nothing for this struct, because it has no child nodes, and it
|
||||||
// does not need to know about the parent scope.
|
// does not need to know about the parent scope.
|
||||||
func (obj *ExprAny) SetScope(*Scope) error { return nil }
|
func (obj *ExprAny) SetScope(*Scope, map[string]Expr) error { return nil }
|
||||||
|
|
||||||
// SetType is used to set the type of this expression once it is known. This
|
// SetType is used to set the type of this expression once it is known. This
|
||||||
// usually happens during type unification, but it can also happen during
|
// usually happens during type unification, but it can also happen during
|
||||||
@@ -145,7 +145,7 @@ func (obj *ExprAny) Func() (Func, error) {
|
|||||||
// that fulfill the Stmt interface do not produces vertices, where as their
|
// that fulfill the Stmt interface do not produces vertices, where as their
|
||||||
// children might. This returns a graph with a single vertex (itself) in it, and
|
// children might. This returns a graph with a single vertex (itself) in it, and
|
||||||
// the edges from all of the child graphs to this.
|
// the edges from all of the child graphs to this.
|
||||||
func (obj *ExprAny) Graph() (*pgraph.Graph, Func, error) {
|
func (obj *ExprAny) Graph(env map[string]Func) (*pgraph.Graph, Func, error) {
|
||||||
graph, err := pgraph.NewGraph("any")
|
graph, err := pgraph.NewGraph("any")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
|
|||||||
Reference in New Issue
Block a user