Skip to content

Commit e959035

Browse files
committed
Resolve block enum types using lexical script owner
1 parent 545f8d7 commit e959035

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

vibes/execution_blocks.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ import "fmt"
44

55
func (exec *Execution) evalBlockLiteral(block *BlockLiteral, env *Env) (Value, error) {
66
blockValue := NewBlock(block.Params, block.Body, env)
7+
blk := blockValue.Block()
8+
blk.owner = exec.script
79
if ctx := exec.currentModuleContext(); ctx != nil {
8-
blk := blockValue.Block()
910
blk.moduleKey = ctx.key
1011
blk.modulePath = ctx.path
1112
blk.moduleRoot = ctx.root
@@ -48,6 +49,7 @@ func (exec *Execution) CallBlock(block Value, args []Value) (Value, error) {
4849
}
4950
if param.Type != nil {
5051
normalized, err := normalizeValueForType(val, param.Type, typeContext{
52+
owner: blk.owner,
5153
env: blk.Env,
5254
fallback: exec.root,
5355
})

vibes/value.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ type Block struct {
4747
Params []Param
4848
Body []Statement
4949
Env *Env
50+
owner *Script
5051
moduleKey string
5152
modulePath string
5253
moduleRoot string

0 commit comments

Comments
 (0)