Method: Kernel#raise

Defined in:
lib/source/ruby.rb

#raise(*args) ⇒ Object

FIX: Incomplete



1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
# File 'lib/source/ruby.rb', line 1395

def raise(*args)
  `var exception_class=c$RuntimeError,msg=$q('')`
  `if(arguments[0]&&arguments[0].m$is_a_bool(c$Exception)){
    var e=arguments[0];
  }else{
    if(arguments[0]&&arguments[0].m$class()==c$String){
      msg=arguments[0];
    }else{
      if(arguments[0]!=null){
        exception_class=arguments[0],msg=arguments[1]||msg;
      };
    }
  }`
  `var e=e||exception_class.m$new(msg)`
  `e.__stack__=new Error().stack`
  `throw(e)`
  return nil
end