@@ -128,6 +128,10 @@ const {
128
128
} = internalBinding ( 'contextify' ) ;
129
129
130
130
const history = require ( 'internal/repl/history' ) ;
131
+ let nextREPLResourceNumber = 1 ;
132
+ function getREPLResourceName ( ) {
133
+ return `REPL${ nextREPLResourceNumber ++ } ` ;
134
+ }
131
135
132
136
// Lazy-loaded.
133
137
let processTopLevelAwait ;
@@ -767,7 +771,7 @@ function REPLServer(prompt,
767
771
const evalCmd = self [ kBufferedCommandSymbol ] + cmd + '\n' ;
768
772
769
773
debug ( 'eval %j' , evalCmd ) ;
770
- self . eval ( evalCmd , self . context , 'repl' , finish ) ;
774
+ self . eval ( evalCmd , self . context , getREPLResourceName ( ) , finish ) ;
771
775
772
776
function finish ( e , ret ) {
773
777
debug ( 'finish' , e , ret ) ;
@@ -1248,7 +1252,7 @@ function complete(line, callback) {
1248
1252
1249
1253
const memberGroups = [ ] ;
1250
1254
const evalExpr = `try { ${ expr } } catch {}` ;
1251
- this . eval ( evalExpr , this . context , 'repl' , ( e , obj ) => {
1255
+ this . eval ( evalExpr , this . context , getREPLResourceName ( ) , ( e , obj ) => {
1252
1256
try {
1253
1257
let p ;
1254
1258
if ( ( typeof obj === 'object' && obj !== null ) ||
0 commit comments