feat: explicitly disallow non-assigned direct function calls
This commit is contained in:
parent
4631f4370e
commit
e87e61b152
@ -175,7 +175,15 @@ object parser {
|
||||
`<rvalue>`.label("valid initial value for variable")
|
||||
)
|
||||
// TODO: Can we inline the name of the variable in the message
|
||||
| Assign(`<lvalue>` <~ "=", `<rvalue>`)
|
||||
| Assign(
|
||||
`<lvalue>` <~ ("=" | "(".verifiedExplain(
|
||||
"function calls must use the 'call' keyword and the result must be assigned to a variable"
|
||||
)),
|
||||
`<rvalue>`
|
||||
) |
|
||||
("call" ~> `<ident>`).verifiedExplain(
|
||||
"function calls' results must be assigned to a variable"
|
||||
)
|
||||
private lazy val `<lvalue>`: Parsley[LValue] =
|
||||
`<pair-elem>` | `<ident-or-array-elem>`
|
||||
private lazy val `<rvalue>`: Parsley[RValue] =
|
||||
|
Loading…
x
Reference in New Issue
Block a user