Commit Graph

7922 Commits

Author SHA1 Message Date
ksss db3573e0bf Should raise FloatDomainError 2017-03-29 11:59:19 +09:00
Yukihiro "Matz" Matsumoto 1f6bf0e14f Merge pull request #3563 from clayton-shopify/dup-renumber-keys
Renumber hash keys during dup since there may be duplicates.
2017-03-29 09:43:33 +09:00
Yukihiro "Matz" Matsumoto 506c05f01d Merge pull request #3564 from okkez/set-proper-class-to-subclass-of-array
Set proper class to subclass of Array
2017-03-29 09:40:44 +09:00
okkez 6dbe2272cf Set proper class to subclass of Array
More compatibility to CRuby.
2017-03-29 08:02:21 +09:00
Clayton Smith a6e25f73a0 Renumber hash keys during dup since there may be duplicates. 2017-03-28 16:31:19 -04:00
Yukihiro "Matz" Matsumoto 5ec051fc34 Avoid inline local variable declarations; fix #3554 2017-03-28 18:22:05 +09:00
Yukihiro "Matz" Matsumoto 1bdaf9c840 Merge pull request #3553 from okkez/add-array-slice-bang
Implement Array#slice!
2017-03-28 15:24:52 +09:00
Kenji Okimoto 33f77fe367 Implement Array#slice! 2017-03-28 15:07:57 +09:00
Yukihiro "Matz" Matsumoto 0f5289326f Merge pull request #3552 from ksss/time
Fix infinity loop ref #3546
2017-03-28 14:47:23 +09:00
ksss 397f1fc946 Fix infinity loop
And some cases should raise FloatDomainError
2017-03-28 10:58:18 +09:00
Yukihiro "Matz" Matsumoto 66980493ae Merge pull request #3544 from ksss/lineno
Fix lost lineno
2017-03-27 11:50:18 +09:00
Yukihiro "Matz" Matsumoto f688de5803 Merge pull request #3545 from keizo042/ignore_tags
Ignore file generated by ctags
2017-03-27 11:49:37 +09:00
Kouichi Nakanishi d0e42eff00 Ignore file generated by ctags 2017-03-26 12:51:48 +09:00
ksss b1c5c3b0a5 Fix lost lineno 2017-03-25 15:56:27 +09:00
Yukihiro "Matz" Matsumoto 051e40c049 Use MRB_PRId for NODE_NTH_REF; ref #3530 2017-03-23 01:52:52 +09:00
Yukihiro "Matz" Matsumoto 9eb0c11afd Cast to mrb_int to silence a warning; fix #3530 2017-03-23 01:20:45 +09:00
Yukihiro "Matz" Matsumoto 41f5c5b2c7 Merge pull request #3529 from kou/hash-ext-sub-class
Hash sub class creates new sub class objects instead of Hash
2017-03-23 01:14:46 +09:00
Yukihiro "Matz" Matsumoto 8ca9823196 Merge pull request #3536 from ksss/string-sub
Fix result if pattern is empty
2017-03-23 00:49:06 +09:00
ksss 63c0044b11 Fix result if pattern is empty 2017-03-22 22:19:34 +09:00
Kouhei Sutou e72e50b5d5 Hash sub class creates new sub class objects instead of Hash 2017-03-21 23:25:36 +09:00
Yukihiro "Matz" Matsumoto 3703aed7ab Use snprintf() to stringify fixnum numbers; ref #3492 2017-03-20 11:47:15 +09:00
Yukihiro "Matz" Matsumoto 339c6aed64 Add explicit cast from float to mrb_int. 2017-03-20 02:54:21 +09:00
Yukihiro "Matz" Matsumoto 631de65e0c Merge pull request #3527 from ksss/string-gsub
Update String#gsub and String#gsub!
2017-03-20 02:23:11 +09:00
Yukihiro "Matz" Matsumoto dcf6a413ca Use snprintf() to stringify fixnum numbers; fix #3492 2017-03-20 01:39:33 +09:00
Yukihiro "Matz" Matsumoto cea6a16cf4 Fixed some compiler errors regarding PRId. 2017-03-19 23:42:49 +09:00
ksss 7a74a617ea Callback should yield with pattern every time 2017-03-19 23:04:22 +09:00
ksss 67a6982710 Support to return Enumerator for String#gsub,gsub! 2017-03-19 22:45:14 +09:00
Yukihiro "Matz" Matsumoto 09574922a9 Should not check/call to_str for immediate objects; ref #3515 2017-03-19 20:59:30 +09:00
Yukihiro "Matz" Matsumoto 527dcd5247 super class error formats the superclass by inspect; rerf #3515 2017-03-19 20:58:34 +09:00
Yukihiro "Matz" Matsumoto ef105b5ca4 Use MRB_PRId instead of "%d"; fix #3515 2017-03-19 20:43:25 +09:00
Yukihiro "Matz" Matsumoto 4cf38eb903 Fixed OP_RESCUE code generation bug; fix #3519
916b8e let code executed with mrb->exc set, and may cause a crash
like #3519. Instead modified OP_RESCUE again. To retrieve the exception
object, we use `OP_RESCUE R(A), 0, 0` (old behavior). To compare the
exception object and the class, we use `OP_RESCUE R(A), R(B), 1`.

