class RubyLex

def self.compile_with_errors_suppressed(code, line_no: 1)

Experimental RBS support (using type sampling data from the type_fusion project).

def self.compile_with_errors_suppressed: (String code, line_no: Integer) -> nil

This signature was generated using 1 sample from 1 application.

def self.compile_with_errors_suppressed(code, line_no: 1)
  begin
    result = yield code, line_no
  rescue ArgumentError
    # Ruby can issue an error for the code if there is an
    # incomplete magic comment for encoding in it. Force an
    # expression with a new line before the code in this
    # case to prevent magic comment handling.  To make sure
    # line numbers in the lexed code remain the same,
    # decrease the line number by one.
    code = ";\n#{code}"
    line_no -= 1
    result = yield code, line_no
  end
  result
end