Allow empty blocks.

This commit is contained in:
Bob Nystrom
2013-12-29 10:46:21 -08:00
parent a9323376ec
commit c8fe27d6c4
5 changed files with 19 additions and 2 deletions
+3
View File
@@ -1192,6 +1192,9 @@ static void patchJump(Compiler* compiler, int offset)
// Parses a block body, after the initial "{" has been consumed.
static void finishBlock(Compiler* compiler)
{
// Empty blocks do nothing.
if (match(compiler, TOKEN_RIGHT_BRACE)) return;
for (;;)
{
definition(compiler);