'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var _commonjsHelpers = require('../../../../../../../../_virtual/_commonjsHelpers.js');
require('../../../../../../../../_virtual/mixin.js');
var mixin = require('../../utils/mixin.js');

'use strict';

const Mixin = mixin.mixin;

class ErrorReportingMixinBase extends Mixin {
    constructor(host, opts) {
        super(host);

        this.posTracker = null;
        this.onParseError = opts.onParseError;
    }

    _setErrorLocation(err) {
        err.startLine = err.endLine = this.posTracker.line;
        err.startCol = err.endCol = this.posTracker.col;
        err.startOffset = err.endOffset = this.posTracker.offset;
    }

    _reportError(code) {
        const err = {
            code: code,
            startLine: -1,
            startCol: -1,
            startOffset: -1,
            endLine: -1,
            endCol: -1,
            endOffset: -1
        };

        this._setErrorLocation(err);
        this.onParseError(err);
    }

    _getOverriddenMethods(mxn) {
        return {
            _err(code) {
                mxn._reportError(code);
            }
        };
    }
}

var mixinBase = ErrorReportingMixinBase;

var mixinBase_default = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(mixinBase);

exports.default = mixinBase_default;
exports.mixinBase = mixinBase;
//# sourceMappingURL=mixin-base.js.map
