hcl/hclsyntax: Fix token range reporting for invalid characters

This commit is contained in:
Radek Simko 2019-01-25 13:45:53 +00:00
parent 45accbc687
commit 4f47ee198a

View File

@ -189,6 +189,9 @@ func checkInvalidTokens(tokens Tokens) hcl.Diagnostics {
toldBadUTF8 := 0 toldBadUTF8 := 0
for _, tok := range tokens { for _, tok := range tokens {
// copy token so it's safe to point to it
tok := tok
switch tok.Type { switch tok.Type {
case TokenBitwiseAnd, TokenBitwiseOr, TokenBitwiseXor, TokenBitwiseNot: case TokenBitwiseAnd, TokenBitwiseOr, TokenBitwiseXor, TokenBitwiseNot:
if toldBitwise < 4 { if toldBitwise < 4 {