コード例 #1
0
        void WritePositionToInstruction(SourcePosition previousPosition,
                                        SourcePosition currentPosition, bool forceExplicitDocument,
                                        ref Instruction instruction)
        {
            instruction.EndLine   = currentPosition.Line;
            instruction.StartLine = currentPosition.Line;

            instruction.HasSource = !currentPosition.IsEmpty();
            if (currentPosition.Url == previousPosition.Url)
            {
                instruction.ByteOffset = currentPosition.Line == previousPosition.Line ? 1u : 0u;
                if (previousPosition.Line < currentPosition.Line)
                {
                    instruction.StartLine =
                        Math.Max(GetDefaultStartLineFromEndLine(currentPosition.Line),
                                 previousPosition.Line + 1);
                    instruction.ByteOffset = 0;
                }
                instruction.DocumentChanged = false;
                instruction.Document        = forceExplicitDocument ? currentPosition.Url : null;
            }
            else
            {
                // We are switching files (or going from location with position to one without
                // position or vice versa).
                instruction.ByteOffset      = 0;
                instruction.StartLine       = GetDefaultStartLineFromEndLine(currentPosition.Line);
                instruction.DocumentChanged = true;
                instruction.Document        = currentPosition.Url;
            }
        }