Skip to content

Commit

Permalink
Fix errors in lambda expr validation
Browse files Browse the repository at this point in the history
  • Loading branch information
wqferr committed Oct 6, 2021
1 parent a1b4cf9 commit 3ef794c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions functional.lua
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,7 @@ function internal.sanitize_lambda(expr, env)

if expr:find "\n" then
error("Lambda function bodies cannot contain newlines", 2)
elseif expr:find "--" then
elseif expr:find "%-%-" then
error("Lambda function bodies cannot contain comments", 2)
elseif expr:find "%f[%w]function%f[%W]" then
error("Lambda functions cannot define new functions", 2)
Expand All @@ -969,7 +969,7 @@ function internal.sanitize_lambda(expr, env)

local encased_expr = "(" .. expr .. ")"
local s, e = encased_expr:find "%b()"
if s ~= 1 or e ~= #expr then
if s ~= 1 or e ~= #encased_expr then
error("Expression has unbalanced parenthesis: " .. expr, 2)
end

Expand Down

0 comments on commit 3ef794c

Please sign in to comment.