コード例 #1
0
ファイル: RuntimeStatus.cs プロジェクト: Benglin/designscript
 public void LogWarning(RuntimeData.WarningID id, string msg, int blockID)
 {
     LogWarning(id, msg, string.Empty, -1, -1);
 }
コード例 #2
0
ファイル: Core.cs プロジェクト: algobasket/Dynamo
        public void LogErrorInGlobalMap(Core.ErrorType type, string msg, string fileName = null, int line = -1, int col = -1, 
            BuildData.WarningID buildId = BuildData.WarningID.kDefault, RuntimeData.WarningID runtimeId = RuntimeData.WarningID.kDefault)
        {
            ulong location = (((ulong)line) << 32 | ((uint)col));
            Core.ErrorEntry newError = new Core.ErrorEntry
            {
                Type = type,
                FileName = fileName,
                Message = msg,
                Line = line,
                Col = col,
                BuildId = buildId,
                RuntimeId = runtimeId
            };

            if (this.LocationErrorMap.ContainsKey(location))
            {
                ProtoCore.Core.ErrorEntry error = this.LocationErrorMap[location];

                // If there is a warning, replace it with an error
                if (error.Type == Core.ErrorType.Warning && type == Core.ErrorType.Error)
                {
                    this.LocationErrorMap[location] = newError;
                }
            }
            else
            {
                this.LocationErrorMap.Add(location, newError);
            }
        }
コード例 #3
0
ファイル: RuntimeStatus.cs プロジェクト: Benglin/designscript
        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
            };*/
        }
コード例 #4
0
ファイル: RuntimeStatus.cs プロジェクト: Benglin/designscript
 public bool ContainsWarning(RuntimeData.WarningID warnId)
 {
     foreach (RuntimeData.WarningEntry warn in warnings)
     {
         if (warnId == warn.id)
             return true;
     }
     return false;
 }
コード例 #5
0
ファイル: RuntimeStatus.cs プロジェクト: RobertiF/Dynamo
 public void LogWarning(RuntimeData.WarningID ID, string message)
 {
     LogWarning(ID, message, string.Empty, Constants.kInvalidIndex, Constants.kInvalidIndex);
 }
コード例 #6
0
ファイル: RuntimeStatus.cs プロジェクト: RobertiF/Dynamo
        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)
            {
            }
        }
コード例 #7
0
ファイル: RuntimeStatus.cs プロジェクト: whztt07/Dynamo
        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)
            {
            }
        }