commit 74ca44023c2cc9043ba278529ac509cb0b55d590
parent 2901b2952d6868aff2c4661e716b81bd0207e21c
Author: Sebastian <sebastian@sebsite.pw>
Date: Mon, 7 Mar 2022 22:27:18 -0500
ast: update docs for (switch|match)_(case|expr)
Signed-off-by: Sebastian <sebastian@sebsite.pw>
Diffstat:
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/hare/ast/expr.ha b/hare/ast/expr.ha
@@ -295,7 +295,8 @@ export type len_expr = *expr;
// A match case.
//
-// name: type => expr
+// case type => exprs
+// case let name: type => exprs
export type match_case = struct {
name: str,
_type: nullable *_type,
@@ -304,7 +305,7 @@ export type match_case = struct {
// A match expression.
//
-// match (foo) { _: int => bar, ... }
+// match (foo) { case int => bar; ... }
export type match_expr = struct {
value: *expr,
cases: []match_case,
@@ -345,7 +346,7 @@ export type slice_expr = struct {
// A switch case.
//
-// value => expr
+// case value => exprs
export type switch_case = struct {
options: []*expr, // [] for default case
exprs: []*expr,
@@ -353,7 +354,7 @@ export type switch_case = struct {
// A switch expression.
//
-// switch (foo) { bar => baz, ... }
+// switch (foo) { case bar => baz; ... }
export type switch_expr = struct {
value: *expr,
cases: []switch_case,