From 623e16459fd40ee5ca6da9dcb9587e0b0c2b56fe Mon Sep 17 00:00:00 2001 From: Christian Rinderknecht Date: Wed, 26 Feb 2020 13:36:50 +0100 Subject: [PATCH] Changed Loop.continue to Loop.resume. --- gitlab-pages/docs/language-basics/loops.md | 14 ++++++++------ src/passes/operators/operators.ml | 4 ++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/gitlab-pages/docs/language-basics/loops.md b/gitlab-pages/docs/language-basics/loops.md index 1ded1ef05..ffe27c17e 100644 --- a/gitlab-pages/docs/language-basics/loops.md +++ b/gitlab-pages/docs/language-basics/loops.md @@ -79,12 +79,12 @@ let gcd (x,y : nat * nat) : nat = ``` To ease the writing and reading of the iterated functions (here, -`iter`), two predefined functions are provided: `Loop.continue` and +`iter`), two predefined functions are provided: `Loop.resume` and `Loop.stop`: ```cameligo group=a let iter (x,y : nat * nat) : bool * (nat * nat) = - if y = 0n then Loop.stop (x,y) else Loop.continue (y, x mod y) + if y = 0n then Loop.stop (x,y) else Loop.resume (y, x mod y) let gcd (x,y : nat * nat) : nat = let x,y = if x < y then y,x else x,y in @@ -92,7 +92,8 @@ let gcd (x,y : nat * nat) : nat = in x ``` -> Note that `stop` and `continue` are *deprecated*. +> Note that `stop` and `continue` (now `Loop.resume`) are +> *deprecated*. You can call the function `gcd` defined above using the LIGO compiler like so: @@ -135,12 +136,12 @@ let gcd = ((x,y) : (nat, nat)) : nat => { ``` To ease the writing and reading of the iterated functions (here, -`iter`), two predefined functions are provided: `Loop.continue` and +`iter`), two predefined functions are provided: `Loop.resume` and `Loop.stop`: ```reasonligo group=b let iter = ((x,y) : (nat, nat)) : (bool, (nat, nat)) => - if (y == 0n) { Loop.stop ((x,y)); } else { Loop.continue ((y, x mod y)); }; + if (y == 0n) { Loop.stop ((x,y)); } else { Loop.resume ((y, x mod y)); }; let gcd = ((x,y) : (nat, nat)) : nat => { let (x,y) = if (x < y) { (y,x); } else { (x,y); }; @@ -149,7 +150,8 @@ let gcd = ((x,y) : (nat, nat)) : nat => { }; ``` -> Note that `stop` and `continue` are *deprecated*. +> Note that `stop` and `continue` (now `Loop.resume`) are +> *deprecated*. diff --git a/src/passes/operators/operators.ml b/src/passes/operators/operators.ml index 07a1484c6..7cc7f556d 100644 --- a/src/passes/operators/operators.ml +++ b/src/passes/operators/operators.ml @@ -395,7 +395,7 @@ module Simplify = struct (* Loop module *) | "Loop.fold_while" -> ok C_FOLD_WHILE - | "Loop.continue" -> ok C_CONTINUE + | "Loop.resume" -> ok C_CONTINUE | "continue" -> ok C_CONTINUE (* Deprecated *) | "Loop.stop" -> ok C_STOP | "stop" -> ok C_STOP (* Deprecated *) @@ -404,7 +404,7 @@ module Simplify = struct | "assert" -> ok C_ASSERTION - | _ -> simple_fail "Not a CameLIGO built-in." + | _ -> simple_fail "Not a CameLIGO built-in." let type_constants = type_constants let type_operators = type_operators