Esempio n. 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]++;
                }
            }
        }
Esempio n. 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
        }
Esempio n. 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);
 }
Esempio n. 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]++;
            }
        }
Esempio n. 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;
		}
Esempio n. 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);
        }
Esempio n. 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);
		}
Esempio n. 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);
		}
Esempio n. 9
0
 internal void Add(ErrorInfo info, string fullPath, ErrorPosition pos, params string[] args)
 {
     Add(info, CoreResources.GetString(info.MessageId, args), fullPath, pos);
 }
Esempio n. 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);
 }
Esempio n. 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);
        }
Esempio n. 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;
		}
Esempio n. 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);
        }
Esempio n. 14
0
		internal void Add(ErrorInfo info, string fullPath, ErrorPosition pos, params string[] args)
		{
			Add(info, CoreResources.GetString(info.MessageId, args), fullPath, pos);
		}
Esempio n. 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
		}
Esempio n. 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]++;
		}
Esempio n. 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]++;
			}		
		}
Esempio n. 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));
 }
Esempio n. 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;
        }
Esempio n. 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);
Esempio n. 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);
Esempio n. 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));
 }
Esempio n. 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;
		}
Esempio n. 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;
		}
Esempio n. 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);
		}