From bc4cbe3f50aa18c1eb45137e502bb20337fd9434 Mon Sep 17 00:00:00 2001 From: Sebastien Ahkrin Date: Mon, 6 Jan 2020 03:48:14 +0100 Subject: [PATCH] lib: add RegExp primordials MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/31208 Reviewed-By: Michaƫl Zasso Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater Reviewed-By: Rich Trott Reviewed-By: Trivikram Kamat --- lib/.eslintrc.yaml | 2 ++ lib/_tls_wrap.js | 1 + lib/internal/net.js | 1 + lib/internal/policy/sri.js | 1 + lib/internal/util/debuglog.js | 2 ++ lib/internal/util/inspect.js | 1 + lib/repl.js | 1 + 7 files changed, 9 insertions(+) diff --git a/lib/.eslintrc.yaml b/lib/.eslintrc.yaml index 16ab2f50285..4344e4a461b 100644 --- a/lib/.eslintrc.yaml +++ b/lib/.eslintrc.yaml @@ -35,6 +35,8 @@ rules: message: "Use `const { Promise } = primordials;` instead of the global." - name: Reflect message: "Use `const { Reflect } = primordials;` instead of the global." + - name: RegExp + message: "Use `const { RegExp } = primordials;` instead of the global." - name: Set message: "Use `const { Set } = primordials;` instead of the global." - name: Symbol diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js index 0207d9bfd6c..c8ccbdb8428 100644 --- a/lib/_tls_wrap.js +++ b/lib/_tls_wrap.js @@ -25,6 +25,7 @@ const { ObjectAssign, ObjectDefineProperty, ObjectSetPrototypeOf, + RegExp, Symbol, } = primordials; diff --git a/lib/internal/net.js b/lib/internal/net.js index 28f4e696cda..73acaa5efee 100644 --- a/lib/internal/net.js +++ b/lib/internal/net.js @@ -1,6 +1,7 @@ 'use strict'; const { + RegExp, Symbol, } = primordials; diff --git a/lib/internal/policy/sri.js b/lib/internal/policy/sri.js index 38d7fc9e07d..d70df5c1aa1 100644 --- a/lib/internal/policy/sri.js +++ b/lib/internal/policy/sri.js @@ -5,6 +5,7 @@ const { ObjectDefineProperty, ObjectFreeze, ObjectSeal, + RegExp, RegExpPrototypeExec, RegExpPrototypeTest, StringPrototypeSlice, diff --git a/lib/internal/util/debuglog.js b/lib/internal/util/debuglog.js index 87af5de8339..21d52910912 100644 --- a/lib/internal/util/debuglog.js +++ b/lib/internal/util/debuglog.js @@ -2,6 +2,8 @@ const { format } = require('internal/util/inspect'); +const { RegExp } = primordials; + // `debugs` is deliberately initialized to undefined so any call to // debuglog() before initializeDebugEnv() is called will throw. let debugs; diff --git a/lib/internal/util/inspect.js b/lib/internal/util/inspect.js index 73299407988..7f589eebe33 100644 --- a/lib/internal/util/inspect.js +++ b/lib/internal/util/inspect.js @@ -35,6 +35,7 @@ const { ObjectPrototypeHasOwnProperty, ObjectPrototypePropertyIsEnumerable, ObjectSeal, + RegExp, RegExpPrototypeToString, Set, SetPrototype, diff --git a/lib/repl.js b/lib/repl.js index a0f11c8eeb9..420b9558f99 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -58,6 +58,7 @@ const { ObjectSetPrototypeOf, Promise, PromiseRace, + RegExp, Set, Symbol, WeakMap,