0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-30 15:30:56 +01:00
Commit Graph

308 Commits

Author SHA1 Message Date
Timothy Gu
7907534a8d
lib: faster type checks for some types
PR-URL: https://github.com/nodejs/node/pull/15663
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Benedikt Meurer <benedikt.meurer@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-10-01 23:58:59 -03:00
Ruben Bridgewater
da40050b59
repl: fix deprecation code
This slipped through while landing.

PR-URL: https://github.com/nodejs/node/pull/15668
Refs: https://github.com/nodejs/node/pull/15136
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
2017-10-01 20:39:02 -03:00
Lance Ball
e416b3ee36
repl: deprecate turnOffEditorMode
This deprecates the current REPLServer.prototype.turnOffEditorMode
and adds a private function for turnOffEditorMode which handles the
necessary internal changes required instead of having them scattered
about.

PR-URL: https://github.com/nodejs/node/pull/15136
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-09-28 01:54:03 -03:00
Lance Ball
4bd44c11a5
repl: force editorMode in .load
The `.load` command would fail with any file that contains
multiline `.` operator expressions. This was particularly
noticeable when chaining promises or multi-line arrow
expressions.

This change Forces the REPL to be in `editorMode` while loading
a file from disk using the `.load` command.

Fixes: https://github.com/nodejs/node/issues/14022

PR-URL: https://github.com/nodejs/node/pull/14861
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Refael Ackermann <refack@gmail.com>
2017-09-01 10:33:15 -04:00
Lance Ball
ed1ba4580b
repl: remove REPLServer.createContext side effects
The internal method `REPLServer.createContext()` had
unexpected side effects. When called, the value for the
`underscoreAssigned` and `lines` properties were reset.

This change ensures that those properties are not modified
when a context is created.

Fixes: https://github.com/nodejs/node/issues/14226
Refs: https://github.com/nodejs/node/issues/7619

PR-URL: https://github.com/nodejs/node/pull/14331
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2017-08-30 16:22:16 -04:00
Teddy Katz
b646a3df29
repl: include folder extensions in autocomplete
When autocompleting `require` calls, the repl strips .js file extensions
from results. However, stripping an extension from a directory results
in an error. Update the autocompletion logic to avoid stripping
extensions from directories.

PR-URL: https://github.com/nodejs/node/pull/14727
Fixes: https://github.com/nodejs/node/issues/14726
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
2017-08-13 01:03:30 -07:00
Lance Ball
766506a2e9
repl: deprecate REPLServer.parseREPLKeyword
This method does not need to be visible to user code. It has been
undocumented since it was introduced which was perhaps v0.8.9.

The motivation for this change is that the method is simply an
implementation detail of the REPLServer behavior, and does
not need to be exposed to user code.

This change adds documentation of the method with a deprecation
warning, and a test that the method is actually documented.

PR-RUL: https://github.com/nodejs/node/pull/14223
Refs: https://github.com/nodejs/node/issues/7619
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-08-02 14:39:06 -04:00
Lance Ball
2ca9f94e33
repl: make REPLServer.bufferedCommand private
The `REPLServer.bufferedCommand` property was undocumented, except
for its usage appearing, unexplained, in an example for
`REPLServer.defineCommand`. This commit deprecates that property,
privatizes it, and adds a `REPLServer.clearBufferedCommand()`
function that will clear the buffer.

PR-URL: https://github.com/nodejs/node/pull/13687
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: James Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <mhdawson@ibm.com>
Reviewed-By: Ruben Bridgewater <ruben.bridgewater@fintura.de>

Refs: https://github.com/nodejs/node/issues/12686
2017-08-01 22:45:28 +02:00
Shivanth MP
46d3ff2af9
repl: do not consider ... as a REPL command
This fix makes ... in REPL to be considered as a javascript construct
rather than a REPL keyword.

Fixes: https://github.com/nodejs/node/issues/14426
PR-URL: https://github.com/nodejs/node/pull/14467
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2017-07-29 10:35:01 +02:00
Rich Trott
8cccdd96f5 lib: adjust indentation for impending lint change
ESLint 4.x provides stricter indentation linting than previous versions.
In preparation for enabling the stricter indentation linting, adjust the
indentation of four lines in lib/net.js and lib/repl.js.

PR-URL: https://github.com/nodejs/node/pull/14403
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
2017-07-24 13:55:44 -07:00
Alexey Orlenko
45b730ec42
repl: improve require() autocompletion
Currently REPL supports autocompletion for core modules and those found
in node_modules.  This commit adds tab completion for modules relative
to the current directory.

