diff options
| author | Tim Chevalier <[email protected]> | 2011-05-04 11:28:13 -0700 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2011-05-05 11:26:07 -0700 |
| commit | e3a68e235cd077c35654f79013ad54da46d72fee (patch) | |
| tree | 7838fc4a8937e2637cf7e3531d9c8e17feaff34b /src/comp/front/ast.rs | |
| parent | Update docs to reflect assert vs. check (diff) | |
| download | rust-e3a68e235cd077c35654f79013ad54da46d72fee.tar.xz rust-e3a68e235cd077c35654f79013ad54da46d72fee.zip | |
Bring back "pred" syntax for writing predicates for check
This commit reinstates the requirement that the predicate in a
"check" must be a manifest call to a special kind of function
declared with the new "pred" keyword instead of "fn". Preds must
have a boolean return type and can only call other preds; they
can't have any effects (as enforced by the typechecker).
The arguments to a predicate in a check expression must be
slot variables or literals.
Diffstat (limited to 'src/comp/front/ast.rs')
| -rw-r--r-- | src/comp/front/ast.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/comp/front/ast.rs b/src/comp/front/ast.rs index cc7569e1..574ebd4a 100644 --- a/src/comp/front/ast.rs +++ b/src/comp/front/ast.rs @@ -346,7 +346,13 @@ type constr = spanned[constr_]; type arg = rec(mode mode, @ty ty, ident ident, def_id id); type fn_decl = rec(vec[arg] inputs, - @ty output); + @ty output, + purity purity); +tag purity { + pure_fn; // declared with "pred" + impure_fn; // declared with "fn" +} + type _fn = rec(fn_decl decl, proto proto, block body); |