aboutsummaryrefslogtreecommitdiffstats
path: root/clox/src/compiler.c
diff options
context:
space:
mode:
Diffstat (limited to 'clox/src/compiler.c')
-rw-r--r--clox/src/compiler.c13
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 = &current->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;
}