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
71
tools/waves_n36.py
Normal file
71
tools/waves_n36.py
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
"""Волна N+36: vfbuild53 — 4 EF в apq.java (3 сайта). Запуск: python3 tools/waves_n36.py"""
|
||||
|
||||
import os, sys
|
||||
|
||||
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
p = os.path.join(ROOT, "src/main/java/defpackage/apq.java")
|
||||
L = open(p, encoding="utf-8", errors="replace").read().splitlines()
|
||||
ok = True
|
||||
|
||||
|
||||
def edit(ln, old, new):
|
||||
global ok
|
||||
i = ln - 1
|
||||
if i < len(L) and old in L[i]:
|
||||
L[i] = L[i].replace(old, new, 1)
|
||||
elif i < len(L) and new in L[i]:
|
||||
pass
|
||||
else:
|
||||
ok = False
|
||||
print(f"MISS {ln}: {old!r} got {(L[i] if i < len(L) else '<oob>').strip()!r}")
|
||||
|
||||
|
||||
def insert_before(ln, anchor_prev, anchor_next, decl):
|
||||
global ok
|
||||
ip = ln - 1
|
||||
prev_ok = anchor_prev in L[ip - 1]
|
||||
next_ok = anchor_next in L[ip]
|
||||
done = decl in "\n".join(L[max(0, ip - 8) : 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 + decl]
|
||||
elif done:
|
||||
pass
|
||||
else:
|
||||
ok = False
|
||||
print(
|
||||
f"INSERT-MISS {ln}: prev={L[ip - 1].strip()[:60]!r} next={L[ip].strip()[:60]!r}"
|
||||
)
|
||||
|
||||
|
||||
# edits first (descending), then inserts (descending) — line numbers stay valid
|
||||
# site 3 (line 666): addTask lambda captures non-EF var4 (int)
|
||||
edit(666, "var0 - var4, ContainerInput.SWAP", "var0 - var4f, ContainerInput.SWAP")
|
||||
# site 2 (line 536): addTask lambda captures non-EF var3 (Slot)
|
||||
edit(536, "swapAndUse(var3, var1)", "swapAndUse(var3f, var1)")
|
||||
# site 1 (line 344): nested filter lambda captures non-EF var4
|
||||
edit(344, ".equals(var4)", ".equals(var4f)")
|
||||
|
||||
insert_before(
|
||||
666,
|
||||
"case -730314354:",
|
||||
"app.addTask(() -> clickSlot(var1, var0 - var4f,",
|
||||
"final int var4f = var4;",
|
||||
)
|
||||
insert_before(
|
||||
536,
|
||||
"case 1613240963:",
|
||||
"app.addTask(() -> swapAndUse(var3f, var1));",
|
||||
"final Slot var3f = var3;",
|
||||
)
|
||||
insert_before(
|
||||
336,
|
||||
"var4 = var10;",
|
||||
"var5 = StreamSupport",
|
||||
"final MobEffectCategory var4f = var4;",
|
||||
)
|
||||
|
||||
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