diff --git a/js/transpiler/transpiler/analyzer.js b/js/transpiler/transpiler/analyzer.js index 4319e6336..920e175a1 100644 --- a/js/transpiler/transpiler/analyzer.js +++ b/js/transpiler/transpiler/analyzer.js @@ -525,12 +525,9 @@ class SemanticAnalyzer { let stmtIndex = 0; for (const stmt of ast.statements) { if (stmt && stmt.type === 'EventHandler') { - // Each if statement gets a unique key - we want to detect multiple - // assignments within the SAME if block, not across different if - // statements that happen to have the same condition - const handlerKey = stmt.handler === 'ifthen' ? - `ifthen:${stmtIndex}` : - stmt.handler; + // Each handler gets a unique key - we want to detect multiple + // assignments within the SAME handler, not across different handlers + const handlerKey = `${stmt.handler}:${stmtIndex}`; if (!handlerAssignments.has(handlerKey)) { handlerAssignments.set(handlerKey, new Map()); diff --git a/js/transpiler/transpiler/condition_generator.js b/js/transpiler/transpiler/condition_generator.js index 672b39315..e9d39d05f 100644 --- a/js/transpiler/transpiler/condition_generator.js +++ b/js/transpiler/transpiler/condition_generator.js @@ -297,14 +297,14 @@ class ConditionGenerator { return this.generateBinary({ ...condition, operator: '>', - right: constValue - 1 + right: { type: 'Literal', value: constValue - 1 } }, activatorId); } else { // x <= 5 → x < 6 return this.generateBinary({ ...condition, operator: '<', - right: constValue + 1 + right: { type: 'Literal', value: constValue + 1 } }, activatorId); } }