mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-06 06:48:48 +00:00
Added a smoke test for local scopes
This commit is contained in:
parent
5527013a7f
commit
a3b12425fd
4 changed files with 13 additions and 1 deletions
1
regression/orig/test056.log
Normal file
1
regression/orig/test056.log
Normal file
|
|
@ -0,0 +1 @@
|
|||
> > > 8
|
||||
8
regression/test056.expr
Normal file
8
regression/test056.expr
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fun test (a, b, c) {
|
||||
local x = a + b, y = b + c;
|
||||
{local e = x + y;
|
||||
return e
|
||||
}
|
||||
}
|
||||
|
||||
write (test (read (), read (), read ()))
|
||||
3
regression/test056.input
Normal file
3
regression/test056.input
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
1
|
||||
2
|
||||
3
|
||||
|
|
@ -556,7 +556,7 @@ module Expr =
|
|||
let vars, body =
|
||||
List.fold_left
|
||||
(fun (vs, bd) -> function
|
||||
| (name, `Variable value) -> name :: vs, (match value with None -> bd | Some v -> Seq (Assign (Var name, v), bd))
|
||||
| (name, `Variable value) -> name :: vs, (match value with None -> bd | Some v -> Seq (Assign (Ref name, v), bd))
|
||||
| _ -> invalid_arg "function"
|
||||
)
|
||||
([], expr)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue