lib: changed var to const in bootstrap_node.js

PR-URL: https://github.com/nodejs/node/pull/8588
Reviewed-By: Yosuke Furukawa <yosuke.furukawa@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
This commit is contained in:
Adri Van Houdt 2016-09-17 11:07:23 +02:00 committed by James M Snell
parent 3ffa6a884c
commit 41a66bc73a

View File

@ -10,7 +10,7 @@
(function(process) { (function(process) {
function startup() { function startup() {
var EventEmitter = NativeModule.require('events'); const EventEmitter = NativeModule.require('events');
process._eventsCount = 0; process._eventsCount = 0;
Object.setPrototypeOf(process, Object.create(EventEmitter.prototype, { Object.setPrototypeOf(process, Object.create(EventEmitter.prototype, {
@ -92,7 +92,7 @@
// channel. This needs to be done before any user code gets executed // channel. This needs to be done before any user code gets executed
// (including preload modules). // (including preload modules).
if (process.argv[1] && process.env.NODE_UNIQUE_ID) { if (process.argv[1] && process.env.NODE_UNIQUE_ID) {
var cluster = NativeModule.require('cluster'); const cluster = NativeModule.require('cluster');
cluster._setupWorker(); cluster._setupWorker();
// Make sure it's not accidentally inherited by child processes. // Make sure it's not accidentally inherited by child processes.
@ -111,18 +111,18 @@
}); });
} else if (process.argv[1]) { } else if (process.argv[1]) {
// make process.argv[1] into a full path // make process.argv[1] into a full path
var path = NativeModule.require('path'); const path = NativeModule.require('path');
process.argv[1] = path.resolve(process.argv[1]); process.argv[1] = path.resolve(process.argv[1]);
var Module = NativeModule.require('module'); const Module = NativeModule.require('module');
// check if user passed `-c` or `--check` arguments to Node. // check if user passed `-c` or `--check` arguments to Node.
if (process._syntax_check_only != null) { if (process._syntax_check_only != null) {
var vm = NativeModule.require('vm'); const vm = NativeModule.require('vm');
var fs = NativeModule.require('fs'); const fs = NativeModule.require('fs');
var internalModule = NativeModule.require('internal/module'); const internalModule = NativeModule.require('internal/module');
// read the source // read the source
var filename = Module._resolveFilename(process.argv[1]); const filename = Module._resolveFilename(process.argv[1]);
var source = fs.readFileSync(filename, 'utf-8'); var source = fs.readFileSync(filename, 'utf-8');
// remove shebang and BOM // remove shebang and BOM
source = internalModule.stripBOM(source.replace(/^\#\!.*/, '')); source = internalModule.stripBOM(source.replace(/^\#\!.*/, ''));
@ -140,7 +140,7 @@
// If -i or --interactive were passed, or stdin is a TTY. // If -i or --interactive were passed, or stdin is a TTY.
if (process._forceRepl || NativeModule.require('tty').isatty(0)) { if (process._forceRepl || NativeModule.require('tty').isatty(0)) {
// REPL // REPL
var cliRepl = NativeModule.require('internal/repl'); const cliRepl = NativeModule.require('internal/repl');
cliRepl.createInternalRepl(process.env, function(err, repl) { cliRepl.createInternalRepl(process.env, function(err, repl) {
if (err) { if (err) {
throw err; throw err;
@ -254,7 +254,7 @@
wrapConsoleCall) { wrapConsoleCall) {
if (!inspectorConsole) if (!inspectorConsole)
return; return;
var config = {}; const config = {};
for (const key of Object.keys(console)) { for (const key of Object.keys(console)) {
if (!inspectorConsole.hasOwnProperty(key)) if (!inspectorConsole.hasOwnProperty(key))
continue; continue;
@ -374,7 +374,7 @@
// V8 debug object about a connection, and runMain when // V8 debug object about a connection, and runMain when
// that occurs. --isaacs // that occurs. --isaacs
var debugTimeout = +process.env.NODE_DEBUG_TIMEOUT || 50; const debugTimeout = +process.env.NODE_DEBUG_TIMEOUT || 50;
setTimeout(entryFunction, debugTimeout); setTimeout(entryFunction, debugTimeout);
} else { } else {
@ -387,9 +387,9 @@
// core modules found in lib/*.js. All core modules are compiled into the // core modules found in lib/*.js. All core modules are compiled into the
// node binary, so they can be loaded faster. // node binary, so they can be loaded faster.
var ContextifyScript = process.binding('contextify').ContextifyScript; const ContextifyScript = process.binding('contextify').ContextifyScript;
function runInThisContext(code, options) { function runInThisContext(code, options) {
var script = new ContextifyScript(code, options); const script = new ContextifyScript(code, options);
return script.runInThisContext(); return script.runInThisContext();
} }
@ -409,7 +409,7 @@
return NativeModule; return NativeModule;
} }
var cached = NativeModule.getCached(id); const cached = NativeModule.getCached(id);
if (cached && (cached.loaded || cached.loading)) { if (cached && (cached.loaded || cached.loading)) {
return cached.exports; return cached.exports;
} }
@ -420,7 +420,7 @@
process.moduleLoadList.push(`NativeModule ${id}`); process.moduleLoadList.push(`NativeModule ${id}`);
var nativeModule = new NativeModule(id); const nativeModule = new NativeModule(id);
nativeModule.cache(); nativeModule.cache();
nativeModule.compile(); nativeModule.compile();
@ -477,7 +477,7 @@
this.loading = true; this.loading = true;
try { try {
var fn = runInThisContext(source, { const fn = runInThisContext(source, {
filename: this.filename, filename: this.filename,
lineOffset: 0, lineOffset: 0,
displayErrors: true displayErrors: true