EF waves N+35–N+43: lambda captures in 30 files (aph..zz), compileJava green
This commit is contained in:
parent
51b4c3cef2
commit
036d94952c
76 changed files with 2723 additions and 181 deletions
75
tools/waves_n41.py
Normal file
75
tools/waves_n41.py
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
"""Волна N+41: vfbuild73 — 16 EF в ts.java (submitFlakes).
|
||||
Запуск: python3 tools/waves_n41.py"""
|
||||
|
||||
import os, re, sys
|
||||
|
||||
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
p = os.path.join(ROOT, "src/main/java/defpackage/ts.java")
|
||||
L = open(p, encoding="utf-8", errors="replace").read().splitlines()
|
||||
ok = True
|
||||
|
||||
|
||||
def edit(ln, *names):
|
||||
global ok
|
||||
i = ln - 1
|
||||
new = L[i]
|
||||
for name in names:
|
||||
new = re.sub(rf"\b{name}\b", name + "f", new)
|
||||
if new != L[i]:
|
||||
L[i] = new
|
||||
else:
|
||||
ok = False
|
||||
print(f"MISS {ln}: none of {names} in {L[i].strip()[:90]!r}")
|
||||
|
||||
|
||||
def insert_before(ln, anchor_prev, anchor_next, decls):
|
||||
global ok
|
||||
ip = ln - 1
|
||||
prev_ok = anchor_prev in L[ip - 1]
|
||||
next_ok = anchor_next in L[ip]
|
||||
done = decls[0] in "\n".join(L[max(0, ip - 12) : ip + 8])
|
||||
if prev_ok and next_ok and not done:
|
||||
line = L[ip]
|
||||
indent = line[: len(line) - len(line.lstrip())]
|
||||
L[ip:ip] = [indent + d for d in decls]
|
||||
elif done:
|
||||
pass
|
||||
else:
|
||||
ok = False
|
||||
print(
|
||||
f"INSERT-MISS {ln}: prev={L[ip - 1].strip()[:70]!r} next={L[ip].strip()[:70]!r}"
|
||||
)
|
||||
|
||||
|
||||
# edits first (descending)
|
||||
edit(1226, "var7")
|
||||
edit(1222, "var6")
|
||||
edit(1212, "var10", "var11", "var12")
|
||||
edit(1180, "var13", "var14")
|
||||
edit(1179, "var13", "var15")
|
||||
edit(1178, "var14", "var15")
|
||||
edit(1155, "var16")
|
||||
edit(1125, "var15")
|
||||
edit(1124, "var14")
|
||||
edit(1123, "var13")
|
||||
|
||||
insert_before(
|
||||
1069,
|
||||
"var16 = this.flakeCount;",
|
||||
"var1.submitCustomGeometry(var2, arj.positionColorDepthNoWrite(), (var12x, var13x) -> {",
|
||||
[
|
||||
"final float var6f = var6;",
|
||||
"final float var7f = var7;",
|
||||
"final float var10f = var10;",
|
||||
"final float var11f = var11;",
|
||||
"final float var12f = var12;",
|
||||
"final float var13f = var13;",
|
||||
"final float var14f = var14;",
|
||||
"final float var15f = var15;",
|
||||
"final int var16f = var16;",
|
||||
],
|
||||
)
|
||||
|
||||
open(p, "w", encoding="utf-8").write("\n".join(L) + "\n")
|
||||
print("OK" if ok else "PROBLEMS")
|
||||
sys.exit(0 if ok else 1)
|
||||
Loading…
Add table
Add a link
Reference in a new issue