The reason we use OP_RESCUE for two instruction switched by operand
C is to save the instruction space.

As a result, the following code:
```ruby
begin
  raise "a"
rescue TypeError
  p 1
rescue RuntimeError
  p 2
end
```
will be compiled as:
```
irep 0x55cd1f565cb0 nregs=4 nlocals=1 pools=1 syms=4 reps=0
file: -
    2 000 OP_ONERR	005
    2 001 OP_LOADSELF	R1
    2 002 OP_STRING	R2	L(0)	; "a"
    2 003 OP_SEND	R1	:raise	1
    2 004 OP_JMP	023
    2 005 OP_RESCUE	R1
    3 006 OP_GETCONST	R2	:TypeError
    3 007 OP_RESCUE	R1	R2	cont
    3 008 OP_JMPIF	R2	010
    3 009 OP_JMP	014
    4 010 OP_LOADSELF	R1
    4 011 OP_LOADI	R2	1
    4 012 OP_SEND	R1	:p	1
    4 013 OP_JMP	024
    5 014 OP_GETCONST	R2	:RuntimeError
    5 015 OP_RESCUE	R1	R2	cont
    5 016 OP_JMPIF	R2	018
    5 017 OP_JMP	022
    6 018 OP_LOADSELF	R1
    6 019 OP_LOADI	R2	2
    6 020 OP_SEND	R1	:p	1
    6 021 OP_JMP	024
    6 022 OP_RAISE	R1
    6 023 OP_POPERR	1
    6 024 OP_STOP
```
2017-03-19 18:42:53 +09:00
Yukihiro "Matz" Matsumoto d01118d261 OP_RESCUE refactored; ref #3519 2017-03-19 18:40:58 +09:00
Yukihiro "Matz" Matsumoto 8d1468eab4 Remove cname duplication from exc_inspect(). 2017-03-19 08:05:19 +09:00
Yukihiro "Matz" Matsumoto e6b5c75ec5 Avoid possible infinite recursion in mrb_print_error(); ref #3517 2017-03-19 07:20:44 +09:00
Yukihiro "Matz" Matsumoto 2cbbeba0e0 Check call depth when mrb_yield_class() is called; ref #3521 2017-03-19 00:28:52 +09:00
Yukihiro "Matz" Matsumoto 75c374cad3 Update stack only when callinfo is popped; fix #3521 2017-03-19 00:28:52 +09:00
Yukihiro "Matz" Matsumoto 6db38c3768 Need not to call mrb_obj_as_string() is sep is nil. 2017-03-19 00:28:52 +09:00
Yukihiro "Matz" Matsumoto ce8697523f Merge pull request #3526 from ksss/sprintf
sprintf: Should use mrb_int for any object
2017-03-18 23:30:35 +09:00
ksss 2005bf997f Should use mrb_int for any object
o=Object.new
def o.to_int
  1
end
p "%*d" % [o, 1]
2017-03-18 22:06:01 +09:00
Yukihiro "Matz" Matsumoto fa502b498e Need to setup singleton_class chain; fix #3509 2017-03-18 18:06:37 +09:00
Yukihiro "Matz" Matsumoto 38a3b89d39 Small cosmetic change ("* " -> "*"). 2017-03-18 17:38:07 +09:00
Yukihiro "Matz" Matsumoto 6ea26aafd5 Save/restore GC arena index to avoid arena overflow error. 2017-03-18 17:37:24 +09:00
Yukihiro "Matz" Matsumoto 00427d45f5 Fixed access of uninitialized C local variable; fix #3525 2017-03-18 17:34:29 +09:00
Yukihiro "Matz" Matsumoto b2916f1b5c Avoid mrb_check_string_type() in raising exception; fix #3506
The change may reduce flexibility, but I believe no one wants
that level of flexibility here.
2017-03-18 02:34:56 +09:00
Yukihiro "Matz" Matsumoto 27fc76f6c6 Merge pull request #3524 from ksss/timestamp
MiniRake::Task#timestamp should use Time.now only
2017-03-17 16:00:50 +09:00
Yukihiro "Matz" Matsumoto fca17b41c7 Avoid trampoline when #eval is called from mrb_funcall(); fix #3522 2017-03-17 15:55:18 +09:00
ksss f99e100187 MiniRake::Task#timestamp should use Time.now only 2017-03-17 12:41:06 +09:00
Yukihiro "Matz" Matsumoto 9ecebebf3e Merge pull request #3510 from ksss/string-each_line
Some update for `String#each_line`
2017-03-16 22:18:15 +09:00
Yukihiro "Matz" Matsumoto 47cc5d66e3 Singleton classes do not have outer class set; fix #3505 2017-03-16 22:13:58 +09:00
Yukihiro "Matz" Matsumoto b64f08784c Protect stack region before calling mrb_convert_type(); fix #3504 2017-03-16 21:40:22 +09:00