Skip to content

Commit

Permalink
Merge branch 'lib/exit--change-type-to-u8'
Browse files Browse the repository at this point in the history
* lib/exit--change-type-to-u8:
  readd mistakenly removed pre-conditions.
  lib/exit: change type to u8
  • Loading branch information
maxteufel committed May 13, 2024
2 parents e8c88c5 + ce13159 commit d5b0a4b
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions lib/exit.fz
Expand Up @@ -38,7 +38,7 @@ is

# exit with the given code
#
exit(code i32) => p.exit code
exit(code u8) => p.exit code


# exit with the stored code
Expand All @@ -48,9 +48,8 @@ is

# set the stored exit code, which, by default, is zero
#
set_exit_code(code i32)
pre
0 ≤ code ≤ 127
set_exit_code(code u8)
pre code ≤ 127
=> p.set_exit_code code


Expand All @@ -68,24 +67,24 @@ is

# mutable value of the current exit code set
#
exit_code := 0
exit_code := u8 0


# exit with the given code
#
exit(code i32) =>
fuzion.std.exit code
exit(code u8) =>
fuzion.std.exit code.as_i32


# exit with the stored code
#
exit =>
fuzion.std.exit exit_code
fuzion.std.exit exit_code.as_i32


# set the stored exit code
#
set_exit_code(code i32) outcome unit
set_exit_code(code u8) outcome unit
post then
exit_code = code
=>
Expand All @@ -107,7 +106,7 @@ exit0 =>
# exit with a code argument calls exit.exit code, i.e., it uses the
# current exit effect to exit with the given message.
#
public exit(code i32) => exit0.exit code
public exit(code u8) => exit0.exit code


# exit with the currently stored exit code
Expand All @@ -117,9 +116,8 @@ public exit => exit0.exit

# change the currently stored exit code
#
public set_exit_code(code i32)
pre
0 ≤ code ≤ 127
public set_exit_code(code u8)
pre code ≤ 127
=> exit0.set_exit_code code


Expand All @@ -135,7 +133,7 @@ public Exit_Handler ref is

# exit with the given code
#
public exit(code i32) void => abstract
public exit(code u8) void => abstract


# exit with the stored code
Expand All @@ -145,7 +143,6 @@ public Exit_Handler ref is

# set the stored exit code, which, by default, is zero
#
public set_exit_code(code i32) outcome unit
pre
0 ≤ code ≤ 127
public set_exit_code(code u8) outcome unit
pre code ≤ 127
=> abstract

0 comments on commit d5b0a4b

Please sign in to comment.