PR-URL: https://github.com/nodejs/node/pull/14409
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Khaidi Chu <i@2333.moe>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-07-24 17:10:43 +03:00
Sebastiaan Deckers
bb29405904
lib,src: fix consistent spacing inside braces
PR-URL: https://github.com/nodejs/node/pull/14162
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-07-21 15:13:47 -04:00
Vse Mozhet Byt
4f87522244 doc, lib, test: do not re-require needlessly
PR-URL: https://github.com/nodejs/node/pull/14244
Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
2017-07-21 20:40:52 +03:00
Benjamin Gruenbaum
030a0285d8 repl: don't terminate on null thrown
Previous behavior was to assume an error is a proper error in the
repl module. A check was added to not terminate the process on thrown
repl errors that are `null` or `undefined`.

PR-URL: https://github.com/nodejs/node/pull/14306
Fixes: https://github.com/nodejs/node/issues/12373
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com
2017-07-19 12:20:09 +03:00
XadillaX
7d7ccf0631
repl: fix crash with large buffer tab completion
If the buffer or array is too large to completion, make a dummy smallest
substitute object for it and emit a warning.

PR-URL: https://github.com/nodejs/node/pull/13817
Fixes: https://github.com/nodejs/node/issues/3136
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
2017-07-07 13:03:44 +08:00
Vse Mozhet Byt
5100cc6851 tools: use no-use-before-define ESLint rule
Also fix repl and url libs for the rule.

PR-URL: https://github.com/nodejs/node/pull/14032
Refs: http://eslint.org/docs/rules/no-use-before-define
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
2017-07-04 20:23:53 +03:00
Ruben Bridgewater
c474f88987
lib: fix typos
PR-URL: https://github.com/nodejs/node/pull/13741
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
2017-06-19 18:18:56 +02:00
Vse Mozhet Byt
878990498a readline,repl,url,util: remove needless capturing
Use non-capturing grouping or remove capturing completely when:

* capturing is useless per se, e.g. in test() check;
* captured groups are not used afterwards at all;
* some of the later captured groups are not used afterwards.

PR-URL: https://github.com/nodejs/node/pull/13718
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2017-06-19 18:07:52 +03:00
Dan Homola
aff8d358fa errors, repl: migrate to use internal/errors.js
* Use existing errors where suitable
* Assign code to a REPL specific error
* Include documentation for the new error code

PR-URL: https://github.com/nodejs/node/pull/11347
Ref: https://github.com/nodejs/node/issues/11273
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2017-06-14 23:05:25 +02:00
Vse Mozhet Byt
390fa0380e cluster, dns, repl, tls, util: fix RegExp nits
* Take RegExp creation out of cycles.
* Use test(), not match() in boolean context.
* Remove redundant RegExp parts.

PR-URL: https://github.com/nodejs/node/pull/13536
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-06-10 13:37:04 +03:00
Nikolai Vavilov
3d9e7bb1d4 repl: remove unused function convertToContext
PR-URL: https://github.com/nodejs/node/pull/13434
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-06-05 13:30:05 +03:00
Marcel Laverdet
3c5bfba28b
vm: fix displayErrors in runIn.. functions
This option has been broken for almost a year when used with any of the
vm.runIn.. family of functions, except for syntax errors.

PR-URL: https://github.com/nodejs/node/pull/13074
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-05-23 20:59:24 +02:00
Brian White
b45abfda5f
repl: fix permanent deoptimizations
PR-URL: https://github.com/nodejs/node/pull/12456
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-04-30 03:18:01 -04:00
James M Snell
ae9e640f30 repl: avoid using forEach
PR-URL: https://github.com/nodejs/node/pull/11582
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-03-17 11:09:40 -07:00
Jan Krems
c7b60165a6 repl: Empty command should be sent to eval function
This fixes a regression introduced in https://github.com/nodejs/node/pull/6171

PR-URL: https://github.com/nodejs/node/pull/11871
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-03-17 08:58:22 -07:00
Blake Embrey
39d9afe279 repl: refactor LineParser implementation
Move the core logic from `LineParser` should fail handling into the
recoverable error check for the REPL default eval.

PR-URL: https://github.com/nodejs/node/pull/6171
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2017-03-14 15:04:50 -07:00
Brian White
c67207731f
lib: simplify Module._resolveLookupPaths
This commit consists of two changes:

* Avoids returning request/id *just* for the debug() output
* Returns `null` instead of an empty array for the list of paths

PR-URL: https://github.com/nodejs/node/pull/10789
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2017-03-10 23:48:59 -05:00
Brian White
28dc848e70
lib: improve method of function calling
Using a more "direct" method of function calling yields better
performance.

