private void Add(ErrorInfo info, string /*!*/ message, SourceUnit sourceUnit, Position pos) { Debug.Assert(message != null); string full_path; ErrorPosition mapped_pos; // missing source unit means the file name shouldn't be reported (it is not available) if (sourceUnit != null) { full_path = sourceUnit.GetMappedFullSourcePath(pos.FirstLine); mapped_pos = new ErrorPosition( sourceUnit.GetMappedLine(pos.FirstLine), pos.FirstColumn, sourceUnit.GetMappedLine(pos.LastLine), pos.LastColumn); } else { full_path = null; mapped_pos = ErrorPosition.Invalid; } // filter disabled warnings: if (info.Id < 0 || (info.Group & (int)disabledGroups) == 0 && Array.IndexOf(disabledWarnings, info.Id) == -1) { // do not count disabled warnings and related locations et. al.: var severity = UpgradeSeverity(info.Severity); if (Add(info.Id, message, severity, info.Group, full_path, mapped_pos) && info.Id >= 0) { counts[severity]++; } } }
public void AddConfigurationError(ConfigurationErrorsException /*!*/ e) { if (e == null) { throw new ArgumentNullException("e"); } #if SILVERLIGHT StringBuilder message = new StringBuilder(e.Message); Exception inner = e.InnerException; while (inner != null) { message.Append(" "); message.Append(inner.Message); inner = inner.InnerException; } Add(FatalErrors.ConfigurationError, "<configuration>", new ErrorPosition(), message.ToString()); #else ErrorPosition pos = new ErrorPosition(e.Line, 0, e.Line, 0); StringBuilder message = new StringBuilder(e.BareMessage); Exception inner = e.InnerException; while (inner != null) { message.Append(" "); message.Append(inner.Message); inner = inner.InnerException; } Add(FatalErrors.ConfigurationError, e.Filename, pos, message.ToString()); #endif }
protected override bool Add(int id, string message, ErrorSeverity severity, int group, string /*!*/ fullPath, ErrorPosition pos) { Debug.Assert(fullPath != null); PhpException.ThrowByWebCompiler(severity.ToPhpCompileError(), id, fullPath, pos.FirstLine, pos.FirstColumn, message); return(true); }
private void Add(ErrorInfo info, string /*!*/ message, string fullPath, ErrorPosition pos, params string[] args) { Debug.Assert(message != null); var severity = UpgradeSeverity(info.Severity); if (Add(info.Id, message, severity, info.Group, fullPath, pos) && info.Id >= 0) { counts[severity]++; } }
/// <summary> /// Log Errors/Warnings/Messages when the compiler reports them. /// </summary> protected override bool Add(int id, string/*!*/ message, ErrorSeverity severity, int group, string fullPath, ErrorPosition pos) { string code = ErrorIdToCode(id); switch (severity.Value) { case ErrorSeverity.Values.FatalError: case ErrorSeverity.Values.Error: case ErrorSeverity.Values.WarningAsError: logger.LogError(severity.Value.ToString(), code, "", fullPath, pos.FirstLine, pos.FirstColumn, pos.LastLine, pos.LastColumn, message); break; case ErrorSeverity.Values.Warning: logger.LogWarning(severity.Value.ToString(), code, "", fullPath, pos.FirstLine, pos.FirstColumn, pos.LastLine, pos.LastColumn, message); break; } return true; }
protected override bool Add(int id, string message, ErrorSeverity severity, int group, string /*!*/ fullPath, ErrorPosition pos) { Debug.Assert(fullPath != null); // first line column adjustment: if (pos.FirstLine == 1) { pos.FirstColumn += firstLineColumnDisplacement; } Debug.WriteLine("!!!3", message); PhpException.ThrowByEval(severity.ToPhpCompileError(), fullPath, pos.FirstLine, pos.FirstColumn, message); return(true); }
internal bool AddInternal(int id, string message, ErrorSeverity severity, int group, string fullPath, ErrorPosition pos) { return AddInternal(id, message, severity, group, fullPath, pos, false); }
internal void Add(ErrorInfo info, string fullPath, ErrorPosition pos, string arg1, string arg2, string arg3) { Add(info, CoreResources.GetString(info.MessageId, arg1, arg2, arg3), fullPath, pos); }
internal void Add(ErrorInfo info, string fullPath, ErrorPosition pos, params string[] args) { Add(info, CoreResources.GetString(info.MessageId, args), fullPath, pos); }
protected override bool Add(int id, string message, ErrorSeverity severity, int group, string fullPath, ErrorPosition pos) { if (fullPath != null) { Debug.Assert(pos.IsValid); output.Write(String.Format("{0}({1},{2}): ", fullPath, pos.FirstLine, pos.FirstColumn)); } if (id >= 0) { output.WriteLine(String.Format("{0} PHP{1:d4}: {2}", severity.ToCmdString(), id, message)); } else { output.WriteLine(message); } return(true); }
protected override bool Add(int id, string message, ErrorSeverity severity, int group, string/*!*/ fullPath, ErrorPosition pos) { Debug.Assert(fullPath != null); // first line column adjustment: if (pos.FirstLine == 1) pos.FirstColumn += firstLineColumnDisplacement; Debug.WriteLine("!!!3", message); PhpException.ThrowByEval(severity.ToPhpCompileError(), fullPath, pos.FirstLine, pos.FirstColumn, message); return true; }
internal bool AddInternal(int id, string message, ErrorSeverity severity, int group, string fullPath, ErrorPosition pos, bool increaseCount) { severity = UpgradeSeverity(severity); bool result = Add(id, message, severity, group, fullPath, pos); if (increaseCount) { counts[severity]++; } return(result); }
public void AddConfigurationError(ConfigurationErrorsException/*!*/ e) { if (e == null) throw new ArgumentNullException("e"); #if SILVERLIGHT StringBuilder message = new StringBuilder(e.Message); Exception inner = e.InnerException; while (inner != null) { message.Append(" "); message.Append(inner.Message); inner = inner.InnerException; } Add(FatalErrors.ConfigurationError, "<configuration>", new ErrorPosition(), message.ToString()); #else ErrorPosition pos = new ErrorPosition(e.Line, 0, e.Line, 0); StringBuilder message = new StringBuilder(e.BareMessage); Exception inner = e.InnerException; while (inner != null) { message.Append(" "); message.Append(inner.Message); inner = inner.InnerException; } Add(FatalErrors.ConfigurationError, e.Filename, pos, message.ToString()); #endif }
private void Add(ErrorInfo info, string/*!*/ message, string fullPath, ErrorPosition pos, params string[] args) { Debug.Assert(message != null); var severity = UpgradeSeverity(info.Severity); if (Add(info.Id, message, severity, info.Group, fullPath, pos) && info.Id >= 0) counts[severity]++; }
private void Add(ErrorInfo info, string/*!*/ message, SourceUnit sourceUnit, Position pos) { Debug.Assert(message != null); string full_path; ErrorPosition mapped_pos; // missing source unit means the file name shouldn't be reported (it is not available) if (sourceUnit != null) { full_path = sourceUnit.GetMappedFullSourcePath(pos.FirstLine); mapped_pos = new ErrorPosition( sourceUnit.GetMappedLine(pos.FirstLine), pos.FirstColumn, sourceUnit.GetMappedLine(pos.LastLine), pos.LastColumn); } else { full_path = null; mapped_pos = ErrorPosition.Invalid; } // filter disabled warnings: if (info.Id < 0 || (info.Group & (int)disabledGroups) == 0 && Array.IndexOf(disabledWarnings, info.Id) == -1) { // do not count disabled warnings and related locations et. al.: var severity = UpgradeSeverity(info.Severity); if (Add(info.Id, message, severity, info.Group, full_path, mapped_pos) && info.Id >= 0) counts[severity]++; } }
internal bool AddInternal(int id, string message, ErrorSeverity severity, int group, string fullPath, ErrorPosition pos) { return(AddInternal(id, message, severity, group, fullPath, pos, false)); }
internal bool AddInternal(int id, string message, ErrorSeverity severity, int group, string fullPath, ErrorPosition pos, bool increaseCount) { severity = UpgradeSeverity(severity); bool result = Add(id, message, severity, group, fullPath, pos); if (increaseCount) counts[severity]++; return result; }
/// <summary> /// Returns whether the warning has been reported. /// </summary> protected abstract bool Add(int id, string message, ErrorSeverity severity, int group, string fullPath, ErrorPosition pos);
protected override bool Add(int id, string message, ErrorSeverity severity, int group, string fullPath, ErrorPosition pos) { return(sink.AddInternal(id, message, severity, group, fullPath, pos)); }
protected override bool Add(int id, string message, ErrorSeverity severity, int group, string fullPath, ErrorPosition pos) { if (fullPath != null) { Debug.Assert(pos.IsValid); output.Write(String.Format("{0}({1},{2}): ", fullPath, pos.FirstLine, pos.FirstColumn)); } if (id >= 0) output.WriteLine(String.Format("{0} PHP{1:d4}: {2}", severity.ToCmdString(), id, message)); else output.WriteLine(message); return true; }
protected override bool Add(int id, string message, ErrorSeverity severity, int group, string/*!*/ fullPath, ErrorPosition pos) { Debug.Assert(fullPath != null); PhpException.ThrowByWebCompiler(severity.ToPhpCompileError(), id, fullPath, pos.FirstLine, pos.FirstColumn, message); return true; }
protected override bool Add(int id, string message, ErrorSeverity severity, int group, string fullPath, ErrorPosition pos) { return sink.AddInternal(id, message, severity, group, fullPath, pos); }