From 89203c028ba837d288eae4669ed91c1f51066399 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szikszai=20Guszt=C3=A1v?= Date: Tue, 3 Dec 2024 09:51:07 +0100 Subject: [PATCH] Fix parsing of parenthesized expression and inline function. (#718) --- spec/examples/argument | 7 ++++++- src/parsers/base_expression.cr | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/spec/examples/argument b/spec/examples/argument index bee518528..aee4d7027 100644 --- a/spec/examples/argument +++ b/spec/examples/argument @@ -48,4 +48,9 @@ component Main { test() } } - +------------------------------------------------------------------------------- +component Main { + fun render : String { + (value: String) { value }("") + } +} diff --git a/src/parsers/base_expression.cr b/src/parsers/base_expression.cr index 60f5130c8..9742a853f 100644 --- a/src/parsers/base_expression.cr +++ b/src/parsers/base_expression.cr @@ -10,7 +10,8 @@ module Mint left = case char when '(' - parenthesized_expression || inline_function + # TODO: Remove `oneof` when `:` deprecation ends. + oneof { parenthesized_expression || inline_function } when '-', .ascii_number? state_setter || number_literal || unary_minus when '!'