functions now capture variables :D
This commit is contained in:
parent
43e450c207
commit
d315a53fbd
5 changed files with 49 additions and 11 deletions
|
|
@ -587,6 +587,7 @@ func (c *Compiler) compile(tree Node) error {
|
|||
n.yield,
|
||||
c.Chunk,
|
||||
nil,
|
||||
nil,
|
||||
}
|
||||
|
||||
// restore old chunk and ip
|
||||
|
|
@ -958,6 +959,13 @@ func (c *Compiler) deduceSignature(tree Node) (TypeSignature, error) {
|
|||
}
|
||||
|
||||
return nil, c.error(fmt.Sprintf("unimplemented result type deduction for unary %s", n.UnaryOperation), n)
|
||||
case BlockNodeType:
|
||||
n := tree.(*BlockNode)
|
||||
if len(n.statements) == 0 {
|
||||
return &NilSignature{}, nil
|
||||
}
|
||||
|
||||
return c.deduceSignature(n.statements[len(n.statements)-1])
|
||||
default:
|
||||
return nil, c.error(fmt.Sprintf("impossible to deduce signature of %s", tree.Type()), tree)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue