I added qualified names (paths) as left-hand sides of assignments.
For example: store.funded := True;
This commit is contained in:
parent
e8443937fd
commit
dc70df99f9
6
AST.ml
6
AST.ml
@ -388,7 +388,7 @@ and case = {
|
||||
}
|
||||
|
||||
and assignment = {
|
||||
var : variable;
|
||||
path : path;
|
||||
assign : assign;
|
||||
expr : expr
|
||||
}
|
||||
@ -1014,8 +1014,8 @@ and print_case {value; _} =
|
||||
print_instruction instr
|
||||
|
||||
and print_assignment {value; _} =
|
||||
let {var; assign; expr} = value in
|
||||
print_var var;
|
||||
let {path; assign; expr} = value in
|
||||
print_path path;
|
||||
print_token assign ":=";
|
||||
print_expr expr
|
||||
|
||||
|
2
AST.mli
2
AST.mli
@ -372,7 +372,7 @@ and case = {
|
||||
}
|
||||
|
||||
and assignment = {
|
||||
var : variable;
|
||||
path : path;
|
||||
assign : assign;
|
||||
expr : expr
|
||||
}
|
||||
|
12
Parser.mly
12
Parser.mly
@ -543,9 +543,9 @@ case:
|
||||
}
|
||||
|
||||
assignment:
|
||||
var ASS expr {
|
||||
let region = cover $1.region (expr_to_region $3)
|
||||
and value = {var = $1; assign = $2; expr = $3}
|
||||
path ASS expr {
|
||||
let region = cover (path_to_region $1) (expr_to_region $3)
|
||||
and value = {path = $1; assign = $2; expr = $3}
|
||||
in {region; value}
|
||||
}
|
||||
|
||||
@ -566,16 +566,14 @@ while_loop:
|
||||
for_loop:
|
||||
For assignment Down? To expr option(step_clause) block {
|
||||
let region = cover $1 $7.region in
|
||||
let value =
|
||||
{
|
||||
let value = {
|
||||
kwd_for = $1;
|
||||
assign = $2;
|
||||
down = $3;
|
||||
kwd_to = $4;
|
||||
bound = $5;
|
||||
step = $6;
|
||||
block = $7;
|
||||
}
|
||||
block = $7}
|
||||
in For (ForInt {region; value})
|
||||
}
|
||||
|
||||
|
@ -33,8 +33,8 @@ entrypoint withdraw (storage store : store; const sender : address)
|
||||
if now >= store.deadline then
|
||||
if balance >= store.goal then
|
||||
begin
|
||||
patch store with record funded = True end;
|
||||
// store.funded := True;
|
||||
// patch store with record funded = True end;
|
||||
store.funded := True;
|
||||
operations := [Transfer (owner, balance)]
|
||||
end
|
||||
else fail "Below target"
|
||||
|
Loading…
Reference in New Issue
Block a user