diff options
author | Tom Willemse | 2022-08-14 16:13:49 -0700 |
---|---|---|
committer | Tom Willemse | 2022-08-14 16:13:49 -0700 |
commit | e91006b59a143ad0083b3fb303a493f9d97e6c9b (patch) | |
tree | 9a0865ed67a930ffdb1e143f80c69f4c9643874c /clox/src/compiler.c | |
parent | cb42c811218b30ff9ff1a194b18fe3d85ea68a50 (diff) | |
download | crafting-interpreters-e91006b59a143ad0083b3fb303a493f9d97e6c9b.tar.gz crafting-interpreters-e91006b59a143ad0083b3fb303a493f9d97e6c9b.zip |
Apply new formatting
Diffstat (limited to 'clox/src/compiler.c')
-rw-r--r-- | clox/src/compiler.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/clox/src/compiler.c b/clox/src/compiler.c index 4dded64..18ad4a7 100644 --- a/clox/src/compiler.c +++ b/clox/src/compiler.c @@ -208,8 +208,8 @@ static void initCompiler(Compiler *compiler, FunctionType type) { compiler->function = newFunction(); current = compiler; if (type != TYPE_SCRIPT) { - current->function->name = - copyString(parser.previous.start, parser.previous.length); + current->function->name + = copyString(parser.previous.start, parser.previous.length); } Local *local = ¤t->locals[current->localCount++]; @@ -245,8 +245,9 @@ static void beginScope() { current->scopeDepth++; } static void endScope() { current->scopeDepth--; - while (current->localCount > 0 && - current->locals[current->localCount - 1].depth > current->scopeDepth) { + while (current->localCount > 0 + && current->locals[current->localCount - 1].depth + > current->scopeDepth) { if (current->locals[current->localCount - 1].isCaptured) { emitByte(OP_CLOSE_UPVALUE); } else { @@ -399,8 +400,8 @@ static void method() { uint8_t constant = identifierConstant(&parser.previous); FunctionType type = TYPE_METHOD; - if (parser.previous.length == 4 && - memcmp(parser.previous.start, "init", 4) == 0) { + if (parser.previous.length == 4 + && memcmp(parser.previous.start, "init", 4) == 0) { type = TYPE_INITIALIZER; } |