diff --git a/lib/module.js b/lib/module.js index 99c4762109..1d937f8baa 100644 --- a/lib/module.js +++ b/lib/module.js @@ -372,7 +372,7 @@ Module.prototype._compile = function(content, filename) { var wrapper = Module.wrap(content); var compiledWrapper = runInThisContext(wrapper, - { filename: filename, lineOffset: -1 }); + { filename: filename, lineOffset: 0 }); if (global.v8debug) { if (!resolvedArgv) { // we enter the repl if we're not given a filename argument. diff --git a/src/node.js b/src/node.js index 367f68b25c..b38594f7c0 100644 --- a/src/node.js +++ b/src/node.js @@ -942,7 +942,7 @@ }; NativeModule.wrapper = [ - '(function (exports, require, module, __filename, __dirname) {\n', + '(function (exports, require, module, __filename, __dirname) { ', '\n});' ]; @@ -952,7 +952,7 @@ var fn = runInThisContext(source, { filename: this.filename, - lineOffset: -1 + lineOffset: 0 }); fn(this.exports, NativeModule.require, this, this.filename); diff --git a/test/sequential/test-module-loading.js b/test/sequential/test-module-loading.js index 19ba398d96..ead3447320 100644 --- a/test/sequential/test-module-loading.js +++ b/test/sequential/test-module-loading.js @@ -285,9 +285,9 @@ assert.equal(42, require('../fixtures/utf8-bom.js')); assert.equal(42, require('../fixtures/utf8-bom.json')); // Error on the first line of a module should -// have the correct line and column number +// have the correct line number assert.throws(function() { require('../fixtures/test-error-first-line-offset.js'); }, function(err) { - return /test-error-first-line-offset.js:1:1/.test(err.stack); + return /test-error-first-line-offset.js:1:/.test(err.stack); }, 'Expected appearance of proper offset in Error stack');