repl: eliminate var in function _memory

PR-URL: https://github.com/nodejs/node/pull/26496
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
This commit is contained in:
gengjiawen 2019-03-07 22:36:30 +08:00 committed by Ruben Bridgewater
parent 2c1a8c85d2
commit 024842f8f4
No known key found for this signature in database
GPG Key ID: F07496B3EB3C1762

View File

@ -1341,7 +1341,7 @@ function _memory(cmd) {
let up = cmd.match(/[})]/g); let up = cmd.match(/[})]/g);
up = up ? up.length : 0; up = up ? up.length : 0;
dw = dw ? dw.length : 0; dw = dw ? dw.length : 0;
var depth = dw - up; let depth = dw - up;
if (depth) { if (depth) {
(function workIt() { (function workIt() {
@ -1360,9 +1360,9 @@ function _memory(cmd) {
}); });
} else if (depth < 0) { } else if (depth < 0) {
// Going... up. // Going... up.
var curr = self.lines.level.pop(); const curr = self.lines.level.pop();
if (curr) { if (curr) {
var tmp = curr.depth + depth; const tmp = curr.depth + depth;
if (tmp < 0) { if (tmp < 0) {
// More to go, recurse // More to go, recurse
depth += curr.depth; depth += curr.depth;