diff --git a/AGENTS.md b/AGENTS.md index 7b1e69a96..36bcd7d4a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -83,7 +83,7 @@ Two incompatible generic systems coexist. The syntax of the type parameter picks * **All existing tests must continue to pass.** The authoritative behavior is defined by the existing test suite. * **Test-driven**: new behavior requires tests showing failure before the change and success after, in the existing test style. Bug fixes start with a failing repro. * **Minimal, well-scoped edits**: small local patches; no large refactors (renames, structural moves, mass rewrites), no altered language semantics without tests demonstrating the intended outcome, no new external dependencies unless requested. -* **Generated code**: never modify files generated by `:gen`; change the `.parseq` specs or grammars and regenerate (`./gradlew :gen`). Adding a node type to a `.parseq` sum type breaks every exhaustive matcher at compile time — fix those compile errors first. Visitors with defaults, `instanceof` chains and `default` switch arms do not break, so also grep for the sibling node types. +* **Generated code**: never modify files generated by `:gen`; change the `.parseq` specs or grammars and regenerate (`./gradlew :gen`). Adding a node type to a `.parseq` sum type breaks every exhaustive matcher at compile time; fix those compile errors first. Visitors with defaults, `instanceof` chains and `default` switch arms do not break, so also grep for the sibling node types. --- @@ -323,7 +323,7 @@ Rules for backend work: ### Reference semantics for arithmetic * Integer/real division and modulo semantics are centralized: `WurstOperator.moduloInteger` is Blizzard.j's ModuloInteger (truncated remainder, plus divisor if negative), `WurstOperator.moduloReal` is ModuloReal's formula itself (`a - R2I(a / b) * b` in float, plus divisor if negative, not the exact remainder), and Jass `div` truncates toward zero. -* The Lua helpers (`__wurst_intDiv`, `__wurst_modInt`, `__wurst_modReal`, built in `LuaNativeLowering`), the interpreter's `MathProvider` mocks, and constant folding (`SimpleRewrites`) must all stay consistent with those helpers — never reimplement div/mod locally. A real modulo on Lua is Blizzard.j's `ModuloReal` formula, as on Jass, never `math.fmod` or Lua's float `%`, which differ from Jass in the game ([`docs/WC3_RUNTIME.md`](docs/WC3_RUNTIME.md) "Numbers"). +* The Lua helpers (`__wurst_intDiv`, `__wurst_modInt`, `__wurst_modReal`, built in `LuaNativeLowering`), the interpreter's `MathProvider` mocks, and constant folding (`SimpleRewrites`) must all stay consistent with those helpers; never reimplement div/mod locally. A real modulo on Lua is Blizzard.j's `ModuloReal` formula, as on Jass, never `math.fmod` or Lua's float `%`, which differ from Jass in the game ([`docs/WC3_RUNTIME.md`](docs/WC3_RUNTIME.md) "Numbers"). * Jass `==` on reals allows a difference of 0.001 (`WurstOperator.jassRealEquals`), while `!=` and the orderings are exact, so on the Jass target `not (a == b)` is not `a != b` for reals. Lua compares exactly, by design: the tolerance would cost every real comparison. Both interpreters use that helper; the optimiser must not swap one for the other or fold nearly equal reals on Jass. * The game reads Jass real literals inexactly and computes Lua reals with a 24-bit mantissa (measurements: [`docs/WC3_RUNTIME.md`](docs/WC3_RUNTIME.md) "Numbers"). So on both targets real folding (`SimpleRewrites.foldRealExactly`) reads and writes only exact literals and folds an operation only when its exact result is one. Never fold in double or float, and never treat one `R2I` result as proof of a precision. The test runtime's Lua computes in double, so a test that runs the emitted Lua does not show the game's rounding. diff --git a/BACKLOG.md b/BACKLOG.md index 56c2e3d35..a9cdb9a22 100644 --- a/BACKLOG.md +++ b/BACKLOG.md @@ -26,8 +26,8 @@ Notes; finished-work narrative does not. save first, or refuse unsaved files, is open. - **Reuse translation work on unchanged map runs.** After checked-model reuse, Survival Chaos Reborn - takes 4.5–5.2 s for an unoptimised warm RunMap: AST→IM 1.3–1.4 s, required Jass lowering 1.3–1.7 s, - compile-time work 0.9–1.0 s, map injection 0.4–0.6 s. Whole-project typechecking is now skipped. + takes 4.5 to 5.2 s for an unoptimised warm RunMap: AST→IM 1.3 to 1.4 s, required Jass lowering 1.3 to 1.7 s, + compile-time work 0.9 to 1.0 s, map injection 0.4 to 0.6 s. Whole-project typechecking is now skipped. Investigate retaining a pristine IM snapshot keyed by model/config/target state, then copying it before mutable compile-time/backend passes; compare snapshot cost with translation and test edits, configuration changes, cancellation and both targets against fresh builds. This needs an explicit diff --git a/CHANGELOG.md b/CHANGELOG.md index cd7781e68..fb322bc0f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -240,12 +240,12 @@ from inside a constructor. A generic object stays erased there and only the paths needing a concrete type are specialised, so the concrete type has to reach those paths rather than the object: a specialised method is bound to the class its objects are allocated from, a call which names its target - — `super.m()` is one — takes the instantiation from the class its receiver is used as, and a function + (such as `super.m()`) takes the instantiation from the class its receiver is used as, and a function of a generic class is matched against that class's type variables rather than being read as having none of its own. A specialisation nothing allocates is no longer emitted at all. One shape remains unsupported on Lua: a method combining its own type parameters with those of the - generic class owning it, though it is no longer rejected outright — the arity check it tripped over + generic class owning it, though it is no longer rejected outright: the arity check it tripped over counted the class's type arguments against a call that had only supplied the method's. - Added new pseudo-natives for debugging memory leaks: diff --git a/de.peeeq.wurstscript/build.gradle b/de.peeeq.wurstscript/build.gradle index 04e1f239c..7b0bb251c 100644 --- a/de.peeeq.wurstscript/build.gradle +++ b/de.peeeq.wurstscript/build.gradle @@ -299,7 +299,7 @@ tasks.named('compileJava') { it.dependsOn('gen') } * Cores decide how much parallelism is useful; memory decides how much is survivable. Each worker * is a JVM with the heap set below, and the Gradle daemon holds its own on top, so a machine with * many cores and little memory has to be counted the other way. Measured on eight cores: serial - * 13m11s, four forks 8m39s, eight forks 7m03s — more forks kept winning even though each test runs + * 13m11s, four forks 8m39s, eight forks 7m03s; more forks kept winning even though each test runs * slower under the contention, so this errs towards cores where memory allows. */ int testForkCount() { diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/ErrorReportingIO.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/ErrorReportingIO.java index 1bcce93b9..12ee66126 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/ErrorReportingIO.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/ErrorReportingIO.java @@ -137,7 +137,6 @@ public boolean sendErrorReport(Throwable t, String sourcecode) { wr.writeBytes(data); wr.flush(); wr.close(); -// String output = CharStreams.toString(new InputStreamReader(connection.getInputStream())); // Get response data. InputStream input = connection.getInputStream(); diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/WurstCompilerJassImpl.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/WurstCompilerJassImpl.java index 277d5acc1..134397d23 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/WurstCompilerJassImpl.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/WurstCompilerJassImpl.java @@ -492,12 +492,6 @@ public JassProg transformProgToJass() { timeTaker.endPhase(); - if (runArgs.isNoDebugMessages()) { - beginPhase(3, "remove debug messages"); - DebugMessageRemover.removeDebugMessages(imProg2); - timeTaker.endPhase(); - } - imTranslator2.assertProperties(); ImOptimizer optimizer = new ImOptimizer(timeTaker, imTranslator2); @@ -1003,17 +997,10 @@ public LuaCompilationUnit transformProgToLua() { LuaNativeLowering.lowerKeyedTables(imProg, getImTranslator()); timeTaker.endPhase(); - if (runArgs.isNoDebugMessages()) { - beginPhase(3, "remove debug messages"); - DebugMessageRemover.removeDebugMessages(imProg); + if (!runArgs.isNoDebugMessages() && runArgs.isIncludeStacktraces()) { + beginPhase(4, "add stack traces"); + new StackTraceInjector2(imProg, imTranslator).transform(timeTaker); timeTaker.endPhase(); - } else { - // debug: add stacktraces - if (runArgs.isIncludeStacktraces()) { - beginPhase(4, "add stack traces"); - new StackTraceInjector2(imProg, imTranslator).transform(timeTaker); - timeTaker.endPhase(); - } } // Same position as on Jass: after stack traces, before lowering and inlining. Calls with a // static argument count go to fixed-arity copies, so the emitted Lua packs no table and the diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/gui/WurstErrorWindow.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/gui/WurstErrorWindow.java index 09b4ac678..0659065c6 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/gui/WurstErrorWindow.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/gui/WurstErrorWindow.java @@ -44,7 +44,6 @@ public class WurstErrorWindow extends javax.swing.JFrame { private javax.swing.JLabel currentStatus; private javax.swing.JTextArea errorDetailsPanel; private DefaultListModel errorListModel; - // private javax.swing.JList errorList; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JScrollPane jScrollPane2; private javax.swing.JScrollPane jScrollPane3; diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/intermediateLang/interpreter/CompiletimeNatives.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/intermediateLang/interpreter/CompiletimeNatives.java index 8fa283689..6096670bb 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/intermediateLang/interpreter/CompiletimeNatives.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/intermediateLang/interpreter/CompiletimeNatives.java @@ -260,7 +260,7 @@ public ILconstInt sqlite_prepare(ILconstInt connection, ILconstString query) { * re-executes it. Called after a parameter is (re)bound: without this, binding new * values after a step (but before a sqlite_reset) would be silently ignored and the * new values never queried/written. Note this also closes any open result set, so a - * column must be read before the next bind — the contract is bind, step, read, then + * column must be read before the next bind; the contract is bind, step, read, then * (re)bind and step again. */ private void markStatementForReexecution(int handle) { @@ -345,7 +345,7 @@ public ILconstInt sqlite_column_count(ILconstInt statement) { // Column indices are 0-based, mirroring the SQLite C API (sqlite3_column_*); the +1 // converts to JDBC's 1-based ResultSet indexing. Note this asymmetry with the 1-based - // bind indices above — both match the C API. + // bind indices above; both match the C API. public ILconstInt sqlite_column_int(ILconstInt statement, ILconstInt index) { ResultSet rs = sqliteResultSets.get(statement.getVal()); if (rs == null) throw new InterpreterException("No result set for statement handle: " + statement.getVal()); @@ -411,7 +411,7 @@ public void sqlite_clear_bindings(ILconstInt statement) { try { stmt.clearParameters(); // Clearing bindings mutates the parameters (all become NULL), so it must - // invalidate any prior execution just like sqlite_bind_* — otherwise a + // invalidate any prior execution just like sqlite_bind_*; otherwise a // step after clearing on an already-executed statement would return false // and silently skip re-running with the now-NULL parameters. markStatementForReexecution(statement.getVal()); @@ -439,7 +439,7 @@ public void sqlite_close(ILconstInt connection) { if (conn == null) throw new InterpreterException("Invalid SQLite connection handle: " + connection.getVal()); // Finalize every statement belonging to this connection, then always close the // connection itself. A failure finalizing one statement must not abort the loop or - // skip conn.close() — otherwise the connection (already removed from the map above) + // skip conn.close(); otherwise the connection (already removed from the map above) // would leak permanently, unreachable even by closeAllSqliteResources(). List errors = new ArrayList<>(); for (int statement : sqliteStatementConnections.entrySet().stream() diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/intermediateLang/interpreter/ProgramStateIO.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/intermediateLang/interpreter/ProgramStateIO.java index 55d133e67..9de9cee80 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/intermediateLang/interpreter/ProgramStateIO.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/intermediateLang/interpreter/ProgramStateIO.java @@ -688,7 +688,7 @@ private static boolean tryExportWithWrapper(Appendable out, ObjectFileType fileT } out.append(formatWrapperValue(m, info)).append(")\n"); } else { - // No wrapper method for this field — emit as a commented raw call so the + // No wrapper method for this field; emit as a commented raw call so the // user can see what needs to be handled and add it manually. out.append("\t// TODO no wrapper: "); appendRawMod(out, m, fileType); @@ -716,7 +716,7 @@ private static boolean hasUnsupportedMappedWrapperField(List mod /** * Returns the lookup key used to match a mod to a {@link StdlibObjectMappings.FieldMethodInfo}. * Uses the mod's actual dataPtr when it is an {@link ObjMod.Obj.ExtendedMod}, regardless of - * whether the file type reports {@code usesLevels()} — some types (e.g. buffs) store their + * whether the file type reports {@code usesLevels()}; some types (e.g. buffs) store their * data as extended mods even though the file type flag is false. */ static String fieldKey(ObjMod.Obj.Mod m, ObjectFileType fileType) { diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/jassinterpreter/JassInterpreter.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/jassinterpreter/JassInterpreter.java index b074d2f5c..9093b149e 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/jassinterpreter/JassInterpreter.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/jassinterpreter/JassInterpreter.java @@ -190,40 +190,6 @@ public void case_JassStmtCall(JassStmtCall jassStmtCall) { }); -// if (s instanceof ILif) { -// translateStatementIf(localVarMap, (ILif)s); -// } else if (s instanceof ILsetVar) { -// translateIlcopy( localVarMap, (ILsetVar)s); -// } else if (s instanceof IlsetConst) { -// translateIlsetConst( localVarMap, (IlsetConst)s); -// } else if (s instanceof ILsetBinary) { -// translateIlbinary( localVarMap, (ILsetBinary)s); -// } else if (s instanceof IlsetUnary) { -// translateIlunary(localVarMap, (IlsetUnary) s); -// } else if (s instanceof ILreturn) { -// translateReturn(localVarMap, (ILreturn) s); -// } else if (s instanceof ILloop) { -// translateLoop(localVarMap, (ILloop) s); -// } else if (s instanceof ILexitwhen) { -// translateExitwhen(localVarMap, (ILexitwhen) s); -// } else if (s instanceof ILfunctionCall) { -// translateFunctionCall(localVarMap, (ILfunctionCall) s); -// } else if (s instanceof IlbuildinFunctionCall) { -// translateBuildinFunction(localVarMap, (IlbuildinFunctionCall) s); -// } else if (s instanceof ILsetBinaryCR) { -// translateILsetBinaryCR(localVarMap, (ILsetBinaryCR) s); -// } else if (s instanceof ILsetBinaryCL) { -// translateILsetBinaryCL(localVarMap, (ILsetBinaryCL) s); -// } else if (s instanceof ILarraySetVar) { -// translateILarraySetVar(localVarMap, (ILarraySetVar) s); -// } else if (s instanceof ILsetVarArray) { -// translateILsetVarArray(localVarMap, (ILsetVarArray) s); -// } else if (s instanceof ILerror) { -// throw new InterpreterException("IL execution error: " + lookupVarValue(localVarMap, ((ILerror) s).msg)); -// } else { -// -// throw new InterpreterException("not implemented " + s); -// } } diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/jassinterpreter/ReflectionBasedNativeProvider.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/jassinterpreter/ReflectionBasedNativeProvider.java index 52c7a3b94..5da596b2f 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/jassinterpreter/ReflectionBasedNativeProvider.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/jassinterpreter/ReflectionBasedNativeProvider.java @@ -47,10 +47,6 @@ public ILconst invoke(String funcname, ILconst[] args) throws NoSuchNativeExcept Arrays.stream(args).map(Object::toString).collect(Collectors.joining(", ")) + ")"; msg += "\nwith types " + funcname + "(" + Arrays.stream(args).map(o -> o.getClass().getSimpleName()).collect(Collectors.joining(", ")) + ")"; -// if (candidate != null) { -// msg += "\nDid you mean " + funcname + "(" + -// Arrays.stream(candidate.getParameterTypes()).map(Class::getSimpleName).collect(Collectors.joining(", ")) + ")?"; -// } throw new NoSuchNativeException(msg); } try { diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/jassinterpreter/providers/TriggerProvider.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/jassinterpreter/providers/TriggerProvider.java index 77d4d567e..8c22fdb34 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/jassinterpreter/providers/TriggerProvider.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/jassinterpreter/providers/TriggerProvider.java @@ -41,13 +41,11 @@ public void TriggerRegisterPlayerChatEvent(IlConstHandle trigger, IlConstHandle exactMatchOnly) { TriggerMock triggerMock = (TriggerMock) trigger.getObj(); // TODO -// triggerMock.registerEvent(); } public void TriggerRegisterVariableEvent(IlConstHandle trigger, ILconstString varName, IlConstHandle opcode, ILconstReal limitval) { TriggerMock triggerMock = (TriggerMock) trigger.getObj(); // TODO -// triggerMock.registerEvent(); } public IlConstHandle Condition(ILconstFuncRef code) { diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/languageserver/ModelManagerImpl.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/languageserver/ModelManagerImpl.java index 1ac9ce272..81c3398a8 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/languageserver/ModelManagerImpl.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/languageserver/ModelManagerImpl.java @@ -68,7 +68,6 @@ public void reportBuildDiagnostics(List diagnostics) { private final File projectPath; // dependency project folders discovered in _build/dependencies private final Set dependencies = Sets.newLinkedHashSet(); - // private WurstGui gui = new WurstGuiLogger(); private final List> onCompilationResultListeners = new ArrayList<>(); // compile errors for each file private final Map> parseErrors = new LinkedHashMap<>(); diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/languageserver/requests/GetCompletions.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/languageserver/requests/GetCompletions.java index 748e7cb9e..c4407dae0 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/languageserver/requests/GetCompletions.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/languageserver/requests/GetCompletions.java @@ -1071,7 +1071,6 @@ private CompletionItem makeFunctionCompletion(FuncLink f) { completion.setSortText(ratingToString(rating)); completionTypes.put(completion, f.getReturnType()); // TODO use call signature instead for generics -// completion.set if (!isBeforeParenthesis()) { addParamSnippet(replacementString, f, completion); @@ -1148,9 +1147,6 @@ private String getFunctionDescriptionShort(FunctionDefinition f) { private CompletionItem makeConstructorCompletion(ClassDef c, ConstructorDef constr) { String replacementString = c.getName(); -// if (!isBeforeParenthesis()) { -// replacementString += "()"; -// } CompletionItem completion = new CompletionItem(c.getName()); completion.setKind(CompletionItemKind.Constructor); diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/languageserver/requests/MapRequest.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/languageserver/requests/MapRequest.java index 0ab17d7bd..5d3ac7979 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/languageserver/requests/MapRequest.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/languageserver/requests/MapRequest.java @@ -895,7 +895,7 @@ protected File executeBuildMapPipeline(ModelManager modelManager, WurstGui gui, gui.sendProgress("Finalizing map"); try (MpqEditor mpq = MpqEditorFactory.getEditor(Optional.of(outputMapFile))) { if (mpq != null) { - // Strip internal Wurst cache files — they are dev-only metadata and should + // Strip internal Wurst cache files; they are dev-only metadata and should // not be present in the distributed map. if (mpq.hasFile("wurst_cache_manifest.txt")) mpq.deleteFile("wurst_cache_manifest.txt"); if (mpq.hasFile("wurst_object_cache.txt")) mpq.deleteFile("wurst_object_cache.txt"); diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/WLoggerDefault.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/WLoggerDefault.java index 3192162b2..b1073583a 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/WLoggerDefault.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/WLoggerDefault.java @@ -46,7 +46,6 @@ public void debug(String format, Object... args) { public void info(String msg) { logger.info(msg); if (System.currentTimeMillis() - startTime > 100) { // Wait 250 mseconds -// System.out.println("Info: " + msg); } } diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/attributes/AttrFunctionSignature.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/attributes/AttrFunctionSignature.java index 4bde14efb..04e45fbf3 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/attributes/AttrFunctionSignature.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/attributes/AttrFunctionSignature.java @@ -35,7 +35,6 @@ public static FunctionSignature calculate(StmtCall fc) { // ---- DEBUG: what did we pick, and what did we bind? ---- if (fc instanceof FunctionCall) { WLogger.trace(() -> "[IMPLCONV] call=" + name(fc) + " args=" + at); -// WLogger.trace("[IMPLCONV] pickedSig=" + sig); WLogger.trace(() -> "[IMPLCONV] mapping=" + sig.getMapping() + " unbound=" + sig.getMapping().printUnboundTypeVars()); if (fc instanceof ExprMemberMethodDot emmd) { diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/attributes/AttrTypeExprType.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/attributes/AttrTypeExprType.java index 11ef9e891..cf89b390b 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/attributes/AttrTypeExprType.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/attributes/AttrTypeExprType.java @@ -32,25 +32,6 @@ public static WurstType calculate(TypeExprThis node) { scope = node; } return AttrExprType.caclulateThistype(scope, false, "thistype"); -// ClassOrModule n = node.attrNearestClassOrModule(); -// if (n == null) { -// node.addError("'thistype' can only be used in classes and modules."); -// return WurstTypeUnknown.instance(); -// } -// return n.match(new ClassOrModule.Matcher() { -// -// @Override -// public WurstType case_ClassDef(ClassDef classDef) { -// WurstTypeClass t = (WurstTypeClass) classDef.attrTyp(); -// t.gett -// } -// -// @Override -// public WurstType case_ModuleDef(ModuleDef moduleDef) { -// return new WurstTypeModule(moduleDef, true); -// } -// -// }); } public static WurstType calculate(NoTypeExpr optType) { diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/attributes/AttrVarDefType.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/attributes/AttrVarDefType.java index d360f7058..f72be91a8 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/attributes/AttrVarDefType.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/attributes/AttrVarDefType.java @@ -38,8 +38,6 @@ public static WurstType calculate(WShortParameter p) { // we have to look up the expected type of the lambda ExprClosure parentClosure = (ExprClosure) p.getParent().getParent(); int paramIndex = parentClosure.getShortParameters().indexOf(p); -// WurstType expectedTyp = parentClosure.attrExpectedTypRaw(); -// return WurstTypeInfer.instance(); WurstType expectedTyp = parentClosure.attrExpectedTyp(); return getParameterTypeFromClosureType(p, paramIndex, expectedTyp, true); } diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/attributes/ErrorHandler.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/attributes/ErrorHandler.java index f89fb7c70..1927998e7 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/attributes/ErrorHandler.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/attributes/ErrorHandler.java @@ -19,7 +19,7 @@ public class ErrorHandler { private final WurstGui gui; private boolean unitTestMode = false; - /** Write intermediate IM debug files during tests. Off by default — only tests that + /** Write intermediate IM debug files during tests. Off by default; only tests that * explicitly assert on IM output (e.g. DeterministicChecks) should set this to true. */ public static boolean outputTestSource = false; diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/attributes/Flow.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/attributes/Flow.java index e1adc7a03..de1e52183 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/attributes/Flow.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/attributes/Flow.java @@ -223,11 +223,6 @@ public static List getAfterBody(LoopStatement loop) { r.add(loop); // ... or after the loop -// int index = loop.attrListIndex(); -// WStatements parent = (WStatements) loop.getParent(); -// if (index + 1 < parent.size()) { -// r.add(parent.get(index+1)); -// } r.addAll(getFollowingStatements(loop)); return r; } diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/attributes/ImplicitFuncs.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/attributes/ImplicitFuncs.java index c582e2b70..5d46bdbe0 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/attributes/ImplicitFuncs.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/attributes/ImplicitFuncs.java @@ -57,17 +57,6 @@ private static Collection findFunc(Element e, String funcName) { return e.lookupFuncs(funcName, false); } -// private static Collection findFunc(Element e, String funcName) { -// // we only look at functions defined on the global level -// while (e != null && !(e instanceof WPackage)) { -// e = e.getParent(); -// } -// if (e == null) { -// return Collections.emptyList(); -// } -// WEntities entities = ((WPackage) e).getElements(); -// return entities.lookupFuncs(funcName, false); -// } } diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/attributes/ReadVariables.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/attributes/ReadVariables.java index 7dfeb3894..50b2b20ce 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/attributes/ReadVariables.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/attributes/ReadVariables.java @@ -127,7 +127,6 @@ public static ImmutableList calculate(ExprClosure e) { public static ImmutableList calculate(ExprStatementsBlock e) { // TODO not sure what to do here return generic(e); -// return ImmutableList.emptyList(); } public static ImmutableList calculate(ExprDestroy e) { diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/attributes/names/FuncLink.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/attributes/names/FuncLink.java index 62bd61d9b..bc69a2fab 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/attributes/names/FuncLink.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/attributes/names/FuncLink.java @@ -185,7 +185,7 @@ public FuncLink withTypeArgBinding(Element context, VariableBinding binding) { WurstType newReceiverType = adjustType(context, getReceiverType(), binding); changed = changed || newReceiverType != getReceiverType(); // Also check if any type params are being bound (even if types don't - // change structurally — e.g., T bound to itself within a generic module) + // change structurally, e.g., T bound to itself within a generic module) if (!changed) { for (TypeParamDef tp : getTypeParams()) { if (binding.contains(tp)) { diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/attributes/names/TypeNameLinks.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/attributes/names/TypeNameLinks.java index 9e5c9a1cc..f25150470 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/attributes/names/TypeNameLinks.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/attributes/names/TypeNameLinks.java @@ -28,7 +28,6 @@ public static ImmutableMultimap calculate(CompilationUnit cu) ImmutableMultimap.Builder result = ImmutableSetMultimap.builder(); addJassTypes(result, cu); // TODO are packages types? -// addPackages(result, cu); return result.build(); } @@ -148,11 +147,6 @@ private static void addJassTypes(ImmutableMultimap.Builder res } } -// private static void addPackages(ImmutableMultimap.Builder result, CompilationUnit cu) { -// for (WPackage p : cu.getPackages()) { -// result.put(p.getName(), TypeLink.create(p, cu)); -// } -// } public static ImmutableMultimap calculate(ExprClosure exprClosure) { return ImmutableMultimap.of(); diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/frotty/jassAttributes/JassProgsAttr.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/frotty/jassAttributes/JassProgsAttr.java index 9a736b977..232ddce12 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/frotty/jassAttributes/JassProgsAttr.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/frotty/jassAttributes/JassProgsAttr.java @@ -39,17 +39,14 @@ public static JassFunction getFunction(JassProgs jassProgsImpl, String name) { } public static JassVar getGlobal(JassProgs jassProgsImpl, String name) { - // TODO Auto-generated method stub return globalsMap.get(name); } public static JassNative getNative(JassProgs jassProgsImpl, String name) { - // TODO Auto-generated method stub return nativesMap.get(name); } public static JassTypeDef getTypeDef(JassProgs jassProgsImpl, String name) { - // TODO Auto-generated method stub return typeDefsMap.get(name); } diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/intermediatelang/interpreter/ILInterpreter.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/intermediatelang/interpreter/ILInterpreter.java index b44317cbc..c89b8ade0 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/intermediatelang/interpreter/ILInterpreter.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/intermediatelang/interpreter/ILInterpreter.java @@ -39,7 +39,6 @@ public ILInterpreter(ImProg prog, WurstGui gui, Optional mapFile, ProgramS this.prog = prog; this.globalState = globalState; globalState.addNativeProvider(new BuiltinFuncs(globalState)); -// globalState.addNativeProvider(new NativeFunctions()); } public ILInterpreter(ImProg prog, WurstGui gui, Optional mapFile, boolean isCompiletime) { diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/intermediatelang/interpreter/LocalState.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/intermediatelang/interpreter/LocalState.java index 2e10bc411..9afbbd174 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/intermediatelang/interpreter/LocalState.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/intermediatelang/interpreter/LocalState.java @@ -96,8 +96,8 @@ public void setTypeArguments(Map typeArguments) { /** * The argument bound to this type variable. *

