• Matthew Dempsky's avatar
    cmd/compile: fix contrived line number errors · af558acc
    Matthew Dempsky authored
    If a general comment contains multiple newline characters, we can't
    simply unread one and then re-lex it via the general whitespace lexing
    phase, because then we'll reset lineno to the line before the "*/"
    marker, rather than keeping it where we found the "/*" marker.
    
    Also, for processing imports, call importfile before advancing the
    lexer with p.next(), so that lineno reflects the line where we found
    the import path, and not the token afterwards.
    
    Fixes #14520.
    
    Change-Id: I785a2d83d632280113d4b757de0d57c88ba2caf4
    Reviewed-on: https://go-review.googlesource.com/19934Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
    Run-TryBot: Matthew Dempsky <mdempsky@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    af558acc
issue14520.go 286 Bytes