From 9ddf9aabfc1e756cbc9ce3433f4d35b41591a846 Mon Sep 17 00:00:00 2001 From: Logan Smyth Date: Sun, 17 Apr 2016 15:13:34 -0700 Subject: [PATCH] Don't track position when sourcemaps are off. --- packages/babel-generator/src/buffer.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/babel-generator/src/buffer.js b/packages/babel-generator/src/buffer.js index 6a27cf66d0..3158a7c3e4 100644 --- a/packages/babel-generator/src/buffer.js +++ b/packages/babel-generator/src/buffer.js @@ -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);