Skip to content

Commit f529e8b

Browse files
committed
fix: use thread_local last error tracking
1 parent c964cd5 commit f529e8b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

rust/deps/merve.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,8 @@ struct StarExportBinding {
312312
std::string_view id;
313313
};
314314

315-
// Global state for error tracking
316-
std::optional<lexer_error> last_error;
315+
// Thread-local state for error tracking (safe for concurrent parse calls).
316+
thread_local std::optional<lexer_error> last_error;
317317

318318
// Lexer state class
319319
class CJSLexer {

src/parser.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,8 @@ struct StarExportBinding {
310310
std::string_view id;
311311
};
312312

313-
// Global state for error tracking
314-
std::optional<lexer_error> last_error;
313+
// Thread-local state for error tracking (safe for concurrent parse calls).
314+
thread_local std::optional<lexer_error> last_error;
315315

316316
// Lexer state class
317317
class CJSLexer {

0 commit comments

Comments
 (0)