summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTimothy Gu <timothygu99@gmail.com>2018-03-25 20:13:54 -0700
committerTimothy Gu <timothygu99@gmail.com>2018-04-18 07:50:17 -0700
commitbe92eab92a185fdd954da85bc41ab85af0f16690 (patch)
tree3653358ecb6afcc0b8420248c7d32c8458a17038 /src
parentd864f63611a86c33da7864e3af5fff3be8332d07 (diff)
downloadandroid-node-v8-be92eab92a185fdd954da85bc41ab85af0f16690.tar.gz
android-node-v8-be92eab92a185fdd954da85bc41ab85af0f16690.tar.bz2
android-node-v8-be92eab92a185fdd954da85bc41ab85af0f16690.zip
repl: hide top-level await feature behind a flag
PR-URL: https://github.com/nodejs/node/pull/19604 Refs: https://github.com/nodejs/node/pull/17807 Refs: https://github.com/nodejs/node/pull/15566#issuecomment-353428430 Reviewed-By: Gus Caplan <me@gus.host>
Diffstat (limited to 'src')
-rw-r--r--src/node.cc12
-rw-r--r--src/node_config.cc3
-rw-r--r--src/node_internals.h5
3 files changed, 20 insertions, 0 deletions
diff --git a/src/node.cc b/src/node.cc
index 099fba35a8..6acad6870d 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -243,6 +243,11 @@ bool config_experimental_modules = false;
// that is used by lib/vm.js
bool config_experimental_vm_modules = false;
+// Set in node.cc by ParseArgs when --experimental-repl-await is used.
+// Used in node_config.cc to set a constant on process.binding('config')
+// that is used by lib/repl.js.
+bool config_experimental_repl_await = false;
+
// Set in node.cc by ParseArgs when --loader is used.
// Used in node_config.cc to set a constant on process.binding('config')
// that is used by lib/internal/bootstrap/node.js
@@ -3463,6 +3468,10 @@ static void PrintHelp() {
#if defined(NODE_HAVE_I18N_SUPPORT)
" --experimental-modules experimental ES Module support\n"
" and caching modules\n"
+#endif // defined(NODE_HAVE_I18N_SUPPORT)
+ " --experimental-repl-await experimental await keyword support\n"
+ " in REPL\n"
+#if defined(NODE_HAVE_I18N_SUPPORT)
" --experimental-vm-modules experimental ES Module support\n"
" in vm module\n"
#endif // defined(NODE_HAVE_I18N_SUPPORT)
@@ -3622,6 +3631,7 @@ static void CheckIfAllowedInEnv(const char* exe, bool is_env,
// Node options, sorted in `node --help` order for ease of comparison.
"--enable-fips",
"--experimental-modules",
+ "--experimental-repl-await",
"--experimental-vm-modules",
"--expose-http2", // keep as a non-op through v9.x
"--force-fips",
@@ -3819,6 +3829,8 @@ static void ParseArgs(int* argc,
new_v8_argc += 1;
} else if (strcmp(arg, "--experimental-vm-modules") == 0) {
config_experimental_vm_modules = true;
+ } else if (strcmp(arg, "--experimental-repl-await") == 0) {
+ config_experimental_repl_await = true;
} else if (strcmp(arg, "--loader") == 0) {
const char* module = argv[index + 1];
if (!config_experimental_modules) {
diff --git a/src/node_config.cc b/src/node_config.cc
index 055a9b0ae4..e2b2662abd 100644
--- a/src/node_config.cc
+++ b/src/node_config.cc
@@ -89,6 +89,9 @@ static void Initialize(Local<Object> target,
if (config_experimental_vm_modules)
READONLY_BOOLEAN_PROPERTY("experimentalVMModules");
+ if (config_experimental_repl_await)
+ READONLY_BOOLEAN_PROPERTY("experimentalREPLAwait");
+
if (config_pending_deprecation)
READONLY_BOOLEAN_PROPERTY("pendingDeprecation");
diff --git a/src/node_internals.h b/src/node_internals.h
index 8cc1aa1a8f..492a36296f 100644
--- a/src/node_internals.h
+++ b/src/node_internals.h
@@ -181,6 +181,11 @@ extern bool config_experimental_modules;
// that is used by lib/vm.js
extern bool config_experimental_vm_modules;
+// Set in node.cc by ParseArgs when --experimental-repl-await is used.
+// Used in node_config.cc to set a constant on process.binding('config')
+// that is used by lib/repl.js.
+extern bool config_experimental_repl_await;
+
// Set in node.cc by ParseArgs when --loader is used.
// Used in node_config.cc to set a constant on process.binding('config')
// that is used by lib/internal/bootstrap/node.js