Skip to content

Commit

Permalink
repl: unflag top-level await
Browse files Browse the repository at this point in the history
unflags top-level await for the REPL.
This is accomplished by getting rid of `--experimental-repl-await` flag and the checks related to the same.
  • Loading branch information
hemanth authored Jul 8, 2021
2 parents 394fdec + c38bf81 commit 503c640
Show file tree
Hide file tree
Showing 9 changed files with 6 additions and 24 deletions.
8 changes: 0 additions & 8 deletions doc/api/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,13 +279,6 @@ added: v11.8.0

Use the specified file as a security policy.

### `--experimental-repl-await`
<!-- YAML
added: v10.0.0
-->

Enable experimental top-level `await` keyword support in REPL.

### `--experimental-specifier-resolution=mode`
<!-- YAML
added:
Expand Down Expand Up @@ -1401,7 +1394,6 @@ Node.js options that are allowed are:
* `--experimental-loader`
* `--experimental-modules`
* `--experimental-policy`
* `--experimental-repl-await`
* `--experimental-specifier-resolution`
* `--experimental-top-level-await`
* `--experimental-vm-modules`
Expand Down
4 changes: 1 addition & 3 deletions doc/api/repl.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,7 @@ Error: foo

#### `await` keyword

With the [`--experimental-repl-await`][] command-line option specified,
experimental support for the `await` keyword is enabled.
Support for the `await` keyword is enabled at the top level.

```console
> await Promise.resolve(123)
Expand Down Expand Up @@ -764,7 +763,6 @@ For an example of running a REPL instance over [`curl(1)`][], see:
[TTY keybindings]: readline.md#readline_tty_keybindings
[ZSH]: https://en.wikipedia.org/wiki/Z_shell
[`'uncaughtException'`]: process.md#process_event_uncaughtexception
[`--experimental-repl-await`]: cli.md#cli_experimental_repl_await
[`ERR_DOMAIN_CANNOT_SET_UNCAUGHT_EXCEPTION_CAPTURE`]: errors.md#errors_err_domain_cannot_set_uncaught_exception_capture
[`ERR_INVALID_REPL_INPUT`]: errors.md#errors_err_invalid_repl_input
[`curl(1)`]: https://curl.haxx.se/docs/manpage.html
Expand Down
5 changes: 0 additions & 5 deletions doc/node.1
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,6 @@ to use as a custom module loader.
.It Fl -experimental-policy
Use the specified file as a security policy.
.
.It Fl -experimental-repl-await
Enable experimental top-level
.Sy await
keyword support in REPL.
.
.It Fl -experimental-specifier-resolution
Select extension resolution algorithm for ES Modules; either 'explicit' (default) or 'node'.
.
Expand Down
5 changes: 1 addition & 4 deletions lib/repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,6 @@ const {
validateObject,
} = require('internal/validators');

const experimentalREPLAwait = getOptionValue(
'--experimental-repl-await'
);
const pendingDeprecation = getOptionValue('--pending-deprecation');
const {
REPL_MODE_SLOPPY,
Expand Down Expand Up @@ -421,7 +418,7 @@ function REPLServer(prompt,
wrappedCmd = true;
}

if (experimentalREPLAwait && StringPrototypeIncludes(code, 'await')) {
if (StringPrototypeIncludes(code, 'await')) {
if (processTopLevelAwait === undefined) {
({ processTopLevelAwait } = require('internal/repl/await'));
}
Expand Down
2 changes: 1 addition & 1 deletion src/node_options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
Implies("--policy-integrity", "[has_policy_integrity_string]");
AddOption("--experimental-repl-await",
"experimental await keyword support in REPL",
&EnvironmentOptions::experimental_repl_await,
NoOp{},
kAllowedInEnvironment);
AddOption("--experimental-vm-modules",
"experimental ES Module support in vm module",
Expand Down
1 change: 0 additions & 1 deletion src/node_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ class EnvironmentOptions : public Options {
std::string experimental_policy;
std::string experimental_policy_integrity;
bool has_policy_integrity_string;
bool experimental_repl_await = false;
bool experimental_vm_modules = false;
bool expose_internals = false;
bool frozen_intrinsics = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ assert(undocumented.delete('--no-debug-arraybuffer-allocations'));
assert(undocumented.delete('--es-module-specifier-resolution'));
assert(undocumented.delete('--experimental-report'));
assert(undocumented.delete('--experimental-worker'));
assert(undocumented.delete('--experimental-repl-await'));
assert(undocumented.delete('--node-snapshot'));
assert(undocumented.delete('--no-node-snapshot'));
assert(undocumented.delete('--loader'));
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-repl-import-referrer.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const assert = require('assert');
const cp = require('child_process');
const fixtures = require('../common/fixtures');

const args = ['--interactive', '--experimental-repl-await'];
const args = ['--interactive'];
const opts = { cwd: fixtures.path('es-modules') };
const child = cp.spawn(process.execPath, args, opts);

Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-repl-top-level-await.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const repl = require('repl');

common.skipIfInspectorDisabled();

// Flags: --expose-internals --experimental-repl-await
// Flags: --expose-internals

const PROMPT = 'await repl > ';

Expand Down

0 comments on commit 503c640

Please sign in to comment.