Skip to content

Commit 71dd334

Browse files
committed
src: make global error message vectors const in contextify
1 parent 641653b commit 71dd334

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/node_contextify.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1622,7 +1622,7 @@ MaybeLocal<Object> ContextifyFunction::CompileFunctionAndCacheResult(
16221622
// While top-level `await` is not permitted in CommonJS, it returns the same
16231623
// error message as when `await` is used in a sync function, so we don't use it
16241624
// as a disambiguation.
1625-
static std::vector<std::string_view> esm_syntax_error_messages = {
1625+
static const std::vector<std::string_view> esm_syntax_error_messages = {
16261626
"Cannot use import statement outside a module", // `import` statements
16271627
"Unexpected token 'export'", // `export` statements
16281628
"Cannot use 'import.meta' outside a module"}; // `import.meta` references
@@ -1637,7 +1637,7 @@ static std::vector<std::string_view> esm_syntax_error_messages = {
16371637
// - Top-level `await`: if the user writes `await` at the top level of a
16381638
// CommonJS module, it will throw a syntax error; but the same code is valid
16391639
// in ESM.
1640-
static std::vector<std::string_view> throws_only_in_cjs_error_messages = {
1640+
static const std::vector<std::string_view> throws_only_in_cjs_error_messages = {
16411641
"Identifier 'module' has already been declared",
16421642
"Identifier 'exports' has already been declared",
16431643
"Identifier 'require' has already been declared",

0 commit comments

Comments
 (0)