Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] Preprocessor correctly updates position for text replacement #7303

Merged
merged 1 commit into from
Jan 20, 2025
Merged
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
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
Loading