PR-URL: https://github.com/nodejs/node/pull/10789
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2017-03-10 23:48:46 -05:00
James M Snell
98e54b0bd4 meta: restore original copyright header
A prior io.js era commit inappropriately removed the
original copyright statements from the source. This
restores those in any files still remaining from that
edit.

Ref: https://github.com/nodejs/TSC/issues/174
Ref: https://github.com/nodejs/node/pull/10599
PR-URL: https://github.com/nodejs/node/pull/10155

Note: This PR was required, reviewed-by and approved
by the Node.js Foundation Legal Committee and the TSC.
There is no `Approved-By:` meta data.
2017-03-10 11:23:48 -08:00
Timothy Gu
3f27f02da0 repl: docs-only deprecation of magic mode
The workaround used in repl to support `let` and `const` in non-strict
mode (known as "magic" mode) has been unnecessary since V8 v4.9 /
Node.js v6.0.0. This commit doc-deprecate magic mode (which is now
entirely equivalent to sloppy mode) in both `repl` module and in
`internal/repl`, which is responsible for starting the REPL in `node`
interactive mode.

PR-URL: https://github.com/nodejs/node/pull/11599
Refs: https://v8project.blogspot.com/2016/01/v8-release-49.html
Refs: https://github.com/nodejs/node/blob/master/doc/changelogs/CHANGELOG_V6.md#6.0.0
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
2017-03-06 19:23:34 -08:00
Timothy Gu
b77c89022b repl: remove magic mode semantics
The workaround used in repl to support `let` and `const` in non-strict
mode (known as "magic" mode) has been unnecessary since V8 v4.9 /
Node.js v6.0.0. This commit functionally removes this workaround.

PR-URL: https://github.com/nodejs/node/pull/11599
Refs: https://v8project.blogspot.com/2016/01/v8-release-49.html
Refs: https://github.com/nodejs/node/blob/master/doc/changelogs/CHANGELOG_V6.md#6.0.0
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
2017-03-06 19:22:23 -08:00
Michaël Zasso
193468667b tools: enable one-var-declaration-per-line ESLint rule
This rule enforces new lines around variable declarations. It is
configured to spot only variables that are initialized.

PR-URL: https://github.com/nodejs/node/pull/11462
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2017-02-21 12:53:19 +01:00
Ben Noordhuis
fd8587eb38 lib: replace \u2019 with regular ascii quote
The previous commit stores baked-in files with non-ASCII characters
as UTF-16.  Replace the \u2019 with a regular quote character so that
the files they're in can be stored as one-byte strings.  The UTF-16
functionality is still tested by the Unicode diagram in lib/timers.js.

PR-URL: https://github.com/nodejs/node/pull/11129
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-02-13 19:16:47 +01:00
James M Snell
5de3cf099c lib: add static identifier codes for all deprecations
Assigns a static identifier code to all runtime and documentation
only deprecations. The identifier code is included in the emitted
DeprecationWarning.

Also adds a deprecations.md to the API docs to provide a central
location where deprecation codes can be referenced and explained.

PR-URL: https://github.com/nodejs/node/pull/10116
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Michal Zasso <targos@protonmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
2017-01-30 11:11:57 -08:00
Michaël Zasso
007386ee81 repl: remove workaround for function redefinition
The issue is fixed upstream in V8. Thus we do not need this workaround
in REPL.

Fixes: https://github.com/nodejs/node/issues/548
PR-URL: https://github.com/nodejs/node/pull/9618
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2017-01-26 22:46:18 +01:00
Rich Trott
338d09d25b test,repl: add coverage for repl .clear+useGlobal
Add a test to cover situation where REPL is initialized with `useGlobal`
set to `true` and `.clear` is called. This adds coverage for code in
repl.js that is not currently covered.

Includes minor refactor of rocket functions in repl.js for concision.

PR-URL: https://github.com/nodejs/node/pull/10777
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-01-15 18:33:50 -08:00
Rich Trott
a68987c154 benchmark,lib,test: adjust for linting
Formatting changes for upcoming linter update.

PR-URL: https://github.com/nodejs/node/pull/10561
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
2017-01-06 14:36:01 -08:00
Evan Lucas
e248f7f9e7 repl: allow autocompletion for scoped packages
Previously, autocompletion of scoped packages was not supported by the
repl due to not including the `@` character in the regular expression.

PR-URL: https://github.com/nodejs/node/pull/10296
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-12-22 22:03:39 -08:00
Michaël Zasso
966e5cfb81 tools: enforce linebreak after ternary operators
This is to be consistent with the other operators and helps
understanding the context when the code is grepped.

