public bool ContainsWarning(RuntimeData.WarningID warnId)
 {
     foreach (RuntimeData.WarningEntry warn in warnings)
     {
         if (warnId == warn.id)
         {
             return(true);
         }
     }
     return(false);
 }
Example #2
0
        public void LogWarning(RuntimeData.WarningID ID, string message, string filename, int line, int col)
        {
            filename = filename ?? string.Empty;

            if (!this.core.Options.IsDeltaExecution && (string.IsNullOrEmpty(filename) ||
                                                        line == Constants.kInvalidIndex ||
                                                        col == Constants.kInvalidIndex))
            {
                CodeGen.AuditCodeLocation(core, ref filename, ref line, ref col);
            }

            var warningMsg = string.Format(WarningMessage.kConsoleWarningMessage,
                                           message, filename, line, col);

            if (core.Options.Verbose)
            {
                System.Console.WriteLine(warningMsg);
            }

            if (WebMessageHandler != null)
            {
                var outputMessage = new OutputMessage(warningMsg);
                WebMessageHandler.Write(outputMessage);
            }

            if (MessageHandler != null)
            {
                var outputMessage = new OutputMessage(OutputMessage.MessageType.Warning,
                                                      message.Trim(), filename, line, col);
                MessageHandler.Write(outputMessage);
            }

            var entry = new RuntimeData.WarningEntry
            {
                ID            = ID,
                Message       = message,
                Column        = col,
                Line          = line,
                ExpressionID  = core.RuntimeExpressionUID,
                GraphNodeGuid = core.ExecutingGraphnode == null ? Guid.Empty : core.ExecutingGraphnode.guid,
                Filename      = filename
            };

            warnings.Add(entry);

            if (core.Options.IsDeltaExecution)
            {
            }
        }
        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
             * };*/
        }
Example #4
0
 public void LogWarning(RuntimeData.WarningID ID, string message)
 {
     LogWarning(ID, message, string.Empty, Constants.kInvalidIndex, Constants.kInvalidIndex);
 }
Example #5
0
        public void LogWarning(RuntimeData.WarningID ID, string message, string filename, int line, int col)
        {
            filename = filename ?? string.Empty;

            if (!this.core.Options.IsDeltaExecution && (string.IsNullOrEmpty(filename) ||
                                                        line == Constants.kInvalidIndex ||
                                                        col == Constants.kInvalidIndex))
            {
                CodeGen.AuditCodeLocation(core, ref filename, ref line, ref col);
            }

            var warningMsg = string.Format(WarningMessage.kConsoleWarningMessage,
                                           message, filename, line, col);

            if (core.Options.Verbose)
            {
                System.Console.WriteLine(warningMsg);
            }

            if (WebMessageHandler != null)
            {
                var outputMessage = new OutputMessage(warningMsg);
                WebMessageHandler.Write(outputMessage);
            }

            if (MessageHandler != null)
            {
                var outputMessage = new OutputMessage(OutputMessage.MessageType.Warning,
                                                      message.Trim(), filename, line, col);
                MessageHandler.Write(outputMessage);
            }

            AssociativeGraph.GraphNode executingGraphNode = null;
            var executive = core.CurrentExecutive.CurrentDSASMExec;

            if (executive != null)
            {
                executingGraphNode = executive.Properties.executingGraphNode;
                // In delta execution mode, it means the warning is from some
                // internal graph node.
                if (executingGraphNode != null && executingGraphNode.guid.Equals(System.Guid.Empty))
                {
                    executingGraphNode = core.ExecutingGraphnode;
                }
            }

            var entry = new RuntimeData.WarningEntry
            {
                ID            = ID,
                Message       = message,
                Column        = col,
                Line          = line,
                ExpressionID  = core.RuntimeExpressionUID,
                GraphNodeGuid = executingGraphNode == null ? Guid.Empty : executingGraphNode.guid,
                AstID         = executingGraphNode == null ? Constants.kInvalidIndex : executingGraphNode.OriginalAstID,
                Filename      = filename
            };

            warnings.Add(entry);

            if (core.Options.IsDeltaExecution)
            {
            }
        }
 public void LogWarning(RuntimeData.WarningID id, string msg, int blockID)
 {
     LogWarning(id, msg, string.Empty, -1, -1);
 }