- * One source type parameter can be represented by several {@code ImTypeVar} nodes — a class and - * its constructor hold separate ones — so fall back to matching by name, as generic elimination + * One source type parameter can be represented by several {@code ImTypeVar} nodes (a class and + * its constructor hold separate ones), so fall back to matching by name, as generic elimination * does. */ public @Nullable ImTypeArgument getTypeArgument(ImTypeVar typeVar) { diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/intermediatelang/interpreter/ProgramState.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/intermediatelang/interpreter/ProgramState.java index ddd1a5f00..e29de06ce 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/intermediatelang/interpreter/ProgramState.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/intermediatelang/interpreter/ProgramState.java @@ -426,7 +426,6 @@ public void pushStackframeWithTypes(ImFunction f, @Nullable ILconstObject receiv WLogger.trace(() -> "pushStackframe " + f + " with receiver " + receiver + " and args " + Arrays.toString(args) + " and typesubst " + frameTypes); -// new Exception().printStackTrace(System.out); stackFrames.push(new ILStackFrame(f, receiver, args, entry, frameTypes)); de.peeeq.wurstscript.jassIm.Element stmt = this.lastStatement; @@ -672,7 +671,6 @@ private Map> typeC } public void popStackframe() { -// new Exception().printStackTrace(System.out); WLogger.trace(() -> "popStackframe " + (stackFrames.isEmpty() ? "empty" : stackFrames.peek().f)); if (!stackFrames.isEmpty()) { stackFrames.pop(); diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/jassprinter/ExprPrinter.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/jassprinter/ExprPrinter.java index 3963fb10a..e56d151fa 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/jassprinter/ExprPrinter.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/jassprinter/ExprPrinter.java @@ -21,9 +21,6 @@ public static void print(JassExprIntVal e, StringBuilder sb, boolean withSpace) String val = String.valueOf(e.getValI()); // Disabled due digitbug -// if(!withSpace) { -// val = intShort(val); -// } sb.append(val); } @@ -122,14 +119,6 @@ public static void print(JassExprUnary e, StringBuilder sb, boolean withSpace) { } -// private static String intShort(String val){ -// int d = Integer.valueOf(val); -// if ( d > 792646 && containsOnlyNumbers(val) ) { -// String s = Integer.toHexString(d).toUpperCase(); -// return "$" + s; -// } -// return String.valueOf(d); -// } } diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/jurst/ExtendedJurstLexer.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/jurst/ExtendedJurstLexer.java index 5da9de680..c41dea88b 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/jurst/ExtendedJurstLexer.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/jurst/ExtendedJurstLexer.java @@ -205,8 +205,6 @@ private void state(State s) { private boolean isWrapChar(int type) { switch (type) { -// case JurstParser.PAREN_LEFT: -// case JurstParser.BRACKET_LEFT: case JurstParser.COMMA: case JurstParser.PLUS: case JurstParser.MULT: diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/parser/antlr/AntlrWurstParseTreeTransformer.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/parser/antlr/AntlrWurstParseTreeTransformer.java index 3daf21260..d637c91ff 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/parser/antlr/AntlrWurstParseTreeTransformer.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/parser/antlr/AntlrWurstParseTreeTransformer.java @@ -1018,9 +1018,6 @@ private OptExpr transformOptionalExpr(ExprContext e) { return Ast.NoExpr(); } Expr r = transformExpr(e); -// if (r instanceof ExprEmpty) { -// return Ast.NoExpr(); -// } return r; } diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/parser/antlr/ExtendedWurstLexer.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/parser/antlr/ExtendedWurstLexer.java index a7fa9f383..a6b570fad 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/parser/antlr/ExtendedWurstLexer.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/parser/antlr/ExtendedWurstLexer.java @@ -216,27 +216,6 @@ private Token nextTokenIntern() { state(State.INIT); return firstNewline; } -// case WRAP_CHAR: -// if (isWrapCharEndLine(token.getType())) { -// return token; -// } else if (token.getType() == WurstParser.NL) { -// firstNewline = token; -// numberOfTabs = 0; -// continue; -// } else if (token.getType() == WurstParser.TAB) { -// numberOfTabs++; -// continue; -// } else { -// state(State.INIT); -// if (numberOfTabs <= indentationLevels.peek()) { -// // when the number of tabs decreases we ignore wrap chars -// handleIndent(numberOfTabs, token.getStartIndex(), token.getStopIndex()); -// nextTokens.add(token); -// return firstNewline; -// } else { -// return token; -// } -// } case BEGIN_LINE: if (isTab(token)) { readTabChar(token); @@ -386,8 +365,6 @@ private void reportError(int line, int charPositionInLine, String msg) { private boolean isWrapChar(int type) { switch (type) { -// case WurstParser.PAREN_LEFT: -// case WurstParser.BRACKET_LEFT: case WurstParser.COMMA: case WurstParser.PLUS: case WurstParser.MULT: @@ -398,7 +375,6 @@ private boolean isWrapChar(int type) { case WurstParser.MOD_REAL: case WurstParser.AND: case WurstParser.OR: -// case WurstParser.ARROW: case WurstParser.QUESTION: case WurstParser.COLON: return true; diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imoptimizer/ImInliner.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imoptimizer/ImInliner.java index 2dfce5ba6..10e2fcfa5 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imoptimizer/ImInliner.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imoptimizer/ImInliner.java @@ -176,7 +176,6 @@ private ImFunction inlineFunctions(ImFunction f, Element parent, int parentI, El && getFuncSize(called) >= LUA_LIVENESS_REFRESH_INLINE_SIZE) { getLuaRegisterBudget(f).refresh(); } -// translator.removeCallRelation(f, called); // XXX is it safe to remove this call relation? changed[0] = true; int newSize = estimateSize(f); funcSizes.put(f, newSize); diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/ClassTranslator.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/ClassTranslator.java index e7ab22780..97f1739dc 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/ClassTranslator.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/ClassTranslator.java @@ -32,7 +32,6 @@ public ClassTranslator(ClassDef classDef, ImTranslator translator) { this.classDef = classDef; this.translator = translator; this.prog = translator.getImProg(); -// initStatements = translator.getInitStatement(classDef); dynamicInits = translator.getDynamicInits(classDef); } @@ -301,7 +300,6 @@ private void translateMethod(FuncDef s, List subClasses) { OverrideUtils.addOverride(translator, s, subClass, subMethod, subM, typeBinding); -// m.getSubMethods().add(translator.getMethodFor(subM)); } } } diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/CyclicFunctionRemover.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/CyclicFunctionRemover.java index 98125003c..6fac8b6a6 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/CyclicFunctionRemover.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/CyclicFunctionRemover.java @@ -129,9 +129,6 @@ private void removeCycle(List funcs, Set funcSet) { // remove the old funcs prog.getFunctions().removeAll(funcs); -// System.out.println("----------------------------------"); -// System.out.println(prog.toString()); -// System.out.println("----------------------------------"); } private void replaceVars(Element e, Map oldToNewVar) { diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/DebugMessageRemover.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/DebugMessageRemover.java deleted file mode 100644 index 5b31e9a36..000000000 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/DebugMessageRemover.java +++ /dev/null @@ -1,18 +0,0 @@ -package de.peeeq.wurstscript.translation.imtranslation; - -import de.peeeq.wurstscript.jassIm.ImProg; - -public class DebugMessageRemover { - - public static void removeDebugMessages(ImProg prog) { - // TODO remove the debug messages -// prog.accept(new ImProg.DefaultVisitor() { -// @Override -// public void visit(ImError e) { -// e.replaceBy(ImTranslator.nullExpr()); -// } -// }); - - } - -} diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/EliminateGenerics.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/EliminateGenerics.java index a018d2b5f..21ba4bee1 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/EliminateGenerics.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/EliminateGenerics.java @@ -117,7 +117,6 @@ public void transform() { dbg(checkDanglingMethodRefs("end")); // TODO fix or remove this check -// assertNoUnspecializedGenericGlobals(); } /** @@ -168,8 +167,8 @@ public boolean hasGenericStatics() { *

* Specialising a method leaves the copy on the specialised class. That is where the object comes * from when a construction on this path was redirected there, and a virtual call finds the slot - * through the object as usual. Otherwise the object stays erased — which is this target's normal - * representation — and is allocated from the class the method was declared on, so the slot the + * through the object as usual. Otherwise the object stays erased (which is this target's normal + * representation) and is allocated from the class the method was declared on, so the slot the * call names resolves to nothing and the call fails at runtime rather than at compile time. *

* Decided from what the program allocates rather than from the shape of the class, because one @@ -556,7 +555,7 @@ private void recordErasedStaticInstantiation(Element site, ImClass owner, * {@code super.m()} is the case that shows why: the call names its target, so there is no receiver * to read type arguments from, and this target never lifts the class's type variables onto the * function, so nothing on the call says which instantiation to specialise for and the erased - * original is reached instead — where the dispatch it contains is dead. The receiver is still the + * original is reached instead, where the dispatch it contains is dead. The receiver is still the * first argument, and the class it is used as gives the same answer the lift gives elsewhere. A * constructor's own body is reached the same way, its {@code this} being that first argument. *

@@ -662,7 +661,7 @@ private void collectGenericNewUse(ImAlloc alloc) { * specialise what they need onto the erased class. A closure has no such call: it is reached * through the interface it implements, which is not generic, so the allocation is the only thing * that knows what the body dispatches on. Widening this beyond that case makes the two - * mechanisms disagree — the object comes from the specialised class while its methods were bound + * mechanisms disagree: the object comes from the specialised class while its methods were bound * to the erased one. */ private boolean isConstructionOnlyInstantiation(ImClass classDef) { diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/EliminateTuples.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/EliminateTuples.java index f108111d5..c7345c3ee 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/EliminateTuples.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/EliminateTuples.java @@ -387,7 +387,6 @@ private static void tryStep(ImFunction f, final ImTranslator translator, Step st String before = f.toString(); try { step.apply(f.getBody(), translator, f); -// translator.assertProperties(Collections.emptySet(), f.getBody()); } catch (Throwable t) { throw new RuntimeException("\n//// Before -----------\n" + before + "\n\n// After -------------------\n" + f, t); diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/ExprTranslation.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/ExprTranslation.java index 01a23e4a4..17e22a578 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/ExprTranslation.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/ExprTranslation.java @@ -169,16 +169,11 @@ private static ImExpr wrapTranslation(Element trace, ImTranslator t, ImExpr tran } } -// System.out.println("CAll " + Utils.prettyPrintWithLine(trace)); -// System.out.println(" actualType = " + actualType.getFullName()); -// System.out.println(" expectedTypRaw = " + expectedTypRaw.getFullName()); if (toIndex != null && fromIndex != null) { -// System.out.println(" --> cancel"); // the two conversions cancel each other out return wrapLua(trace, t, translated, actualType); } else if (fromIndex != null) { -// System.out.println(" --> fromIndex"); // Lua normalises the erased value to an int first, except for the conversions which // answer the same for every value a slot can hold (nil, 0, an index) without it. if (t.isLuaTarget() && !de.peeeq.wurstscript.translation.lua.translation.ExprTranslation @@ -188,7 +183,6 @@ private static ImExpr wrapTranslation(Element trace, ImTranslator t, ImExpr tran // no ensure type necessary here, because the fromIndex function is already type safe return ImFunctionCall(trace, fromIndex, ImTypeArguments(), JassIm.ImExprs(translated), false, CallType.NORMAL); } else if (toIndex != null) { -// System.out.println(" --> toIndex"); return wrapLua(trace, t, ImFunctionCall(trace, toIndex, ImTypeArguments(), JassIm.ImExprs(translated), false, CallType.NORMAL), actualType); } // Preserve Wurst's primitive defaults when an erased generic value is diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/Flatten.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/Flatten.java index 97f40e138..9841b6dd4 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/Flatten.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/Flatten.java @@ -56,7 +56,7 @@ public class Flatten { * Starts temporary names from zero again for a new compilation. *

* The counters are per thread and were never reset, so the name a temporary got depended on how - * many programs had been compiled before it on that thread — the same source emitted {@code + * many programs had been compiled before it on that thread; the same source emitted {@code * temp0} alone and {@code temp70} after other work, which is why generated Jass could not be * compared across runs. They still run on through one compilation, because flattening happens * again after each optimisation and restarting mid-compilation would name two locals of one diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/FuncSkeleton.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/FuncSkeleton.java index 47d36b670..646d80ff9 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/FuncSkeleton.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/FuncSkeleton.java @@ -42,7 +42,6 @@ public static void create(NativeFunc funcDef, ImTranslator translator, ImFunctio } public static void create(TupleDef tupleDef, ImTranslator translator, ImFunction f) { - // TODO Auto-generated method stub throw new Error("not implemented"); } diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/ImTranslator.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/ImTranslator.java index b0036d4cd..a6bc96f67 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/ImTranslator.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/ImTranslator.java @@ -3291,14 +3291,6 @@ private ImFunction makeDefaultErrorFunc() { // TODO divide by zero to crash thread: -// stmts.add(JassAst.JassStmtCall("BJDebugMsg", -// JassAst.JassExprlist(JassAst.JassExprBinary( -// JassAst.JassExprStringVal("|cffFF3A29Wurst Error:|r" + nl), -// JassAst.JassOpPlus(), -// s.getMessage().translate(translator))))); -// // crash thread (divide by zero) -// stmts.add(JassAst.JassStmtCall("I2S", JassAst.JassExprlist(JassAst.JassExprBinary(JassAst.JassExprIntVal("1"), JassAst.JassOpDiv(), Jas -// List flags = Lists.newArrayList(); diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/LuaNativeLowering.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/LuaNativeLowering.java index 0dd6f5752..71ad482d4 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/LuaNativeLowering.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/LuaNativeLowering.java @@ -12,16 +12,16 @@ * *

Three classes of WC3 BJ calls are transformed: *

    - *
  1. GetHandleId – replaced 1:1 by {@code __wurst_GetHandleId}, whose Lua + *
  2. GetHandleId: replaced 1:1 by {@code __wurst_GetHandleId}, whose Lua * implementation uses a stable table counter for selected opaque runtime handle * families only. Enum-like handle families keep native semantics in Lua.
  3. *
  4. Hashtable natives ({@code SaveInteger}, {@code LoadBoolean}, …) and - * context-callback natives ({@code ForForce}, {@code ForGroup}, …) – + * context-callback natives ({@code ForForce}, {@code ForGroup}, …): * replaced 1:1 by their {@code __wurst_} prefixed equivalents, whose Lua * implementations are provided by {@link de.peeeq.wurstscript.translation.lua.translation.LuaNatives}. * The backend prints a hashtable operation where it is called instead, as the table accesses * it stands for, and calls its helper only where it cannot ({@link LuaHashtable}).
  5. - *
  6. All other BJ calls with at least one handle-typed parameter – wrapped + *
  7. All other BJ calls with at least one handle-typed parameter: wrapped * by a generated IM function that first checks each required handle param for * {@code null} and returns the type-appropriate default (0 / 0.0 / false / "" / nil), * then delegates to the original BJ function. This matches Jass behavior, which @@ -65,7 +65,7 @@ public final class LuaNativeLowering { * (eventid, playerevent, …) keep native {@code GetHandleId} semantics. * * When {@code false} (safe default), ALL {@code GetHandleId} calls are shimmed - * unconditionally — this matches the pre-selective-shim behaviour and avoids + * unconditionally; this matches the pre-selective-shim behaviour and avoids * any desync risk while the selective logic is being validated. */ public static final boolean ENABLE_SELECTIVE_GET_HANDLE_ID_SHIMMING = true; @@ -853,7 +853,7 @@ private static ImFunction createNilSafeWrapper(ImFunction bjNative, ImTranslator ImStmts body = JassIm.ImStmts(); // Null-check each required handle param: if param == null then return end - // boolexpr and code params are intentionally skipped — they are optional/nullable + // boolexpr and code params are intentionally skipped because they are optional/nullable // in Jass (e.g. the filter arg of TriggerRegisterPlayerUnitEvent). // A null enum handle is no missing handle: the engine reads it as the handle of id 0, so the // wrapper passes that one on (measured on the 3.0.0 client: GetUnitState(u, null) is the life, diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/NormalizeNames.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/NormalizeNames.java index 4f9dfe615..0a006e8b1 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/NormalizeNames.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/NormalizeNames.java @@ -19,19 +19,10 @@ public class NormalizeNames { */ public static void normalizeNames(ImProg prog) { Multimap superMethods = calculateSuperMethods(prog); -// for (ImVar g : prog.getGlobals()) { -// normalizeName(g); -// } -// for (ImFunction f : prog.getFunctions()) { -// normalizeName(f); -// } for (ImClass c : prog.getClasses()) { for (ImVar g : c.getFields()) { normalizeName(g); } -// for (ImFunction f : c.getFunctions()) { -// normalizeName(f); -// } for (ImMethod m : c.getMethods()) { Element trace = m.attrTrace(); if (trace instanceof AstElementWithNameId astElementWithNameId) { @@ -50,10 +41,6 @@ public static void normalizeNames(ImProg prog) { } -// Element trace = c.attrTrace(); -// if (trace instanceof AstElementWithNameId) { -// c.setName(((AstElementWithNameId) trace).getNameId().getName()); -// } } } diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/StmtTranslation.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/StmtTranslation.java index d82214686..2f9568f5a 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/StmtTranslation.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/imtranslation/StmtTranslation.java @@ -170,7 +170,7 @@ public static ImStmt translate(StmtForIn forIn, ImTranslator t, ImFunction f) { ImClass imIterClass = t.getClassFor(rtClassDef); iteratorImType = JassIm.ImClassType(imIterClass, iterTypeArgs.copy()); } else { - // fallback – should not happen for a well-formed iterator() + // fallback: should not happen for a well-formed iterator() iteratorImType = retWT.imTranslateType(t); } @@ -522,14 +522,11 @@ public static ImStmt translate(SwitchStmt switchStmt, ImTranslator t, ImFunction throw new CompileError(switchStmt.attrSource(), "No cases in switch?"); } -// WLogger.info("it is a " + switchStmt.getSwitchDefault().getClass()); if (switchStmt.getSwitchDefault() instanceof SwitchDefaultCaseStatements) { -// WLogger.info("indeed it is"); SwitchDefaultCaseStatements dflt = (SwitchDefaultCaseStatements) switchStmt.getSwitchDefault(); lastIf.setElseBlock(ImStmts(t.translateStatements(f, dflt.getStmts()))); } else if (switchStmt.getSwitchDefault() instanceof NoDefaultCase) { -// WLogger.info("wtf?"); } diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/lua/translation/ExprTranslation.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/lua/translation/ExprTranslation.java index 28345fe76..c079e8124 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/lua/translation/ExprTranslation.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/lua/translation/ExprTranslation.java @@ -610,17 +610,17 @@ public static LuaExpr translate(ImRealVal e, LuaTranslator tr) { public static LuaExpr translate(ImStatementExpr e, LuaTranslator tr) { // The statement-expr becomes an immediately-invoked closure. An exitwhen // that targets a loop OUTSIDE the statement-expr would emit 'break' inside - // the closure, which is invalid Lua — fail loudly instead of emitting it. + // the closure, which is invalid Lua; fail loudly instead of emitting it. // (flatten() normally hoists statement-exprs so this should not occur.) e.getStatements().accept(new de.peeeq.wurstscript.jassIm.Element.DefaultVisitor() { @Override public void visit(ImLoop loop) { - // breaks inside a nested loop are fine — do not descend + // breaks inside a nested loop are fine; do not descend } @Override public void visit(ImVarargLoop loop) { - // breaks inside a nested loop are fine — do not descend + // breaks inside a nested loop are fine; do not descend } @Override @@ -690,7 +690,6 @@ public static LuaExpr translateArrayAccessRaw(ImVarArrayAccess e, LuaTranslator } public static LuaExpr translate(ImGetStackTrace e, LuaTranslator tr) { -// return LuaAst.LuaLiteral("debug.traceback()"); return LuaAst.LuaLiteral("\"$Stacktrace$\""); } diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/lua/translation/LuaAssertions.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/lua/translation/LuaAssertions.java index 7bcd4d049..6737f5a68 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/lua/translation/LuaAssertions.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/lua/translation/LuaAssertions.java @@ -337,7 +337,7 @@ private static int skipFunctionDeclarationName(String text, int index) { int pos = skipWhitespace(text, index); if (pos >= length || !isIdentifierStart(text.charAt(pos))) { - // Anonymous function: 'function(' — no name to skip + // Anonymous function: 'function(' has no name to skip return pos; } @@ -411,7 +411,7 @@ private static int skipQuotedString(String text, int index, char quote) { } else if (ch == quote) { return pos + 1; } else if (ch == '\n') { - // Unfinished string literal — treat as ended + // Treat an unfinished string literal as ended return pos; } else { pos++; diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/lua/translation/LuaTranslator.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/lua/translation/LuaTranslator.java index 368032d7a..c2d38c861 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/lua/translation/LuaTranslator.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/translation/lua/translation/LuaTranslator.java @@ -444,7 +444,6 @@ public LuaCompilationUnit translate() { normalizeFieldNames(); -// NormalizeNames.normalizeNames(prog); createObjectManagement(); createInstanceOfFunction(); @@ -717,7 +716,7 @@ private void normalizeFieldNames() { * class. *

    * A specialised class holds a copy of each field, and the accesses reaching either still name the - * original's variable — so the two must end up as one table key. They cannot be normalised + * original's variable, so the two must end up as one table key. They cannot be normalised * independently: the classes need not hold the same methods once unused ones are dropped, and a * specialisation has slots of its own that the original never had. Naming each side around only * its own methods leaves them different; restoring the original's name afterwards puts back @@ -1521,12 +1520,12 @@ private void createMethods(ImClass c, LuaVariable classVar) { } // Slots are assigned in two passes: a slot name that is the (normalized) - // name of a method in a group is a DIRECT claim of that group — call sites + // name of a method in a group is a DIRECT claim of that group; call sites // dispatch through exactly these names. All other slot names (semantic // aliases like ClassName_x, closure/generics bridging aliases) are DERIVED. // A derived claim may take over a direct slot only when the two methods // have the same runtime arity (that is how overrides of erased generic - // groups are bridged — their full signatures differ in the erased type + // groups are bridged; their full signatures differ in the erased type // parameter positions); otherwise an unrelated method whose name merely // shares an underscore-suffix (my_x(int) vs x()) could steal a real slot. Map slotToImpl = new TreeMap<>(); diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/types/FunctionSignature.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/types/FunctionSignature.java index d0db60273..3fc4b300e 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/types/FunctionSignature.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/types/FunctionSignature.java @@ -85,7 +85,6 @@ public FunctionSignature setTypeArgs(Element context, VariableBinding newMapping public static FunctionSignature forFunctionDefinition(@Nullable FunctionDefinition f) { -// return new FunctionSignature(def.attrReceiverType(), def.attrParameterTypes(), def.attrReturnTyp()); if (f == null) { return FunctionSignature.empty; } @@ -119,7 +118,7 @@ public static FunctionSignature fromNameLink(FuncLink f) { VariableBinding mapping = f.getVariableBinding(); FunctionDefinition def = f.getDef(); // Only add the function's own type params that are still unbound (i.e., still in - // f.getTypeParams() — withTypeArgBinding removes them as they get resolved). + // f.getTypeParams(), withTypeArgBinding removes them as they get resolved). // We must NOT add enclosing structure (module/class) type params, which would // appear as spurious unbound inference variables. if (def instanceof AstElementWithTypeParameters astElementWithTypeParameters) { diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/types/TypesHelper.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/types/TypesHelper.java index 4b7d1f563..ed1dc2825 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/types/TypesHelper.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/types/TypesHelper.java @@ -113,49 +113,6 @@ public static ImSimpleType imTrigger() { } -// public static boolean checkTypeArgs(InstanceDef iDef, List classParams, List interfaceParams) { -// if (classParams.size() == 0 && interfaceParams.size() == 0) { -// return true; -// } -// -// Map typeParamBinding = Maps.newLinkedHashMap(); -// -// PscriptTypeClass classType = (PscriptTypeClass) iDef.getClassTyp().attrTyp(); -// int i = 0; -// for (PscriptType classTp : classType.getTypeParameters()) { -// PscriptTypeTypeParam classTp2 = (PscriptTypeTypeParam) classTp; -// TypeParamDef tpDef = classTp2.getDef(); -// typeParamBinding.put(tpDef, classParams.get(i)); -// i++; -// } -// -// ArrayList actualInterfaceTypes = Lists.newArrayList(); -// -// PscriptTypeInterface interfaceType = (PscriptTypeInterface) iDef.getImplementedTyp().attrTyp(); -// for (PscriptType intTp : interfaceType.getTypeParameters()) { -// if (intTp instanceof PscriptTypeTypeParam) { -// PscriptTypeTypeParam intTp2 = (PscriptTypeTypeParam) intTp; -// actualInterfaceTypes.add(typeParamBinding.get(intTp2.getDef())); -// } else { -// actualInterfaceTypes.add(intTp); -// } -// } -// -// if (actualInterfaceTypes.size() != interfaceParams.size()) { -// throw new CompileError(iDef.getSource(), "sizes do not match: " + actualInterfaceTypes.size()+ " != " + interfaceParams.size()); -// } -// -// i = 0; -// for (PscriptType iTp : interfaceParams) { -// if (!iTp.equalsType(actualInterfaceTypes.get(i), iDef)) { -// return false; -// } -// i++; -// } -// -// -// return true; -// } } diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/types/WurstType.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/types/WurstType.java index ff241f784..d7d509c97 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/types/WurstType.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/types/WurstType.java @@ -26,9 +26,6 @@ public final boolean isSubtypeOf(WurstType other, @Nullable Element location) { return matchAgainstSupertype(other, location, VariableBinding.emptyMapping(), RIGHT) != null; } - // public final VariableBinding matchAgainstSupertype(WurstType other, @Nullable Element location) { -// return this.matchAgainstSupertype(other, location, TreeMap.empty(TypeParamOrd.instance())); -// } /** diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/types/WurstTypeArray.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/types/WurstTypeArray.java index 11ddd01a5..9cc95c86e 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/types/WurstTypeArray.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/types/WurstTypeArray.java @@ -99,7 +99,6 @@ VariableBinding matchAgainstSupertypeIntern(WurstType other, @Nullable Element l @Override public String getName() { - // TODO Auto-generated method stub return baseType.getName() + " array(dimensions = " + getDimensions() + ")"; } diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/types/WurstTypeBoundTypeParam.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/types/WurstTypeBoundTypeParam.java index 6318dc027..b8527b47f 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/types/WurstTypeBoundTypeParam.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/types/WurstTypeBoundTypeParam.java @@ -68,7 +68,6 @@ VariableBinding matchAgainstSupertypeIntern(WurstType other, @Nullable Element l @Override public String getName() { return baseType.getName(); -// return "[" + typeParamDef.getName() + ": " + baseType + "]"; } @Override @@ -136,7 +135,6 @@ public boolean isStaticRef() { @Override public boolean isCastableToInt() { return true; // because baseType must always be castable to int - //return baseType.isCastableToInt(); } @Override @@ -163,7 +161,7 @@ private void initIndex() { } if (typeConstraintFunctions == null) { if (!baseType.supportsGenerics()) { - // if type does support generics natively, try to find implicit conversion functions + // If the type does not support generics natively, find implicit conversion functions. fromIndex = ImplicitFuncs.findFromIndexFunc(baseType, context); toIndex = ImplicitFuncs.findToIndexFunc(baseType, context); } else if (baseType instanceof WurstTypeBoundTypeParam bt) { @@ -190,19 +188,6 @@ public WurstTypeBoundTypeParam setTypeArgs(VariableBinding typeParamMapping) { return this.withBaseType(baseType.setTypeArgs(typeParamMapping)); } -// public WurstTypeBoundTypeParam applyBinding(Map binding) { -// if (baseType instanceof WurstTypeTypeParam) { -// WurstTypeTypeParam tp = (WurstTypeTypeParam) baseType; -// if (binding.containsKey(tp.getDef())) { -// return this.withBaseType(binding.get(tp.getDef())); -// } -// } else if (baseType instanceof WurstTypeBoundTypeParam) { -// WurstTypeBoundTypeParam bt = (WurstTypeBoundTypeParam) baseType; -// return this.withBaseType(bt.applyBinding(binding)); -// } -// return this.baseType. -// return this; -// } private WurstTypeBoundTypeParam withBaseType(WurstType t) { if (t == baseType) { diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/types/WurstTypeModuleInstanciation.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/types/WurstTypeModuleInstanciation.java index 52651bbd9..58f97dcda 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/types/WurstTypeModuleInstanciation.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/types/WurstTypeModuleInstanciation.java @@ -63,7 +63,6 @@ boolean isParent(WurstTypeNamedScope n) { if (ns == null) { return false; } - //if (ns == n.getDef()) { if (n.isSubtypeOf(ns.attrTyp(), ns)) { return true; } diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/types/WurstTypeNamedScope.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/types/WurstTypeNamedScope.java index d472231bf..64c1faea1 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/types/WurstTypeNamedScope.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/types/WurstTypeNamedScope.java @@ -167,9 +167,6 @@ public WurstType replaceTypeVarsUsingTypeArgs(TypeExprList typeArgs) { typeParams.add(new WurstTypeBoundTypeParam(tpDef, baseType, typeArg)); } -// List newTypes = node.getTypeArgs().stream() -// .map((TypeExpr te) -> te.attrTyp().dynamic()) -// .collect(Collectors.toList()); return replaceTypeVars(typeParams); } diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/utils/NotNullList.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/utils/NotNullList.java index 3e8da0732..d4a6c9eaf 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/utils/NotNullList.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/utils/NotNullList.java @@ -4,7 +4,7 @@ import java.util.Collection; /** - * a simple linked list which cannot have null elements in it + * An array list that rejects null elements on insertion and replacement. */ public class NotNullList extends ArrayList { private static final long serialVersionUID = -2435064420633050305L; @@ -37,17 +37,6 @@ public boolean addAll(int index, Collection c) { return super.addAll(index, c); } -// @Override -// public void addFirst(T e) { -// if (e == null) throw new IllegalArgumentException("Tried to insert null element"); -// super.addFirst(e); -// } -// -// @Override -// public void addLast(T e) { -// if (e == null) throw new IllegalArgumentException("Tried to insert null element"); -// super.addLast(e); -// } @Override public T set(int index, T element) { diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/validation/GlobalCaches.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/validation/GlobalCaches.java index 720e58f39..eda969802 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/validation/GlobalCaches.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/validation/GlobalCaches.java @@ -11,7 +11,6 @@ import java.util.Set; import java.util.concurrent.atomic.AtomicLong; -// Expose static fields only if you already have them there; otherwise, just clear via dedicated methods. public final class GlobalCaches { // Stats are useful for diagnostics but expensive on very hot cache paths. private static final boolean ENABLE_CACHE_STATS = false; diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/validation/WurstValidator.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/validation/WurstValidator.java index 5ca4836e5..001d36de4 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/validation/WurstValidator.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/validation/WurstValidator.java @@ -203,19 +203,12 @@ private void checkUnusedImports(WPackage p) { collectUsedPackages(used, p.getElements()); - // String usedToStr = - // used.stream().map(Utils::printElement).sorted().collect(Collectors.joining(", - // ")); - // System.out.println("used = " + usedToStr); // contributed packages for each import Map> contributions = new HashMap<>(); for (WImport imp : p.getImports()) { Set contributedPackages = contributedPackages(imp.attrImportedPackage(), used, new HashSet<>()); contributions.put(imp, contributedPackages); - // System.out.println( imp.getPackagename() + " contributes = " + - // contributedPackages.stream().map(Utils::printElement).sorted().collect(Collectors.joining(", - // "))); } // check for imports, which only contribute a subset of some other @@ -906,7 +899,7 @@ private enum GenericFlavor { NEW, LEGACY } } // keep walking if the structure itself has no TPs } - // IMPORTANT: skip function owners entirely — method generics are allowed to mix. + // Skip function owners entirely; method generics are allowed to mix. if (p instanceof FuncDef) { return null; } @@ -2459,14 +2452,6 @@ private ConstructorDef zeroArgumentConstructor(ClassDef classDef) { return null; } - // private void checkParams(Element where, List args, - // FunctionDefinition calledFunc) { - // if (calledFunc == null) { - // return; - // } - // List parameterTypes = calledFunc.attrParameterTypes(); - // checkParams(where, args, parameterTypes); - // } @Deprecated private void checkParams(Element where, String preMsg, List args, FunctionSignature sig) { @@ -3605,12 +3590,6 @@ private void nameDefsMustNotBeNamedAfterJassNativeTypes(NameDef n) { if (p == null) { n.addError("Not in package or global: " + n.getName()); } - // checkIfTypeDefExists(n, p); - // if (p instanceof WPackage) { - // // check global scope - // p = p.getParent().attrNearestPackage(); - // checkIfTypeDefExists(n, p); - // } } /** diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/validation/controlflow/DataflowAnomalyAnalysis.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/validation/controlflow/DataflowAnomalyAnalysis.java index 4cca7b5ca..9bd01c69f 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/validation/controlflow/DataflowAnomalyAnalysis.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/validation/controlflow/DataflowAnomalyAnalysis.java @@ -16,7 +16,6 @@ import java.util.*; import java.util.Map.Entry; -//w(11)->{r(17), r(19)} & w(19)->{r(17), r(19)} & w(22) class VarStates { final ImmutableMap states; final ImmutableSet destroyedParameters; @@ -382,13 +381,6 @@ VarStates calculate(WStatement s, VarStates incoming) { NameDef n = getInitializedVar(s); if (n != null) { -// ImmutableSet unreadWrites = incoming.getUnreadWrites(n); -// for (WStatement wr : unreadWrites) { -// Element parent = s.getParent(); -// if (isNested(wr, parent)) { -//// s.addError("Assigning to " + Utils.printElement(n) + " overrides previous assignment in line " + wr.attrSource().getLine()); -// } -// } if (isLocalVarDef(n)) { LocalVarDef lv = (LocalVarDef) n; return incoming.addWrite(lv, s); diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/validation/controlflow/ForwardExecution.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/validation/controlflow/ForwardExecution.java index 1cb65f948..a3c0b6b9b 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/validation/controlflow/ForwardExecution.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/validation/controlflow/ForwardExecution.java @@ -46,11 +46,9 @@ private void addTodo(WStatement s) { } private void checkStmt(WStatement s) { -// debug("statement " +Utils.printElement(s) +" in line " + s.attrSource().getLine()); T incoming = method.merge(get(s.attrPreviousStatements())); T oldR = currentValues.get(s); T r = method.calculate(s, incoming); -// debug(" from " + method.print(oldR) + " to " + method.print(r)); if (oldR == null || !method.equality(oldR, r)) { // value changed... currentValues.put(s, r); @@ -67,18 +65,11 @@ private Collection get(List previousStatements) { } Collection result = Lists.newArrayList(); for (WStatement s : previousStatements) { -// debug(" prev: " + Utils.printElement(s) +" in line " + s.attrSource().getLine() -// + " " + method.print(currentValues.get(s))); result.add(get(s)); } return result; } -// private void debug(String msg) { -// if (method.debug) { -// WLogger.info(msg); -// } -// } private T get(WStatement s) { diff --git a/de.peeeq.wurstscript/src/main/resources/agent-docs/WURST_LANGUAGE.md b/de.peeeq.wurstscript/src/main/resources/agent-docs/WURST_LANGUAGE.md index e9a6f0ae5..8afbce6e4 100644 --- a/de.peeeq.wurstscript/src/main/resources/agent-docs/WURST_LANGUAGE.md +++ b/de.peeeq.wurstscript/src/main/resources/agent-docs/WURST_LANGUAGE.md @@ -132,7 +132,7 @@ Lambdas used as the Jass `code` type cannot accept parameters or capture locals. ## Classes, interfaces, modules, and tuples -Objects created with `new` generally need `destroy`; tuples are value types and must not be destroyed. Destructors (`ondestroy`) remain explicit for Lua output—Lua garbage collection does not replace Wurst ownership and cleanup. +Objects created with `new` generally need `destroy`; tuples are value types and must not be destroyed. Destructors (`ondestroy`) remain explicit for Lua output: Lua garbage collection does not replace Wurst ownership and cleanup. ```wurst class Missile @@ -266,7 +266,7 @@ A string is a sequence of bytes on both targets, as it is in the game. `.length( "ä".substring(0, 1) // half a character ``` -The standard library's `String` package handles this explicitly — `isCharBoundary` and `isMultibytePartial` — when `ENABLE_MULTIBYTE_SUPPORT` is on, which it is by default. Compiletime code sees the same semantics, so a length computed while building the map is the length the game agrees with. One thing does not carry across: a compiletime expression cannot return half a character, because a generated script has no way to write that byte down. +The standard library's `String` package handles this explicitly (`isCharBoundary` and `isMultibytePartial`) when `ENABLE_MULTIBYTE_SUPPORT` is on, which it is by default. Compiletime code sees the same semantics, so a length computed while building the map is the length the game agrees with. One thing does not carry across: a compiletime expression cannot return half a character, because a generated script has no way to write that byte down. ## Lua and Jass targets diff --git a/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/BugTests.java b/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/BugTests.java index 871fc0484..68372251d 100644 --- a/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/BugTests.java +++ b/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/BugTests.java @@ -1982,7 +1982,7 @@ public void linkedListModule_perClassStatics_andTyping_ok() throws IOException { " d = d.next // type D", "", "init", - " // We don’t rely on runtime behavior here—this test targets typing/name resolution.", + " // We don’t rely on runtime behavior here; this test targets typing/name resolution.", " // If all lines above typecheck and run, we count it as success:", " doSmth()", " testSuccess()" diff --git a/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/DeterminismDiffReportTest.java b/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/DeterminismDiffReportTest.java index 7aaa1dc2d..6e274a5b7 100644 --- a/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/DeterminismDiffReportTest.java +++ b/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/DeterminismDiffReportTest.java @@ -61,7 +61,7 @@ public void aReplacedLineNamesBothVersions() { /** * Two scripts whose lines all match but which are not equal differ in how the lines end. The * caller only asks after finding them unequal, so passing identical strings would test a state - * production never reaches — this passes CRLF against LF, which it can. + * production never reaches; this passes CRLF against LF, which it can. */ @Test public void differingOnlyInLineEndingsSaysSoRatherThanListingEveryLine() { diff --git a/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/DeterministicChecks.java b/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/DeterministicChecks.java index 980e1cdc0..d047ef3cd 100644 --- a/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/DeterministicChecks.java +++ b/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/DeterministicChecks.java @@ -53,7 +53,7 @@ private void run(Runnable example, String name) throws IOException { /** * The same source has to emit the same script whatever was compiled before it. Names of * generated temporaries used to be counted per thread and never reset, so a program compiled - * alone got {@code temp0} and the same program compiled after other work got {@code temp70} — + * alone got {@code temp0} and the same program compiled after other work got {@code temp70}, * which is what made generated Jass impossible to compare across runs. Compiling something * else in between is the part that matters here; two runs on their own would agree either way. * The inlining configuration is the one that emits a temporary for this source. diff --git a/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/ExportToWurstTest.java b/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/ExportToWurstTest.java index ea290db97..7ea8fbc80 100644 --- a/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/ExportToWurstTest.java +++ b/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/ExportToWurstTest.java @@ -18,7 +18,7 @@ import static org.testng.Assert.*; /** - * Tests for {@link ProgramStateIO#exportToWurst} — verifies that the enriched + * Tests for {@link ProgramStateIO#exportToWurst}, verifying that the enriched * wrapper-class output is produced for known types and that the raw fallback is * used when the base ID has no mapping or a field has no wrapper method. */ @@ -98,7 +98,7 @@ private void assertUnitExportCompilesWithFixedUnitObjEditing(String exported) { } // ------------------------------------------------------------------------- - // Ability (w3a) — known base ID + // Ability (w3a), known base ID // ------------------------------------------------------------------------- @Test @@ -307,7 +307,7 @@ public void abilityWithUnmappedFieldEmitsCommentedRawCall() throws IOException { W3A w3a = new W3A(); W3A.Obj obj = w3a.addObj(ObjId.valueOf("A01M"), ObjId.valueOf("Aslo")); addLvlMod(obj, "acdn", ObjMod.ValType.UNREAL, 1, 0, 5.0); // mapped - // "zzzz" is not a real field — has no wrapper method + // "zzzz" is not a real field and has no wrapper method addLvlMod(obj, "zzzz", ObjMod.ValType.INT, 1, 0, 42); String out = export(obj, ObjectFileType.ABILITIES); @@ -504,10 +504,10 @@ public void intFieldWithFixedWrapperEmitsWrapperCallAndCompiles() throws IOExcep @Test public void buildingBaseIdUsesBuildingDefinition() throws IOException { W3U w3u = new W3U(); - // 'hhou' = Human Farm — a stock building (isbldg=1 in unitbalance.slk) + // 'hhou' = Human Farm, a stock building (isbldg=1 in unitbalance.slk) W3U.Obj obj = w3u.addObj(ObjId.valueOf("H002"), ObjId.valueOf("hhou")); addMod(obj, "unam", ObjMod.ValType.STRING, "My Farm"); - addMod(obj, "uubs", ObjMod.ValType.STRING, "HSMA"); // setGroundTexture — building-only + addMod(obj, "uubs", ObjMod.ValType.STRING, "HSMA"); // setGroundTexture, building-only String out = export(obj, ObjectFileType.UNITS); @@ -522,7 +522,7 @@ public void buildingBaseIdUsesBuildingDefinition() throws IOException { @Test public void buildingFieldsResearchesPathingMap() throws IOException { W3U w3u = new W3U(); - // 'hgtw' = Guard Tower — building + // 'hgtw' = Guard Tower, building W3U.Obj obj = w3u.addObj(ObjId.valueOf("H003"), ObjId.valueOf("hgtw")); addMod(obj, "ures", ObjMod.ValType.STRING, ""); // setResearchesAvailable addMod(obj, "upat", ObjMod.ValType.STRING, "PathTextures\\4x4SimpleSolid.tga"); // setPathingMap @@ -542,11 +542,11 @@ public void buildingFieldsResearchesPathingMap() throws IOException { @Test public void heroBaseIdUsesHeroDefinition() throws IOException { W3U w3u = new W3U(); - // 'Hamg' = Archmage — a stock hero + // 'Hamg' = Archmage, a stock hero W3U.Obj obj = w3u.addObj(ObjId.valueOf("H004"), ObjId.valueOf("Hamg")); addMod(obj, "unam", ObjMod.ValType.STRING, "My Archmage"); - addMod(obj, "uint", ObjMod.ValType.INT, 20); // setStartingIntelligence — hero-only - addMod(obj, "upra", ObjMod.ValType.STRING, "INT"); // setPrimaryAttribute — hero-only + addMod(obj, "uint", ObjMod.ValType.INT, 20); // setStartingIntelligence, hero-only + addMod(obj, "upra", ObjMod.ValType.STRING, "INT"); // setPrimaryAttribute, hero-only String out = export(obj, ObjectFileType.UNITS); @@ -565,7 +565,7 @@ public void uppercaseNewIdWithUnitBaseUsesHeroDefinition() throws IOException { // WC3 convention: uppercase new ID = hero unit. W3U.Obj obj = w3u.addObj(ObjId.valueOf("X00O"), ObjId.valueOf("hpea")); addMod(obj, "unam", ObjMod.ValType.STRING, "Custom Hero"); - addMod(obj, "upro", ObjMod.ValType.STRING, "Race Builder"); // setProperNames — hero-only + addMod(obj, "upro", ObjMod.ValType.STRING, "Race Builder"); // setProperNames, hero-only addMod(obj, "upru", ObjMod.ValType.INT, 1); // setProperNamesUsed String out = export(obj, ObjectFileType.UNITS); @@ -625,7 +625,7 @@ public void itemEnumFieldEmitsEnumConstantAndCompiles() throws IOException { } // ------------------------------------------------------------------------- - // Inherited fields — child abilities that inherit specific fields from parent + // Inherited fields, child abilities that inherit specific fields from parent // ------------------------------------------------------------------------- @Test diff --git a/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/ExpressionTests.java b/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/ExpressionTests.java index e92b3c230..35a5039f2 100644 --- a/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/ExpressionTests.java +++ b/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/ExpressionTests.java @@ -490,7 +490,7 @@ private String makeProg(String booleanExpr) { * An integer literal is a proper subtype of both int and real. Addition collapses two of them * to int, so {@code real r = 1} is allowed while {@code real r = 1 + 1} is not; {@code div} and * {@code mod} return the left operand's type instead, so a literal stays assignable to a real - * through them. This pins the asymmetry rather than endorsing it — see backlog item 8. + * through them. This pins the asymmetry rather than endorsing it. */ @Test public void integerDivisionOfLiteralsIsStillAssignableToReal() { diff --git a/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/FastHashMapTests.java b/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/FastHashMapTests.java index a4a5e8825..c87a37989 100644 --- a/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/FastHashMapTests.java +++ b/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/FastHashMapTests.java @@ -161,7 +161,7 @@ private String compiledLua(String testName) throws IOException { /** * A dispatch slot is named after the method it belongs to, and nothing else in the emitted Lua - * records which implementation belongs there — so this is the only place the two can be checked + * records which implementation belongs there, so this is the only place the two can be checked * against each other. Specialisation names every method of one instantiation after the same type * argument, which is exactly when they are easiest to confuse. */ @@ -209,7 +209,7 @@ private static boolean namesMethod(String name, String method) { /** * Capacity is fixed, so the ninth distinct key has nowhere to go: keys 1 to 8 hash to the eight * slots exactly. `slotFor` says so by returning a slot below this instance's section, and every - * entry point has to check that before indexing — otherwise the write goes through the sentinel, + * entry point has to check that before indexing; otherwise the write goes through the sentinel, * the entry is unreachable, and the count says nine. */ @Test @@ -341,7 +341,7 @@ public void twoInstancesOfOneSpecialisation() { /** * The point of bounds over {@code HashMap extends Table}: the requirements are resolved when the * map is specialised, not carried to runtime. This asserts on the least optimised configuration - * on purpose — the cost has to be absent by construction, not removed afterwards by the inliner. + * on purpose; the cost has to be absent by construction, not removed afterwards by the inliner. */ @Test public void emittedCodeCostsNothingExtra() throws IOException { diff --git a/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/LuaBackendAuditTests.java b/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/LuaBackendAuditTests.java index e8d81edb9..0591c65d7 100644 --- a/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/LuaBackendAuditTests.java +++ b/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/LuaBackendAuditTests.java @@ -5155,7 +5155,7 @@ public void dispatchSlotMustNotStompConstructor() throws IOException { * after the last underscore of a method name. A user method containing * an underscore (my_x) therefore produced phantom alias slots * (Base_x, Child_x) that collided with the real dispatch slot of an - * unrelated method named x — and could win the slot, so calls to x() + * unrelated method named x, and could win the slot, so calls to x() * dispatched into my_x(int) with a missing argument. */ @Test @@ -6364,7 +6364,7 @@ private static int countOccurrences(String haystack, String needle) { /** * The wc3shim's GetLocalPlayer used to return a generic enum-handle table * ({handleKind, value}) while the generated Player/GetPlayerId fallbacks - * use {id = x} with their own cache — so GetPlayerId(GetLocalPlayer()) + * use {id = x} with their own cache, so GetPlayerId(GetLocalPlayer()) * returned nil and Player(0) was not identical to GetLocalPlayer(). */ @Test @@ -6430,7 +6430,7 @@ public void luaStdlibGlobalsAreNotClobbered() throws IOException { * Regular class fields are scope-prefixed by the IM translator, but * closure-captured locals become fields with their raw source name, so a * captured local named after a Lua keyword (until, local, ...) used to - * produce {@code obj.until} — a syntax error. + * produce {@code obj.until}, a syntax error. */ @Test public void luaKeywordFieldNamesAreRenamed() throws IOException { diff --git a/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/LuaRunnerTests.java b/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/LuaRunnerTests.java index 11655e5ad..50878bdc4 100644 --- a/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/LuaRunnerTests.java +++ b/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/LuaRunnerTests.java @@ -63,7 +63,7 @@ public void aProgramThatFloodsStdoutStillFinishes() { /** * The same drain with the output arriving as one line rather than many. This checks that it - * finishes, which is what the two cases above check too — it does not observe how much of the + * finishes, which is what the two cases above check too; it does not observe how much of the * line was retained, and would pass against a collector that kept all of it. Keeping a bounded * amount is worth doing regardless, but a program printing a megabyte without a newline is not * something this suite expects, so it is not worth test-only machinery to assert. diff --git a/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/LuaTranslationTests.java b/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/LuaTranslationTests.java index ae60b5805..f367fd909 100644 --- a/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/LuaTranslationTests.java +++ b/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/LuaTranslationTests.java @@ -3598,7 +3598,7 @@ public void stdLibInitUsesXpcallInsteadOfTriggerEvaluateInMain() throws IOExcept " skip" ); String compiled = Files.toString(new File("test-output/lua/LuaTranslationTests_stdLibInitUsesXpcallInsteadOfTriggerEvaluateInMain.lua"), Charsets.UTF_8); - // Package inits use direct xpcall — no WC3 trigger handle overhead + // Package inits use direct xpcall, no WC3 trigger handle overhead assertTrue(compiled.contains("if not xpcall(init_")); // TriggerEvaluate pattern must NOT appear for init functions assertFalse(compiled.contains("if not(TriggerEvaluate(")); @@ -3989,7 +3989,7 @@ public void i2sAbortSentinelNotBrokenByEarlierI2SCallInLua() throws IOException // Regression: ExprTranslation used f.setName("tostring") to rename the shared // LuaFunction for I2S. After the first ordinary I2S(x) call was translated, f.getName() // returned "tostring", so the sentinel check "I2S".equals(f.getName()) silently failed - // for any later I2S(1/0) abort call — leaving actual //0 division in the Lua output. + // for any later I2S(1/0) abort call, leaving actual //0 division in the Lua output. // This test forces a normal I2S call before the abort to expose the mutation bug. test().testLua(true).withStdLib().lines( "package Test", @@ -3997,7 +3997,7 @@ public void i2sAbortSentinelNotBrokenByEarlierI2SCallInLua() throws IOException "import ErrorHandling", "init", " let x = 42", - " print(I2S(x))", // normal I2S call first — used to corrupt the cached LuaFunction + " print(I2S(x))", // normal I2S call first, used to corrupt the cached LuaFunction " error(\"test\")" // triggers I2S(1 div 0) inside ErrorHandling.error() ); String compiled = Files.toString(new File("test-output/lua/LuaTranslationTests_i2sAbortSentinelNotBrokenByEarlierI2SCallInLua.lua"), Charsets.UTF_8); @@ -4309,7 +4309,7 @@ public void getHandleIdAssertionDoesNotFalsePositiveOnDeclarations() { de.peeeq.wurstscript.translation.lua.translation.LuaTranslator .assertNoLeakedGetHandleIdCalls("GetHandleId(x)"); // A function declaration named GetHandleId (e.g. from a class method) must not - // trigger the assertion — only actual calls should. + // trigger the assertion; only actual calls should. de.peeeq.wurstscript.translation.lua.translation.LuaTranslator .assertNoLeakedGetHandleIdCalls("function Foo:GetHandleId(x) return 0 end"); de.peeeq.wurstscript.translation.lua.translation.LuaTranslator diff --git a/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/StdLibOwnTests.java b/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/StdLibOwnTests.java index 08ff47c1e..a326d1e89 100644 --- a/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/StdLibOwnTests.java +++ b/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/StdLibOwnTests.java @@ -18,7 +18,7 @@ *

    * A bump of the pinned version was otherwise only checked for still compiling, which is a weak * signal for a change whose point is behaviour, and a bad one for the parts of the library which - * degrade quietly rather than failing — the multibyte detection in {@code String.wurst} concludes + * degrade quietly rather than failing: the multibyte detection in {@code String.wurst} concludes * the engine has no multibyte characters when it cannot find what it probes for, so a version where * it silently gave up would look exactly like one where it worked. *

    diff --git a/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/TypeClassTests.java b/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/TypeClassTests.java index 8a5392323..75de062ca 100644 --- a/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/TypeClassTests.java +++ b/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/TypeClassTests.java @@ -98,7 +98,7 @@ public void dispatchInsideClosure() { /** * The same closure on Lua, which keeps generics erased and specialises only what it can reach * from a concrete type. A closure is reached through its interface, so no call names the - * instantiation — the construction is the only thing that knows it, and that is what the + * instantiation; the construction is the only thing that knows it, and that is what the * specialisation is now driven from. */ @Test @@ -174,7 +174,7 @@ public void dispatchInsideConstructor() { /** * The same on Lua. A constructor belongs to its class rather than to a generic function of its - * own, so it declares no type variables and specialising it was treated as nothing to do — the + * own, so it declares no type variables and specialising it was treated as nothing to do: the * call's type argument was stripped and the dispatch inside was left with no concrete type. The * argument was on the call all along; what was missing is that a function of a generic class is * matched against the class's type variables, since this target never lifts them onto it. @@ -185,7 +185,7 @@ public void dispatchInsideConstructorLua() { } /** - * The closure has no dispatch of its own — it calls something that does. The gate deciding + * The closure has no dispatch of its own; it calls something that does. The gate deciding * whether a construction is the only place an instantiation is stated has to follow calls to * see that, or this reaches the backend with the bound unresolved. */ @@ -216,7 +216,7 @@ public void dispatchInsideClosureThroughHelperLua() { * Wurst and Lua reserve different words, so a method can be declared {@code repeat} and reach * the backend under that name. A closure adds the name it implements as a dispatch alias * directly, without the uniquing that protects method names, so the alias arrives as a bare - * keyword and is emitted as a table key — {@code expected near 'repeat'} from luac. + * keyword and is emitted as a table key, causing {@code expected near 'repeat'} from luac. */ @Test public void closureImplementingALuaKeywordName() { @@ -266,7 +266,7 @@ public void nestedClosuresInsideBoundedGenericAreRejectedForLua() { /** * A slot of a {@code T array} that was never written reads as the default of whatever T stands * for. The default is computed by a static attribute, which cannot see what T is bound to, so - * it produces a stand-in — and a stand-in compares equal only to another stand-in, which made + * it produces a stand-in, and a stand-in compares equal only to another stand-in, which made * this quietly false on the interpreter while both backends had it right. */ @Test @@ -343,8 +343,8 @@ public void subclassOfBoundedGeneric() { /** * The same program on Lua, where the object stays erased. Both halves of that had to be met: the * specialised method is bound to the class the object is allocated from, so a virtual call finds - * it, and the super call — which names its target and so has no receiver to read type arguments - * from — is rewritten to the copy specialised for the instantiation the subclass extends. + * it, and the super call, which names its target and so has no receiver to read type arguments + * from, is rewritten to the copy specialised for the instantiation the subclass extends. */ @Test public void subclassOfBoundedGenericLua() { @@ -354,8 +354,8 @@ public void subclassOfBoundedGenericLua() { /** * Three receivers of one class reaching the same specialised slot, which the subclass makes * virtual: one built by a specialised generic function, one constructed directly, one a subclass - * instance. The first two stay erased — a specialised function's copy allocates the erased class - * as well — so this says that moving the slot to the class objects come from serves every way of + * instance. The first two stay erased (a specialised function's copy allocates the erased class + * as well), so this says that moving the slot to the class objects come from serves every way of * arriving at it, not only the construction written in place. */ @Test @@ -470,7 +470,7 @@ public void aBoundedMethodParameterMayShareTheClassParameterName() { /** * The same program on Lua, which used to be rejected outright with "Generics should match class - * method type variables" — a method call there carries the class's type arguments followed by the + * method type variables": a method call there carries the class's type arguments followed by the * method's own, and a method declaring parameters of its own was read as already having both. *

    * Running it is the point: both parameters reach one lookup only in this shape, so a version with @@ -487,7 +487,7 @@ public void aBoundedMethodParameterInAGenericClassLua() { /** * A module may carry a bounded type parameter, and a class using it supplies the argument. Using - * a module copies its body into the class, substituting the module's type parameters — and a + * a module copies its body into the class, substituting the module's type parameters, and a * requirement is called on the parameter itself, {@code T.show(x)}, which is a name rather than a * type, so the substitution never reaches it. The instantiation declares the parameter so that * name still resolves. @@ -515,7 +515,7 @@ public void aBoundedMethodParameterInAGenericClassLua() { }; /** - * A module body resolves names in the module's own scope by design — {@code nextScope} sends a + * A module body resolves names in the module's own scope by design: {@code nextScope} sends a * {@code ModuleInstanciation} to {@code attrModuleOrigin()} rather than to the class using it, so * a module cannot capture the names of whoever uses it. The type replacement during expansion * therefore reaches every {@code T} used as a type, and cannot reach the one in {@code T.show(x)} diff --git a/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/Wc3StringHashTest.java b/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/Wc3StringHashTest.java index b4ba2fa09..b1965d099 100644 --- a/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/Wc3StringHashTest.java +++ b/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/Wc3StringHashTest.java @@ -91,7 +91,7 @@ public void everyContinuationByteHashesApart() { /** * The Lua test runtime carries a second implementation of this hash, because a program running * there computes it too. Two transcriptions of one algorithm drift, so this runs the inputs - * through both and compares — asserting the Java side against written-down numbers would stay + * through both and compares; asserting the Java side against written-down numbers would stay * green if only the Lua side changed, which is the case worth catching. */ @Test diff --git a/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/WurstScriptTest.java b/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/WurstScriptTest.java index 2a9b25ba0..455975ccb 100644 --- a/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/WurstScriptTest.java +++ b/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/WurstScriptTest.java @@ -778,7 +778,7 @@ private Thread collectStreamAsync(InputStream stream, StringBuilder out) { /** * Drains {@code stream} into {@code out}, keeping only the first {@link #RETAINED_OUTPUT_LIMIT} - * characters. Reading never stops — that is what blocks the process and deadlocks the run — but + * characters. Reading never stops (that would block the process and deadlock the run), but * a program that loops while printing would fill the heap before the timeout could fire. *

    * Whatever the caller is looking for is recognised here rather than read back out of diff --git a/docs/RUNMAP_PERFORMANCE.md b/docs/RUNMAP_PERFORMANCE.md index 9946c4c2c..4402ef712 100644 --- a/docs/RUNMAP_PERFORMANCE.md +++ b/docs/RUNMAP_PERFORMANCE.md @@ -224,10 +224,10 @@ with identical source/map copies and JVM/JFR settings: | R1 | 8,660 ms | 5,194 ms | 3,613 ms | 0 ms | | R2 | 7,876 ms | 4,520 ms | 3,367 ms | 0 ms | -Warm unchanged requests improve by 40–43%. R0 still needs a complete check after the configured-script +Warm unchanged requests improve by 40 to 43%. R0 still needs a complete check after the configured-script swap. The 100,010-line emitted Jass matches baseline exactly except for the compiler-version header. Logs are `temp/runmap-chaos-baseline-verify.log` and `temp/runmap-chaos-final.log`; the latter's JFR files -are `temp/runmap-chaos-final-{0,1,2}.jfr`. An earlier successful repetition measured 4,641–4,890 ms warm. +are `temp/runmap-chaos-final-{0,1,2}.jfr`. An earlier successful repetition measured 4,641 to 4,890 ms warm. The remaining warm costs are: