From 2907d663dc80f034af158b90a2193f11134f07e0 Mon Sep 17 00:00:00 2001 From: David Aurelio Date: Fri, 16 Dec 2016 01:12:50 +0000 Subject: [PATCH] add comments --- packages/babel-generator/src/buffer.js | 2 ++ packages/babel-generator/src/source-map.js | 2 ++ 2 files changed, 4 insertions(+) diff --git a/packages/babel-generator/src/buffer.js b/packages/babel-generator/src/buffer.js index 76db204668..69c61db864 100644 --- a/packages/babel-generator/src/buffer.js +++ b/packages/babel-generator/src/buffer.js @@ -46,6 +46,8 @@ export default class Buffer { }; if (map) { + // The `.map` property is lazy to allow callers to use the raw mappings + // without any overhead Object.defineProperty(result, "map", { configurable: true, enumerable: true, diff --git a/packages/babel-generator/src/source-map.js b/packages/babel-generator/src/source-map.js index c94c9140cf..4388debc89 100644 --- a/packages/babel-generator/src/source-map.js +++ b/packages/babel-generator/src/source-map.js @@ -70,6 +70,8 @@ export default class SourceMap { this._lastSourceLine = line; this._lastSourceColumn = column; + // We are deliberately not using the `source-map` library here to allow + // callers to use these mappings without any overhead this._rawMappings.push({ // undefined to allow for more compact json serialization name: identifierName || undefined,