Commit Graph

10927 Commits

Author SHA1 Message Date
Yukihiro "Matz" Matsumoto 67ea80b2bd Fixed a bug in Array#difference. 2019-10-14 17:04:19 +09:00
Yukihiro "Matz" Matsumoto 265034134a Merge pull request #4772 from shuujii/refactor-mrb_class_name_class
Refactor `mrb_class_name_class`
2019-10-13 17:20:46 +09:00
KOBAYASHI Shuji 6377c9bce5 Refactor mrb_class_name_class
- Use `mrb_sym_name_len` instead of `mrb_sym_name` (class name should not
  be escaped).
- Avoid `mrb_str_dup` (it is unnecessary to be shared string because it is
  changed).
2019-10-13 17:03:39 +09:00
Yukihiro "Matz" Matsumoto d128e2d09e Merge pull request #4770 from shuujii/sHARED-string-is-not-required-when-sharing-POOL-string
SHARED string is not required when sharing POOL string
2019-10-12 23:35:43 +09:00
Yukihiro "Matz" Matsumoto 9f3b6ebbde Merge pull request #4769 from shuujii/rename-str_make_shared-to-str_share
Rename `str_make_shared()` to `str_share()` in `src/string.c`
2019-10-12 23:33:20 +09:00
KOBAYASHI Shuji 7594983671 SHARED string is not required when sharing POOL string
The heap string buffer of POOL string always exists, does not need to be
released, and read only, so it can be shared as NOFREE string.
2019-10-12 21:32:56 +09:00
KOBAYASHI Shuji cdd36c979d Rename str_make_shared() to str_share() in src/string.c
Because it may not create `struct mrb_shared_string`.
2019-10-12 12:49:51 +09:00
Yukihiro "Matz" Matsumoto c310c8dc24 Move exception raising to scope_new.
Besides that fix bugs that mistakenly calls `raise_error` that emits
code to raise runtime error instead of `codegen_error` that terminates
code generation immediately.
2019-10-11 20:31:29 +09:00
Yukihiro "Matz" Matsumoto 20ceee794b Merge pull request #4767 from shuujii/remove-unused-exception-classes-in-mruby-io-gem
Remove unused exception classes in `mruby-io` gem
2019-10-11 19:54:44 +09:00
KOBAYASHI Shuji a7ae0d5b9e Remove unused exception classes in mruby-io gem 2019-10-11 11:32:14 +09:00
Yukihiro "Matz" Matsumoto 529a336966 Fixed a bug in mruby-time with NO_GETTIMEOFDAT. 2019-10-10 20:46:12 +09:00
Yukihiro "Matz" Matsumoto 78e54904b5 Silence double free warnings by mrb_local_free().
The warnings were detected by cppcheck.
2019-10-10 20:46:12 +09:00
Yukihiro "Matz" Matsumoto 8fe6a1904c Merge pull request #4764 from shuujii/integrate-mrb_str_inspect-and-mrb_str_dump
Integrate `mrb_str_inspect` and `mrb_str_dump`
2019-10-10 20:45:59 +09:00
KOBAYASHI Shuji 7ce5d33947 Integrate mrb_str_inspect and mrb_str_dump 2019-10-10 19:50:48 +09:00
Yukihiro "Matz" Matsumoto 20aab8a10b Merge pull request #4763 from shuujii/mrdb-Fix-that-print-command-raises-FrozenError
Fix that `print` command raises `FrozenError` in `mrdb`; ref 1f5a7f2f
2019-10-09 22:47:12 +09:00
KOBAYASHI Shuji 7f6e8e8ddc Fix that print command raises FrozenError in mrdb; ref 1f5a7f2f
#### Before this patch:

  ```
  $ echo 'p true' | bin/mrdb /dev/null
  (/dev/null:1) mruby application exited.
  FrozenError: can't modify frozen String
  (-:0)
  ```

