Class: Parser::Lexer

Inherits:
Object
  • Object
show all
Defined in:
opal/lib/opal/parser/patch.rb

Instance Method Summary collapse

Instance Method Details

#source_buffer=(source_buffer) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'opal/lib/opal/parser/patch.rb', line 5

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
end