diff options
Diffstat (limited to 'src/comp/front')
| -rw-r--r-- | src/comp/front/ast.rs | 11 | ||||
| -rw-r--r-- | src/comp/front/parser.rs | 8 |
2 files changed, 18 insertions, 1 deletions
diff --git a/src/comp/front/ast.rs b/src/comp/front/ast.rs index 756a7ad1..61a7bdc1 100644 --- a/src/comp/front/ast.rs +++ b/src/comp/front/ast.rs @@ -315,6 +315,17 @@ fn index_native_item(native_mod_index index, @native_item it) { } } +fn is_call_expr(@expr e) -> bool { + alt (e.node) { + case (expr_call(_, _, _)) { + ret true; + } + case (_) { + ret false; + } + } +} + // // Local Variables: // mode: rust diff --git a/src/comp/front/parser.rs b/src/comp/front/parser.rs index a1b519ba..ea4cf12c 100644 --- a/src/comp/front/parser.rs +++ b/src/comp/front/parser.rs @@ -1203,7 +1203,13 @@ impure fn parse_stmt(parser p) -> @ast.stmt { case (token.BE) { p.bump(); auto e = parse_expr(p); - ret @spanned(lo, e.span, ast.stmt_be(e)); + // FIXME: Is this the right place for this check? + if /*check*/ (ast.is_call_expr(e)) { + ret @spanned(lo, e.span, ast.stmt_be(e)); + } + else { + p.err("Non-call expression in tail call"); + } } case (token.LET) { |