Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions js/transpiler/transpiler/analyzer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
4 changes: 2 additions & 2 deletions js/transpiler/transpiler/condition_generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down