MapLocation() public method

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
return void
Example #1
0
        [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);
            }
        }
Example #2
0
        protected void WriteStatement(CodeStatement s)
        {
            // Save statement source location
            if (s.LinePragma != null)
            {
                _writer.MapLocation(s.LinePragma);
            }

            switch (s)
            {
            case CodeExpressionStatement statement:
                WriteExpressionStatement(statement);
                break;

            case CodeSnippetStatement statement:
                WriteSnippetStatement(statement);
                break;
            }
        }