保誠-保戶業務員媒合平台
HelenHuang
2022-06-09 26fa49f4b0aa658d65a21fffe828f39e78302573
PAMapp/node_modules/@babel/generator/lib/buffer.js
@@ -4,6 +4,16 @@
  value: true
});
exports.default = void 0;
function SourcePos() {
  return {
    identifierName: undefined,
    line: undefined,
    column: undefined,
    filename: undefined
  };
}
const SPACES_RE = /^[ \t]+$/;
class Buffer {
@@ -16,12 +26,7 @@
      line: 1,
      column: 0
    };
    this._sourcePosition = {
      identifierName: null,
      line: null,
      column: null,
      filename: null
    };
    this._sourcePosition = SourcePos();
    this._disallowedPop = null;
    this._map = map;
  }
@@ -32,29 +37,31 @@
    const map = this._map;
    const result = {
      code: this._buf.trimRight(),
      map: null,
      rawMappings: map == null ? void 0 : map.getRawMappings()
      decodedMap: map == null ? void 0 : map.getDecoded(),
      get map() {
        return result.map = map ? map.get() : null;
      },
      set map(value) {
        Object.defineProperty(result, "map", {
          value,
          writable: true
        });
      },
      get rawMappings() {
        return result.rawMappings = map == null ? void 0 : map.getRawMappings();
      },
      set rawMappings(value) {
        Object.defineProperty(result, "rawMappings", {
          value,
          writable: true
        });
      }
    };
    if (map) {
      Object.defineProperty(result, "map", {
        configurable: true,
        enumerable: true,
        get() {
          return this.map = map.get();
        },
        set(value) {
          Object.defineProperty(this, "map", {
            value,
            writable: true
          });
        }
      });
    }
    return result;
  }
@@ -65,11 +72,10 @@
      line,
      column,
      filename,
      identifierName,
      force
      identifierName
    } = this._sourcePosition;
    this._append(str, line, column, identifierName, filename, force);
    this._append(str, line, column, identifierName, filename);
  }
  queue(str) {
@@ -83,11 +89,14 @@
      line,
      column,
      filename,
      identifierName,
      force
      identifierName
    } = this._sourcePosition;
    this._queue.unshift([str, line, column, identifierName, filename, force]);
    this._queue.unshift([str, line, column, identifierName, filename]);
  }
  queueIndentation(str) {
    this._queue.unshift([str, undefined, undefined, undefined, undefined]);
  }
  _flush() {
@@ -98,14 +107,14 @@
    }
  }
  _append(str, line, column, identifierName, filename, force) {
  _append(str, line, column, identifierName, filename) {
    this._buf += str;
    this._last = str.charCodeAt(str.length - 1);
    let i = str.indexOf("\n");
    let last = 0;
    if (i !== 0) {
      this._mark(line, column, identifierName, filename, force);
      this._mark(line, column, identifierName, filename);
    }
    while (i !== -1) {
@@ -114,7 +123,7 @@
      last = i + 1;
      if (last < str.length) {
        this._mark(++line, 0, identifierName, filename, force);
        this._mark(++line, 0, identifierName, filename);
      }
      i = str.indexOf("\n", last);
@@ -123,10 +132,10 @@
    this._position.column += str.length - last;
  }
  _mark(line, column, identifierName, filename, force) {
  _mark(line, column, identifierName, filename) {
    var _this$_map;
    (_this$_map = this._map) == null ? void 0 : _this$_map.mark(this._position.line, this._position.column, line, column, identifierName, filename, force);
    (_this$_map = this._map) == null ? void 0 : _this$_map.mark(this._position, line, column, identifierName, filename);
  }
  removeTrailingNewline() {
@@ -176,17 +185,17 @@
  }
  exactSource(loc, cb) {
    this.source("start", loc, true);
    this.source("start", loc);
    cb();
    this.source("end", loc);
    this._disallowPop("start", loc);
  }
  source(prop, loc, force) {
  source(prop, loc) {
    if (prop && !loc) return;
    this._normalizePosition(prop, loc, this._sourcePosition, force);
    this._normalizePosition(prop, loc, this._sourcePosition);
  }
  withSource(prop, loc, cb) {
@@ -198,46 +207,26 @@
    this.source(prop, loc);
    cb();
    if ((!this._sourcePosition.force || this._sourcePosition.line !== originalLine || this._sourcePosition.column !== originalColumn || this._sourcePosition.filename !== originalFilename) && (!this._disallowedPop || this._disallowedPop.line !== originalLine || this._disallowedPop.column !== originalColumn || this._disallowedPop.filename !== originalFilename)) {
    if (!this._disallowedPop || this._disallowedPop.line !== originalLine || this._disallowedPop.column !== originalColumn || this._disallowedPop.filename !== originalFilename) {
      this._sourcePosition.line = originalLine;
      this._sourcePosition.column = originalColumn;
      this._sourcePosition.filename = originalFilename;
      this._sourcePosition.identifierName = originalIdentifierName;
      this._sourcePosition.force = false;
      this._disallowedPop = null;
    }
  }
  _disallowPop(prop, loc) {
    if (prop && !loc) return;
    this._disallowedPop = this._normalizePosition(prop, loc);
    this._disallowedPop = this._normalizePosition(prop, loc, SourcePos());
  }
  _normalizePosition(prop, loc, targetObj, force) {
  _normalizePosition(prop, loc, targetObj) {
    const pos = loc ? loc[prop] : null;
    if (targetObj === undefined) {
      targetObj = {
        identifierName: null,
        line: null,
        column: null,
        filename: null,
        force: false
      };
    }
    const origLine = targetObj.line;
    const origColumn = targetObj.column;
    const origFilename = targetObj.filename;
    targetObj.identifierName = prop === "start" && (loc == null ? void 0 : loc.identifierName) || null;
    targetObj.identifierName = prop === "start" && (loc == null ? void 0 : loc.identifierName) || undefined;
    targetObj.line = pos == null ? void 0 : pos.line;
    targetObj.column = pos == null ? void 0 : pos.column;
    targetObj.filename = loc == null ? void 0 : loc.filename;
    if (force || targetObj.line !== origLine || targetObj.column !== origColumn || targetObj.filename !== origFilename) {
      targetObj.force = force;
    }
    return targetObj;
  }