6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'opal/lib/opal/parser/patch.rb', line 6
def source_buffer=(source_buffer)
@source_buffer = source_buffer
if @source_buffer
source = @source_buffer.source
# Force UTF8 unpacking even if JS works with UTF-16/UCS-2
# See: https://mathiasbynens.be/notes/javascript-encoding
@source_pts = source.unpack('U*')
else
@source_pts = nil
end
# Since parser v3.2.1 Parser::Lexer has @strings
if @strings
@strings.source_buffer = @source_buffer
@strings.source_pts = @source_pts
end
end