PR-URL: https://github.com/nodejs/node/pull/10213
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-12-22 20:27:59 -08:00
Teddy Katz
9d493d0064
repl: avoid parsing division operator as regex
This improves the heuristic used in multiline-prompt mode to determine
whether a given slash character is at the beginning of a regular
expression.

PR-URL: https://github.com/nodejs/node/pull/10103
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: James M Snell <jasnell@keybase.io>
Fixes: https://github.com/nodejs/node/issues/9300
2016-12-06 02:26:24 -05:00
Prince J Wesley
9366b8d90a
repl: preprocess only for defaultEval
Code preprocessing is applicable only for default
eval function. Therefore, Moved `preprocess` function
invocation inside `defaultEval` function.

Fixes: https://github.com/nodejs/node/issues/9743
PR-URL: https://github.com/nodejs/node/pull/9752
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2016-12-05 19:30:56 +05:30
Teddy Katz
24a98dd810
repl: fix generator function preprocessing
Function declarations in the REPL are preprocessed into variable
declarations before being evaluated. However, the preprocessing logic
did not account for the star in a generator function declaration, which
caused the preprocessor to output invalid syntax in some circumstances.

PR-URL: https://github.com/nodejs/node/pull/9852
Fixes: https://github.com/nodejs/node/issues/9850
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2016-12-02 03:15:39 -05:00
Anna Henningsen
2e2887579f
Revert "repl: disable Ctrl+C support on win32 for now"
This reverts commit f59b8888f1
now that the libuv update containing the proper fix has
landed in 63243bcb33.

Ref: https://github.com/libuv/libuv/pull/1054
Ref: https://github.com/nodejs/node/issues/7837
PR-URL: https://github.com/nodejs/node/pull/8645
Reviewed-By: Nikolai Vavilov <vvnicholas@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-11-16 19:37:05 +01:00
Rich Trott
5cbb7a887a repl: refactor lib/repl.js
* remove unnecessary backslash (`\`) escaping in regular expressions
* favor `===` over `==`
* multiline arrays indentation consistent with other indentation

PR-URL: https://github.com/nodejs/node/pull/9374
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2016-11-03 13:20:15 -07:00
Pedro Victor
e658f5b066
repl: name anonymous functions
the changes are related to https://github.com/nodejs/node/issues/8913
regarding the naming of just the inline anonymous
functions that are not assigned to a variable

PR-URL: https://github.com/nodejs/node/pull/9356
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2016-11-01 23:43:02 +01:00
Anna Henningsen
3dfc12793f
repl: don’t write to input stream in editor mode
Instead of writing to the REPL’s input stream for the alignment
spaces in `.editor` mode, let `readline` handle the spaces
properly (echoing them using `_ttyWrite` and adding them to the
current line buffer).

Fixes: https://github.com/nodejs/node/issues/9189
PR-URL: https://github.com/nodejs/node/pull/9207
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-10-26 21:41:52 +02:00
Anna Henningsen
8b6fd4386a
repl: make key of repl.write() optional always
In `.editor` mode, `repl.write()` would have crashed when the
`key` argument was not present, because the overwritten
`_ttyWrite` of REPLs doesn’t check for the absence of a second
argument like `readline.write()` does.

Since the docs indicate that the argument is optional, add
a check paralleling the one in `readline.write()`.

PR-URL: https://github.com/nodejs/node/pull/9207
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-10-26 21:41:52 +02:00
Rich Trott
68ba9aa0fb test,lib,benchmark: match function names
In most cases, named functions match the variable or property to which
they are being assigned. That also seems to be the practice in a series
of PRs currently being evaluated that name currently-anonymous
functions.

This change applies that rule to instances in the code base that don't
comply with that practice.

This will be enforceable with a lint rule once we upgrade to ESLint
3.8.0.

PR-URL: https://github.com/nodejs/node/pull/9113
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
2016-10-19 22:20:27 -07:00
Myles Borins
2e568d95bd lib: remove let from for loops
This is a known de-opt. It may not be 100% necessary in all cases but it
seems like a decent enough idea to avoid it.

PR-URL: https://github.com/nodejs/node/pull/8873
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2016-10-04 12:17:32 -04:00
Rich Trott
4316f4df31 test,lib: align arguments in multiline calls
An upcoming custom lint rule will provide slightly more strict
enforcement of argument alignment for multiline function calls. Adjust
existing code to conform.

PR-URL: https://github.com/nodejs/node/pull/8642
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
2016-09-20 10:22:23 -07:00