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