@@ -57,13 +57,14 @@ const {
57
57
validateUint32,
58
58
} = require ( 'internal/validators' ) ;
59
59
const {
60
- kVmBreakFirstLineSymbol,
61
60
emitExperimentalWarning,
61
+ kEmptyObject,
62
+ kVmBreakFirstLineSymbol,
62
63
} = require ( 'internal/util' ) ;
63
64
const kParsingContext = Symbol ( 'script parsing context' ) ;
64
65
65
66
class Script extends ContextifyScript {
66
- constructor ( code , options = { } ) {
67
+ constructor ( code , options = kEmptyObject ) {
67
68
code = `${ code } ` ;
68
69
if ( typeof options === 'string' ) {
69
70
options = { filename : options } ;
@@ -152,7 +153,7 @@ function validateContext(contextifiedObject) {
152
153
}
153
154
}
154
155
155
- function getRunInContextArgs ( options = { } ) {
156
+ function getRunInContextArgs ( options = kEmptyObject ) {
156
157
validateObject ( options , 'options' ) ;
157
158
158
159
let timeout = options . timeout ;
@@ -212,7 +213,7 @@ function isContext(object) {
212
213
}
213
214
214
215
let defaultContextNameIndex = 1 ;
215
- function createContext ( contextObject = { } , options = { } ) {
216
+ function createContext ( contextObject = { } , options = kEmptyObject ) {
216
217
if ( isContext ( contextObject ) ) {
217
218
return contextObject ;
218
219
}
@@ -305,7 +306,7 @@ function runInThisContext(code, options) {
305
306
return createScript ( code , options ) . runInThisContext ( options ) ;
306
307
}
307
308
308
- function compileFunction ( code , params , options = { } ) {
309
+ function compileFunction ( code , params , options = kEmptyObject ) {
309
310
validateString ( code , 'code' ) ;
310
311
if ( params !== undefined ) {
311
312
validateArray ( params , 'params' ) ;
@@ -395,7 +396,7 @@ const measureMemoryExecutions = {
395
396
eager : constants . measureMemory . execution . EAGER ,
396
397
} ;
397
398
398
- function measureMemory ( options = { } ) {
399
+ function measureMemory ( options = kEmptyObject ) {
399
400
emitExperimentalWarning ( 'vm.measureMemory' ) ;
400
401
validateObject ( options , 'options' ) ;
401
402
const { mode = 'summary' , execution = 'default' } = options ;
0 commit comments