public void LogSyntaxError(string msg, string fileName = null, int line = -1, int col = -1) { // Error: " + msg + "\n"; /*if (fileName == null) * { * fileName = "N.A."; * }*/ if (logErrors) { var message = string.Format("{0}({1},{2}) Error:{3}", fileName, line, col, msg); System.Console.WriteLine(message); } BuildData.ErrorEntry errorEntry = new BuildData.ErrorEntry { FileName = fileName, Message = msg, Line = line, Col = col }; if (core.Options.IsDeltaExecution) { core.LogErrorInGlobalMap(Core.ErrorType.Error, msg, fileName, line, col); } errors.Add(errorEntry); OutputMessage outputmessage = new OutputMessage(OutputMessage.MessageType.Error, msg.Trim(), fileName, line, col); if (MessageHandler != null) { MessageHandler.Write(outputmessage); if (WebMsgHandler != null) { OutputMessage webOutputMsg = new OutputMessage(OutputMessage.MessageType.Error, msg.Trim(), "", line, col); WebMsgHandler.Write(webOutputMsg); } if (!outputmessage.Continue) { throw new BuildHaltException(msg); } } }
public void LogWarning(RuntimeData.WarningID id, string msg, string path, int line, int col) { string filename = string.IsNullOrEmpty(path) ? string.Empty : path; if (string.IsNullOrEmpty(filename) || line == -1 || col == -1) { ProtoCore.CodeGen.AuditCodeLocation(core, ref filename, ref line, ref col); } OutputMessage outputMsg = new OutputMessage(string.Format("> Runtime warning: {0}\n - \"{1}\" <line: {2}, col: {3}>", msg, filename, line, col)); System.Console.WriteLine(string.Format("> Runtime warning: {0}\n - \"{1}\" <line: {2}, col: {3}>", msg, filename, line, col)); if (WebMsgHandler != null) { WebMsgHandler.Write(outputMsg); } warnings.Add(new RuntimeData.WarningEntry { id = id, message = msg, Col = col, Line = line, Filename = filename }); if (core.Options.IsDeltaExecution) { core.LogErrorInGlobalMap(Core.ErrorType.Warning, msg, filename, line, col, BuildData.WarningID.kDefault, id); } if (null != MessageHandler) { OutputMessage.MessageType type = OutputMessage.MessageType.Warning; MessageHandler.Write(new OutputMessage(type, msg.Trim(), filename, line, col)); } CodeModel.CodeFile cf = new CodeModel.CodeFile { FilePath = path }; /*CodePoint = new CodeModel.CodePoint * { * SourceLocation = cf, * LineNo = line, * CharNo = col * };*/ }