public override void Add(SourceUnit sourceUnit, string message, SourceSpan span, int errorCode, Severity severity)
{
if (_listener != null)
{
ScriptSource scriptSource;
if (sourceUnit != _source.SourceUnit)
{
scriptSource = new ScriptSource(_source.Engine.Runtime.GetEngine(sourceUnit.LanguageContext), sourceUnit);
}
else
{
scriptSource = _source;
}
_listener.ErrorReported(scriptSource, message, span, errorCode, severity);
}
else if (severity == Severity.FatalError || severity == Severity.Error)
{
throw new SyntaxErrorException(message, sourceUnit, span, errorCode, severity);
}
}