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
62
tools/waves_n37.py
Normal file
62
tools/waves_n37.py
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
"""Волна N+37: vfbuild54 — 4 EF в apt.java (2 метода). Запуск: python3 tools/waves_n37.py"""
|
||||
|
||||
import os, sys
|
||||
|
||||
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
p = os.path.join(ROOT, "src/main/java/defpackage/apt.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, decls):
|
||||
global ok
|
||||
ip = ln - 1
|
||||
prev_ok = anchor_prev in L[ip - 1]
|
||||
next_ok = anchor_next in L[ip]
|
||||
done = decls[0].strip() 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 + d for d in decls]
|
||||
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)
|
||||
edit(560, "distanceToSqr(var2)", "distanceToSqr(var2f)")
|
||||
edit(431, "distanceToSqr(var5)", "distanceToSqr(var5f)")
|
||||
edit(430, "this.isValidPoint(var4, var4x,", "this.isValidPoint(var4f, var4x,")
|
||||
|
||||
insert_before(
|
||||
560,
|
||||
"var2 = mc.player.getEyePosition();",
|
||||
"distanceToSqr(var2f)",
|
||||
["final Vec3 var2f = var2;"],
|
||||
)
|
||||
insert_before(
|
||||
429,
|
||||
"case -446377969:",
|
||||
"return var1.stream()",
|
||||
["final Vec3 var4f = var4;", "final Vec3 var5f = var5;"],
|
||||
)
|
||||
|
||||
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