Skip to content

Commit 74f6f0c

Browse files
authored
Shebang error parsing: compatibility with tsc (#153)
1 parent 6f1526c commit 74f6f0c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

internal/scanner/scanner.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -730,13 +730,13 @@ func (s *Scanner) Scan() ast.Kind {
730730
if s.charAt(1) == '!' {
731731
if s.pos == 0 {
732732
s.pos += 2
733-
for s.char() >= 0 && s.char() != '\n' {
734-
s.pos++
733+
for ch, size := s.charAndSize(); size > 0 && !stringutil.IsLineBreak(ch); ch, size = s.charAndSize() {
734+
s.pos += size
735735
}
736736
continue
737737
}
738738
s.errorAt(diagnostics.X_can_only_be_used_at_the_start_of_a_file, s.pos, 2)
739-
s.pos += 2
739+
s.pos++
740740
s.token = ast.KindUnknown
741741
break
742742
}

0 commit comments

Comments
 (0)