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 committed Aug 11, 2020
1 parent 1f9b20b commit 03225c5
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 18 deletions.
8 changes: 0 additions & 8 deletions doc/api/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,13 +230,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 @@ -1242,7 +1235,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 @@ -224,8 +224,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 @@ -747,7 +746,6 @@ For an example of running a REPL instance over [curl(1)][], see:

[ZSH]: https://en.wikipedia.org/wiki/Z_shell
[`'uncaughtException'`]: process.html#process_event_uncaughtexception
[`--experimental-repl-await`]: cli.html#cli_experimental_repl_await
[`ERR_DOMAIN_CANNOT_SET_UNCAUGHT_EXCEPTION_CAPTURE`]: errors.html#errors_err_domain_cannot_set_uncaught_exception_capture
[`ERR_INVALID_REPL_INPUT`]: errors.html#errors_err_invalid_repl_input
[`domain`]: domain.html
Expand Down
6 changes: 2 additions & 4 deletions lib/repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,7 @@ const {
} = require('internal/errors');
const { sendInspectorCommand } = require('internal/util/inspector');
const { getOptionValue } = require('internal/options');
const experimentalREPLAwait = getOptionValue(
'--experimental-repl-await'
);

const pendingDeprecation = getOptionValue('--pending-deprecation');
const {
REPL_MODE_SLOPPY,
Expand Down Expand Up @@ -369,7 +367,7 @@ function REPLServer(prompt,
wrappedCmd = true;
}

if (experimentalREPLAwait && code.includes('await')) {
if (code.includes('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 @@ -329,7 +329,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
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ assert(undocumented.delete('--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('--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 03225c5

Please sign in to comment.