You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
800 B
24 lines
800 B
'use strict';
|
|
|
|
const ErrorReportingMixinBase = require('./mixin-base');
|
|
const PositionTrackingPreprocessorMixin = require('../position-tracking/preprocessor-mixin');
|
|
const Mixin = require('../../utils/mixin');
|
|
|
|
class ErrorReportingPreprocessorMixin extends ErrorReportingMixinBase {
|
|
constructor(preprocessor, opts) {
|
|
super(preprocessor, opts);
|
|
|
|
this.posTracker = Mixin.install(preprocessor, PositionTrackingPreprocessorMixin);
|
|
this.lastErrOffset = -1;
|
|
}
|
|
|
|
_reportError(code) {
|
|
//NOTE: avoid reporting error twice on advance/retreat
|
|
if (this.lastErrOffset !== this.posTracker.offset) {
|
|
this.lastErrOffset = this.posTracker.offset;
|
|
super._reportError(code);
|
|
}
|
|
}
|
|
}
|
|
|
|
module.exports = ErrorReportingPreprocessorMixin;
|
|
|