Microsoft.Scripting.Runtime.PositionTrackingWriter.MapLocation C# (CSharp) Méthode

MapLocation() public méthode

Marks the current position of the writer as corresponding to the original location passed in
public MapLocation ( CodeLinePragma linePragma ) : void
linePragma System.CodeDom.CodeLinePragma the line pragma corresponding to the /// current position in the generated code
Résultat void
        public void MapLocation(CodeLinePragma linePragma) {
            _lineMap.Add(new KeyValuePair<int, int>(_line, linePragma.LineNumber));
            _fileMap.Add(new KeyValuePair<int, string>(_line, linePragma.FileName));
        }

Usage Example

        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")] // TODO: fix
        protected void WriteStatement(CodeStatement s)
        {
            // Save statement source location
            if (s.LinePragma != null)
            {
                _writer.MapLocation(s.LinePragma);
            }

            if (s is CodeExpressionStatement)
            {
                WriteExpressionStatement((CodeExpressionStatement)s);
            }
            else if (s is CodeSnippetStatement)
            {
                WriteSnippetStatement((CodeSnippetStatement)s);
            }
        }
All Usage Examples Of Microsoft.Scripting.Runtime.PositionTrackingWriter::MapLocation