Commit 71b7aab4
71b7aab4f0f3Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 2 files · ~2 modified
Description
Apply }-else-on-newline to newer src/ code
Convert the remaining } else (added after the first reformat) to
} newline else in analyze.c and codegen.c. Generated C and hand-
written src/ now both have zero same-line } else.
Co-Authored-By: Claude Opus 4.8 (1M context) [email protected]
Details
- Commit
- 71b7aab4f0f3
- Parent
- f13743747916
src/analyze.cmodifiedView file
@@ -761,17 +761,21 @@
761761
const int *argv = args >= 0 ? nt_arr(nt, args, "arguments", &an) : NULL;762762
if (name && (!strcmp(name, "push") || !strcmp(name, "<<")) && an == 1) {763763
is_push = 1; vt = infer_type(c, argv[0]);764-
} else if (name && !strcmp(name, "[]=") && an == 2) {764+
}765+
else if (name && !strcmp(name, "[]=") && an == 2) {765766
kt = infer_type(c, argv[0]); vt = infer_type(c, argv[1]);766-
} else continue;767-
} else if (!strcmp(ty, "IndexOperatorWriteNode")) {767+
}768+
else continue;769+
}770+
else if (!strcmp(ty, "IndexOperatorWriteNode")) {768771
recv = nt_ref(nt, id, "receiver");769772
int args = nt_ref(nt, id, "arguments");770773
int an = 0;771774
const int *argv = args >= 0 ? nt_arr(nt, args, "arguments", &an) : NULL;772775
if (an != 1) continue;773776
kt = infer_type(c, argv[0]); vt = infer_type(c, nt_ref(nt, id, "value"));774-
} else {777+
}778+
else {775779
continue;776780
}777781
if (recv < 0 || strcmp(nt_type(nt, recv) ? nt_type(nt, recv) : "", "LocalVariableReadNode")) continue;@@ -784,7 +788,8 @@
784788
if (vt == TY_UNKNOWN) continue;785789
if (lv->type != TY_UNKNOWN && !ty_is_array(lv->type)) continue;786790
lv->type = ty_unify(lv->type, ty_array_of(vt));787-
} else if (kt == TY_STRING) {791+
}792+
else if (kt == TY_STRING) {788793
TyKind hv = ty_hash_of(TY_STRING, vt);789794
if (hv == TY_UNKNOWN) continue;790795
if (lv->type != TY_UNKNOWN && !ty_is_hash(lv->type)) continue;@@ -927,7 +932,8 @@
927932
Scope *self = comp_scope_of(c, id);928933
if (self->class_id >= 0) mi = comp_method_in_chain(c, self->class_id, name, NULL);929934
}930-
} else {935+
}936+
else {931937
TyKind rt0 = infer_type(c, recv);932938
if (ty_is_object(rt0)) mi = comp_method_in_chain(c, ty_object_class(rt0), name, NULL);933939
}src/codegen.cmodifiedView file
Loading diff…