Пример #1
0
        public void LogWarning(Runtime.WarningID ID, string message, string filename, int line, int col)
        {
            filename = filename ?? string.Empty;

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

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

            if (runtimeCore.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 = runtimeCore.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 = runtimeCore.DSExecutable.RuntimeData.ExecutingGraphnode;
                }
            }

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

            warnings.Add(entry);
        }
Пример #2
0
 public void LogWarning(Runtime.WarningID ID, string message)
 {
     LogWarning(ID, message, string.Empty, Constants.kInvalidIndex, Constants.kInvalidIndex);
 }
Пример #3
0
        public static void LogWarning(this Interpreter dsi, Runtime.WarningID id, string msg, string fileName = null, int line = -1, int col = -1)
        {
            RuntimeCore runtimeCore = dsi.runtime.RuntimeCore;

            runtimeCore.RuntimeStatus.LogWarning(id, msg, fileName, line, col);
        }