Skip to content

Commit a509bbd

Browse files
committed
messagix/bloks: allow other type of get variable in read calls and implement GenerateUUID
1 parent 05cabf9 commit a509bbd

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

pkg/messagix/bloks/interp.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ func (i *Interpreter) Evaluate(ctx context.Context, form *BloksScriptNode) (*Blo
676676
if !ok {
677677
return nil, fmt.Errorf("reading from non-ref %T", call.Args[0].BloksScriptNodeContent)
678678
}
679-
if ref.Function != "bk.action.bloks.GetVariable2" {
679+
if ref.Function != "bk.action.bloks.GetVariable2" && ref.Function != "bk.action.bloks.GetVariableWithScope" {
680680
return nil, fmt.Errorf("reading from non-ref funcall %s", ref.Function)
681681
}
682682
varname, err := evalAs[string](ctx, i, &ref.Args[0], "ref.read")
@@ -691,10 +691,10 @@ func (i *Interpreter) Evaluate(ctx context.Context, form *BloksScriptNode) (*Blo
691691
case "bk.action.ref.Write":
692692
ref, ok := call.Args[0].BloksScriptNodeContent.(*BloksScriptFuncall)
693693
if !ok {
694-
return nil, fmt.Errorf("reading from non-ref %T", call.Args[0].BloksScriptNodeContent)
694+
return nil, fmt.Errorf("reading from non-ref %T (for write)", call.Args[0].BloksScriptNodeContent)
695695
}
696-
if ref.Function != "bk.action.bloks.GetVariable2" {
697-
return nil, fmt.Errorf("reading from non-ref funcall %s", ref.Function)
696+
if ref.Function != "bk.action.bloks.GetVariable2" && ref.Function != "bk.action.bloks.GetVariableWithScope" {
697+
return nil, fmt.Errorf("reading from non-ref funcall %s (for write)", ref.Function)
698698
}
699699
varname, err := evalAs[string](ctx, i, &ref.Args[0], "ref.read")
700700
if err != nil {
@@ -1013,8 +1013,13 @@ func (i *Interpreter) Evaluate(ctx context.Context, form *BloksScriptNode) (*Blo
10131013
return nil, err
10141014
}
10151015
return BloksNothing, i.Bridge.OpenURL(url)
1016+
case "bk.action.caa.GenerateUUID":
1017+
// This may be wrong, just guessed the implementation based on the function name, it seems to work
1018+
return BloksLiteralOf(uuid.New().String()), nil
10161019
case
10171020
"bk.action.animated.Start",
1021+
"bk.action.animated.Build",
1022+
"bk.action.animated.StartToken",
10181023
"bk.action.logging.LogEvent",
10191024
"bk.action.LogFlytrapData",
10201025
"bk.action.qpl.MarkerStartV2",

0 commit comments

Comments
 (0)