#### After this patch:

  ```
  $ echo 'p true' | bin/mrdb /dev/null
  (/dev/null:1) $1 = true
  (/dev/null:1)
  ```
2019-10-09 20:00:17 +09:00
Yukihiro "Matz" Matsumoto 7624e23426 Revert part of #4758 to reduce number of tests.
More tests, more time.
2019-10-09 10:29:04 +09:00
Yukihiro "Matz" Matsumoto 3e9b501ff8 Merge pull request #4761 from take-cheeze/fix_4759
Add mrbgem version field to lock file
2019-10-09 08:01:52 +09:00
take-cheeze f7616c4287 Add mrbgem version field to lock file 2019-10-09 02:22:33 +09:00
Yukihiro "Matz" Matsumoto b68818a8a0 Merge pull request #4758 from shuujii/implement-Ruby2.7-frozen-strings-from-Module-name
Implement Ruby2.7's frozen strings from `Module#name`
2019-10-08 22:25:43 +09:00
Yukihiro "Matz" Matsumoto e348326fa7 Merge pull request #4760 from shuujii/use-mrb_str_concat-instead-of-mrb_str_to_str-plus-mrb_str_cat_str
Use `mrb_str_concat` instead of `mrb_str_to_str` + `mrb_str_cat_str`
2019-10-08 22:23:59 +09:00
KOBAYASHI Shuji 97c62408fb Use mrb_str_concat instead of mrb_str_to_str + mrb_str_cat_str 2019-10-08 18:55:45 +09:00
KOBAYASHI Shuji fb103c1319 Implement Ruby2.7's frozen strings from Module#name 2019-10-08 17:34:13 +09:00
Yukihiro "Matz" Matsumoto b7a8d538c1 Remove unnecessary function: mrb_str_freeze. 2019-10-06 22:18:11 +09:00
Yukihiro "Matz" Matsumoto ff1ac49a72 Merge pull request #4754 from dearblue/get-keyword-args
Get keyword arguments with `mrb_get_args()`
2019-10-06 22:08:15 +09:00
dearblue 5f929d6940 Get keyword arguments with mrb_get_args()
Keyword arguments can now be retrieved with the `:` specifier and
`mrb_kwargs` data.

For the interface, I referred to CRuby's `rb_get_kwargs()`.
For implementation, I referred to `OP_KARG` or etc.
2019-10-06 21:23:55 +09:00
Yukihiro "Matz" Matsumoto ffaa2968ed Merge pull request #4757 from shuujii/refine-the-usage-message-of-mirb-command
Refine the usage message of `mirb` command
2019-10-06 20:23:30 +09:00
Yukihiro "Matz" Matsumoto 028ab5a143 Merge pull request #4755 from shuujii/refine-the-usage-message-of-mruby-command
Refine the usage message of `mruby` command
2019-10-06 20:23:04 +09:00
KOBAYASHI Shuji ea14df2e3a Refine the usage message of mirb command 2019-10-06 20:12:28 +09:00
KOBAYASHI Shuji 0cdc984b1c Refine the usage message of mruby command 2019-10-06 19:35:41 +09:00
Yukihiro "Matz" Matsumoto c613813364 Merge pull request #4752 from shuujii/drop-initialization-dependency-from-mruby-print-to-mruby-sprintf
Drop initialization dependency from `mruby-print` to `mruby-sprintf`
2019-10-05 17:18:12 +09:00
KOBAYASHI Shuji 1d8456fe7d Drop initialization dependency from mruby-print to mruby-sprintf
In the old implementation, `Kernel#printf` raise error if `mruby-sprintf`
gem isn't specified before `mruby-print` gem. The new implementation
eliminates this ordering issue. This way is the same as `Kernel#printf` and
`IO#printf` in `mruby-io` gem.
2019-10-05 15:22:43 +09:00
Yukihiro "Matz" Matsumoto 1f5a7f2f49 Freeze strings from nil.to_s, true.to_s, false.to_s.
This is an experimental changes in Ruby 2.7.
2019-10-04 16:02:50 +09:00
Yukihiro "Matz" Matsumoto 08eafe21d3 Implement Ruby2.7's frozen strings from Symbol#to_s. 2019-10-04 14:42:01 +09:00
Yukihiro "Matz" Matsumoto 264239f78f Refactor local variables addition in optional/keyword arguments. 2019-10-04 14:39:53 +09:00
Yukihiro "Matz" Matsumoto d4e9de84c5 Merge pull request #4751 from shuujii/remove-unused-code-to-old-Visual-Studio
Remove unused code to old Visual Studio in `tasks/toolchains/visualcpp.rake`
2019-10-04 10:11:30 +09:00
KOBAYASHI Shuji edd412966e Remove unused code to old Visual Studio in tasks/toolchains/visualcpp.rake 2019-10-04 09:31:54 +09:00
Yukihiro "Matz" Matsumoto 4695542f37 Merge pull request #4750 from dearblue/c++-abi
Remove duplicates header files in `src/pool.c`
2019-10-04 08:03:38 +09:00
dearblue fab062f7b5 Remove duplicates header files in src/pool.c
These are included in `mruby.h`.

