Пример #1
0
        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
             * };*/
        }
Пример #2
0
        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
            };*/
        }
Пример #3
0
        internal static CodeRange MakeCodeRange(int startLine, int startCol, int endLine, int endCol, string filePath)
        {
            ProtoCore.CodeModel.CodeFile codeFile = new ProtoCore.CodeModel.CodeFile()
            {
                FilePath = filePath
            };

            return new ProtoCore.CodeModel.CodeRange
            {
                StartInclusive = new ProtoCore.CodeModel.CodePoint
                {
                    LineNo = startLine,
                    CharNo = startCol,
                    SourceLocation = codeFile
                },

                EndExclusive = new ProtoCore.CodeModel.CodePoint
                {
                    LineNo = endLine,
                    CharNo = endCol,
                    SourceLocation = codeFile
                }
            };
        }