Skip to content

Commit

Permalink
[Fix] Preprocessor correctly updates position for text replacement (#…
Browse files Browse the repository at this point in the history
…7303)

Co-authored-by: Martin Valigursky <[email protected]>
  • Loading branch information
mvaligursky and Martin Valigursky authored Jan 20, 2025
1 parent 0e58330 commit e101b08
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/core/preprocessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ class Preprocessor {
source = source.substring(0, define.index - 1) + source.substring(DEFINE.lastIndex);

// continue processing on the next symbol
KEYWORD.lastIndex = define.index;
KEYWORD.lastIndex = define.index - 1;
}
}

Expand Down Expand Up @@ -233,7 +233,7 @@ class Preprocessor {
source = source.substring(0, undef.index - 1) + source.substring(UNDEF.lastIndex);

// continue processing on the next symbol
KEYWORD.lastIndex = undef.index;
KEYWORD.lastIndex = undef.index - 1;
}
}

Expand Down Expand Up @@ -367,7 +367,7 @@ class Preprocessor {
source = source.substring(0, include.index - 1) + includeSource + source.substring(INCLUDE.lastIndex);

// process the just included test
KEYWORD.lastIndex = include.index;
KEYWORD.lastIndex = include.index - 1;
} else {
console.error(`Include "${identifier}" not resolved while preprocessing ${Preprocessor.sourceName}`, { source: originalSource });
error = true;
Expand Down

0 comments on commit e101b08

Please sign in to comment.