A few small cleanups.

This commit is contained in:
Bob Nystrom
2014-04-19 11:44:51 -07:00
parent 05717e763d
commit 48dab5323d
6 changed files with 16 additions and 16 deletions
-4
View File
@@ -1405,8 +1405,6 @@ static int parameterList(Compiler* compiler, char* name, int* length,
}
while (match(compiler, TOKEN_COMMA));
// Allow a newline before the closing ')'.
ignoreNewlines(compiler);
const char* message = (endToken == TOKEN_RIGHT_PAREN) ?
"Expect ')' after parameters." : "Expect '|' after parameters.";
consume(compiler, endToken, message);
@@ -1443,8 +1441,6 @@ static void methodCall(Compiler* compiler, Code instruction,
}
while (match(compiler, TOKEN_COMMA));
// Allow a newline before the closing ')'.
ignoreNewlines(compiler);
consume(compiler, TOKEN_RIGHT_PAREN, "Expect ')' after arguments.");
}
+4
View File
@@ -8,6 +8,10 @@
// This string literal is generated automatically from io.wren. Do not edit.
static const char* libSource =
"class IO {\n"
" static print {\n"
" IO.writeString_(\"\n\")\n"
" }\n"
"\n"
" static print(obj) {\n"
" IO.writeString_(obj.toString)\n"
" IO.writeString_(\"\n\")\n"
+1
View File
@@ -59,6 +59,7 @@ int wrenSymbolTableFind(SymbolTable* symbols, const char* name, size_t length)
// TODO: O(n). Do something better.
for (int i = 0; i < symbols->count; i++)
{
// TODO: strlen() here is gross. Symbol table should store lengths.
if (strlen(symbols->data[i]) == length &&
strncmp(symbols->data[i], name, length) == 0) return i;
}