Don't track position when sourcemaps are off.

This commit is contained in:
Logan Smyth 2016-04-17 15:13:34 -07:00
parent 61e3b1d314
commit 9ddf9aabfc

View File

@ -249,6 +249,8 @@ export default class Buffer {
*/
withSource(prop: string, loc: Location, cb: () => void) {
if (!this.opts.sourceMaps) return cb();
// Use the call stack to manage a stack of "source location" data.
let originalLine = this._sourcePosition.line;
let originalColumn = this._sourcePosition.column;
@ -310,7 +312,7 @@ export default class Buffer {
}
// If there the line is ending, adding a new mapping marker is redundant
if (str[0] !== "\n") this.map.mark(this._sourcePosition);
if (this.opts.sourceMaps && str[0] !== "\n") this.map.mark(this._sourcePosition);
//
this.position.push(str);