mindcode icon indicating copy to clipboard operation
mindcode copied to clipboard

Empty functions don't compile

Open cardillan opened this issue 1 year ago • 0 comments

A function that has an empty body won't compile - a syntax error is generated:

def foo(n)
end
foo(0)

Looks like the issue seems to be with the grammar definition. As a workaround, null can be placed into the body, as a function with an empty body would be expected to return null anyways. This compiles:

def foo(n)
    null
end
foo(0)

As there's a workaround, I won't rush a fix. I plan to have a look at the grammar sometime, there's a bunch of things that need attention.

cardillan avatar Jun 20 '23 20:06 cardillan