Beispiel #1
0
        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]++;
                }
            }
        }
Beispiel #2
0
        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
        }
Beispiel #3
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);
 }
Beispiel #4
0
        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]++;
            }
        }
Beispiel #5
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;
		}
Beispiel #6
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);
        }
Beispiel #7
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);
		}
Beispiel #8
0
		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);
		}
Beispiel #9
0
 internal void Add(ErrorInfo info, string fullPath, ErrorPosition pos, params string[] args)
 {
     Add(info, CoreResources.GetString(info.MessageId, args), fullPath, pos);
 }
Beispiel #10
0
 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);
 }
Beispiel #11
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);
        }
Beispiel #12
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;
		}
Beispiel #13
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);
        }
Beispiel #14
0
		internal void Add(ErrorInfo info, string fullPath, ErrorPosition pos, params string[] args)
		{
			Add(info, CoreResources.GetString(info.MessageId, args), fullPath, pos);
		}
Beispiel #15
0
		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
		}
Beispiel #16
0
		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]++;
		}
Beispiel #17
0
		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]++;
			}		
		}
Beispiel #18
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));
 }
Beispiel #19
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;
        }
Beispiel #20
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);
Beispiel #21
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);
Beispiel #22
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));
 }
Beispiel #23
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;
		}
Beispiel #24
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;
		}
Beispiel #25
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);
		}