mirror of
https://github.com/Reuh/anselme.git
synced 2025-10-28 09:09:31 +00:00
Allow no expression in return
This commit is contained in:
parent
53c1c764ba
commit
f574e6a775
5 changed files with 25 additions and 6 deletions
|
|
@ -42,7 +42,6 @@ local function_parameter_maybe_parenthesis = function_parameter_no_default {
|
|||
end
|
||||
}
|
||||
|
||||
|
||||
-- signature type 1: unary prefix
|
||||
-- :$-parameter exp
|
||||
-- returns symbol, parameter_tuple, rem if success
|
||||
|
|
@ -195,7 +194,7 @@ return primary {
|
|||
-- parse expression
|
||||
local right
|
||||
s, right, rem = pcall(expression_to_ast, source, rem, limit_pattern, operator_priority["$_"])
|
||||
if not s then error(("invalid expression after unop %q: %s"):format(self.operator, right), 0) end
|
||||
if not s then error(("invalid expression in function definition: %s"):format(right), 0) end
|
||||
|
||||
-- return function
|
||||
local fn = Function:new(parameters, right):set_source(source_start)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue