lang: ast, funcs: Start plumbing through the textarea
We need to get these everywhere and this is a start.
This commit is contained in:
@@ -53,6 +53,8 @@ const (
|
||||
// The arguments are connected to the received FuncValues in such a way that
|
||||
// CallFunc emits the result of applying the function to the arguments.
|
||||
type CallFunc struct {
|
||||
interfaces.Textarea
|
||||
|
||||
Type *types.Type // the type of the result of applying the function
|
||||
FuncType *types.Type // the type of the function
|
||||
EdgeName string // name of the edge used
|
||||
|
||||
@@ -48,6 +48,8 @@ const (
|
||||
// value as a stream that depends on those inputs. It helps the list, map, and
|
||||
// struct's that fulfill the Expr interface but expressing a Func method.
|
||||
type CompositeFunc struct {
|
||||
interfaces.Textarea
|
||||
|
||||
Type *types.Type // this is the type of the composite value we hold
|
||||
Len int // length of list or map (if used)
|
||||
|
||||
|
||||
@@ -44,6 +44,8 @@ const (
|
||||
|
||||
// ConstFunc is a function that returns the constant value passed to Value.
|
||||
type ConstFunc struct {
|
||||
interfaces.Textarea
|
||||
|
||||
Value types.Value
|
||||
NameHint string
|
||||
|
||||
|
||||
@@ -51,6 +51,8 @@ const (
|
||||
// build a subgraph that processes each element, and in doing so we get a larger
|
||||
// function graph. This is rebuilt as necessary if the input list changes.
|
||||
type ForFunc struct {
|
||||
interfaces.Textarea
|
||||
|
||||
IndexType *types.Type
|
||||
ValueType *types.Type
|
||||
|
||||
|
||||
@@ -51,6 +51,8 @@ const (
|
||||
// build a subgraph that processes each key and val, and in doing so we get a
|
||||
// larger function graph. This is rebuilt as necessary if the input map changes.
|
||||
type ForKVFunc struct {
|
||||
interfaces.Textarea
|
||||
|
||||
KeyType *types.Type
|
||||
ValType *types.Type
|
||||
|
||||
|
||||
@@ -45,6 +45,8 @@ const (
|
||||
// IfFunc is a function that passes through the value of the correct branch
|
||||
// based on the conditional value it gets.
|
||||
type IfFunc struct {
|
||||
interfaces.Textarea
|
||||
|
||||
Type *types.Type // this is the type of the if expression output we hold
|
||||
|
||||
init *interfaces.Init
|
||||
|
||||
@@ -45,6 +45,8 @@ import (
|
||||
// which is implemented by &ConstFunc{}.
|
||||
func FuncValueToConstFunc(fv *full.FuncValue) interfaces.Func {
|
||||
return &ConstFunc{
|
||||
//Textarea: ???, // XXX: add me!
|
||||
|
||||
Value: fv,
|
||||
NameHint: "FuncValue",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user