Esempio n. 1
0
		/// <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;
		}
Esempio n. 2
0
		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;
		}
Esempio n. 3
0
		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;
		}
Esempio n. 4
0
		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);
		}
Esempio n. 5
0
		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;
		}
Esempio n. 6
0
        /// <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);
Esempio n. 7
0
 /// <summary>
 /// Upgrades <see cref="ErrorSeverity.Warning"/> to <see cref="ErrorSeverity.WarningAsError"/> is <see cref="TreatWarningsAsErrors"/> is enabled.
 /// </summary>
 private ErrorSeverity UpgradeSeverity(ErrorSeverity severity)
 {
     return (severity.Value == ErrorSeverity.Values.Warning && TreatWarningsAsErrors) ? ErrorSeverity.WarningAsError : severity;
 }
Esempio n. 8
0
        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;
        }
Esempio n. 9
0
		internal bool AddInternal(int id, string message, ErrorSeverity severity, int group, string fullPath, ErrorPosition pos)
		{
			return AddInternal(id, message, severity, group, fullPath, pos, false);
		}
Esempio n. 10
0
		public ErrorInfo(int id, string messageId, WarningGroups group)
		{
			this.id = id;
			this.messageId = messageId;
			this.severity = ErrorSeverity.Warning;
			this.group = (int)group;
		}
Esempio n. 11
0
		public ErrorInfo(int id, string messageId, ErrorSeverity severity)
		{
			this.id = id;
			this.messageId = messageId;
			this.severity = severity;
			this.group = (int)WarningGroups.None;
		}