As a background, if `enable_cxx_abi` is specified, the macro that
defines the maximum value in `stdint.h` is undefined depending on the
environment.

- Confirmed with gcc on FreeBSD 12.0 and mingw32-gcc available on
  FreeBSD.
- `INTPTR_MAX`, `INT64_MAX` and `UINT64_MAX` are defined by `cstdint`
  added in C++11. But `toolchains :gcc` adds `-std=c++03`, so the macros
  are not defined.
- To have these defined in `C++03`, `__STDC_CONSTANT_MACROS` must be
  defined in advance. This is already done by `mruby.h`.
2019-10-03 23:32:24 +09:00
Yukihiro "Matz" Matsumoto de176d37e0 Merge pull request #4749 from shuujii/add-tests-for-4746
Add tests for #4746
2019-10-03 21:30:23 +09:00
KOBAYASHI Shuji 882bc80dd0 Add tests for #4746 2019-10-03 16:59:18 +09:00
Yukihiro "Matz" Matsumoto 3d2781311e Merge pull request #4748 from HirohitoHigashi/master
Fix opcode semantics comment miss.
2019-10-03 15:18:06 +09:00
Hirohito Higashi 63496a6730 Fix opcode semantics comment miss. (op_jmpnil) 2019-10-03 15:06:06 +09:00
Hirohito Higashi b4bf7a2282 Fix opcode semantics comment miss. 2019-10-03 14:44:47 +09:00
Yukihiro "Matz" Matsumoto ec6c8b2a3c Add local variable reordering to kwargs; ref #4746 2019-10-03 09:17:37 +09:00
Yukihiro "Matz" Matsumoto 47cdda370e Need to reorder local variables defined in opt; fix #4746
For example, local variables in the following def:
```ruby
def foo(a = (not_set = true), &block)
  ...
end
```
should be `a, block, not_set`, but were `a, not_set, block`.
2019-10-03 07:52:31 +09:00
Yukihiro "Matz" Matsumoto 306f02117b Refactor append_gen function. 2019-10-03 07:52:03 +09:00
Yukihiro "Matz" Matsumoto a406a35cf8 Merge pull request #4747 from shuujii/avoid-symhash-call-for-inline-symbol-in-sym_intern
Avoid `symhash()` call for inline symbol in `sym_intern()`
2019-10-02 23:36:32 +09:00
KOBAYASHI Shuji 855d996847 Avoid symhash() call for inline symbol in sym_intern() 2019-10-02 16:56:22 +09:00
Yukihiro "Matz" Matsumoto c33100c4f0 Merge pull request #4736 from dearblue/ast-strdump
Escape the AST string
2019-10-02 07:07:20 +09:00