Allow empty blocks.
This commit is contained in:
@@ -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);
|
||||
|
||||
+2
-2
@@ -1288,9 +1288,9 @@ void wrenDefineMethod(WrenVM* vm, const char* className,
|
||||
|
||||
double wrenGetArgumentDouble(WrenVM* vm, int index)
|
||||
{
|
||||
ASSERT(vm->nativeCallSlot != NULL, "Must be in foreign call.");
|
||||
ASSERT(vm->foreignCallSlot != NULL, "Must be in foreign call.");
|
||||
ASSERT(index >= 0, "index cannot be negative.");
|
||||
ASSERT(index < vm->nativeCallNumArgs, "Not that many arguments.");
|
||||
ASSERT(index < vm->foreignCallNumArgs, "Not that many arguments.");
|
||||
|
||||
// + 1 to shift past the receiver.
|
||||
// TODO: Check actual value type first.
|
||||
|
||||
Reference in New Issue
Block a user