Commit Graph

10898 Commits

Author SHA1 Message Date
KOBAYASHI Shuji ea14df2e3a Refine the usage message of mirb command 2019-10-06 20:12:28 +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
Yukihiro "Matz" Matsumoto 97433c0263 Merge pull request #4745 from shuujii/dump-more-node-types
Dump more node types in `mrb_parser_dump`
2019-10-01 19:35:11 +09:00
KOBAYASHI Shuji 8df2763b56 Support NODE_LITERAL_DELIM in mrb_parser_dump
#### Before this patch:

  ```terminal
  $ bin/mruby -v -e '%w[1 2]'
  mruby 2.0.1 (2019-04-04)
  00001 NODE_SCOPE:
  00001   NODE_BEGIN:
  00001     NODE_WORDS:
  00001       NODE_STR "1" len 1
  00001       node type: 85 (0x55)
  00001       NODE_STR "2" len 1
  (snip)
  ```

#### After this patch:

  ```terminal
  $ bin/mruby -v -e '%w[1 2]'
  mruby 2.0.1 (2019-04-04)
  00001 NODE_SCOPE:
  00001   NODE_BEGIN:
  00001     NODE_WORDS:
  00001       NODE_STR "1" len 1
  00001       NODE_LITERAL_DELIM
  00001       NODE_STR "2" len 1
  (snip)
  ```
2019-10-01 17:20:39 +09:00
KOBAYASHI Shuji 42c7f2d6b0 Support NODE_SYMBOLS in mrb_parser_dump
#### Before this patch:

  ```terminal
  $ bin/mruby -v -e '%i[1]; %I[#{2}]'
  mruby 2.0.1 (2019-04-04)
  00001 NODE_SCOPE:
  00001   NODE_BEGIN:
  00001     node type: 87 (0x57)
  00001     node type: 87 (0x57)
  (snip)
  ```

#### After this patch:

  ```terminal
  $ bin/mruby -v -e '%i[1]; %I[#{2}]'
  mruby 2.0.1 (2019-04-04)
  00001 NODE_SCOPE:
  00001   NODE_BEGIN:
  00001     NODE_SYMBOLS:
  00001       NODE_STR "1" len 1
  00001     NODE_SYMBOLS:
  00001       NODE_STR "" len 0
  00001       NODE_BEGIN:
  00001         NODE_INT 2 base 10
  00001       NODE_STR "" len 0
  (snip)
  ```
2019-10-01 17:10:34 +09:00
KOBAYASHI Shuji 732ef6b10e Support NODE_WORDS in mrb_parser_dump
#### Before this patch:

  ```terminal
  $ bin/mruby -v -e '%w[1]; %W[#{2}]'
  mruby 2.0.1 (2019-04-04)
  00001 NODE_SCOPE:
  00001   NODE_BEGIN:
  00001     node type: 86 (0x56)
  00001     node type: 86 (0x56)
  (snip)
  ```

#### After this patch:

  ```terminal
  $ bin/mruby -v -e '%w[1]; %W[#{2}]'
  mruby 2.0.1 (2019-04-04)
  00001 NODE_SCOPE:
  00001   NODE_BEGIN:
  00001     NODE_WORDS:
  00001       NODE_STR "1" len 1
  00001     NODE_WORDS:
  00001       NODE_STR "" len 0
  00001       NODE_BEGIN:
  00001         NODE_INT 2 base 10
  00001       NODE_STR "" len 0
  (snip)
  ```
2019-10-01 17:07:30 +09:00
Yukihiro "Matz" Matsumoto cdb35a12fc Merge pull request #4744 from shuujii/remove-a-trailing-space-in-MRUBY_DESCRIPTION
Remove a trailing space in `MRUBY_DESCRIPTION`
2019-10-01 12:16:27 +09:00
KOBAYASHI Shuji 482d0626b8 Remove a trailing space in MRUBY_DESCRIPTION 2019-09-30 21:39:13 +09:00
KOBAYASHI Shuji 16745261e3 Support NODE_DSYM in mrb_parser_dump
#### Before this patch:

  ```terminal
  $ bin/mruby -v -e ':"#{1}"; ["#{2}": 0]'
  mruby 2.0.1 (2019-04-04)
  00001 NODE_SCOPE:
  00001   NODE_BEGIN:
  00001     node type: 83 (0x53)
  00001     NODE_ARRAY:
  00001       NODE_KW_HASH:
  00001         key:
  00001           node type: 83 (0x53)
  00001         value:
  00001           NODE_INT 0 base 10
  (snip)
  ```

#### After this patch:

  ```terminal
  $ bin/mruby -v -e ':"#{1}"; ["#{2}": 0]'
  mruby 2.0.1 (2019-04-04)
  00001 NODE_SCOPE:
  00001   NODE_BEGIN:
  00001     NODE_DSYM:
  00001       NODE_DSTR:
  00001         NODE_STR "" len 0
  00001         NODE_BEGIN:
  00001           NODE_INT 1 base 10
  00001         NODE_STR "" len 0
  00001     NODE_ARRAY:
  00001       NODE_KW_HASH:
  00001         key:
  00001           NODE_DSYM:
  00001             NODE_DSTR:
  00001               NODE_STR "" len 0
  00001               NODE_BEGIN:
  00001                 NODE_INT 2 base 10
  00001               NODE_STR "" len 0
  00001         value:
  00001           NODE_INT 0 base 10
  (snip)
  ```
2019-09-30 11:54:51 +09:00
Yukihiro "Matz" Matsumoto 9ddde3be39 Merge pull request #4742 from dearblue/mrb_hash_value
Remove unnecessary type `mrb_hash_value`
2019-09-30 03:06:56 +09:00
dearblue 40e8a90e89 Remove unnecessary type mrb_hash_value
The type `mrb_hash_value` is no longer used by the segmented list
implementation (ref e8dcfe1 and e65d426).
2019-09-29 23:55:38 +09:00
Yukihiro "Matz" Matsumoto 4621907fca Merge pull request #4741 from shuujii/print-missing-colon-before-newline-in-mrb_parser_dump
Print missing `:` before newline in `mrb_parser_dump`
2019-09-29 22:05:41 +09:00
KOBAYASHI Shuji a5d140ae42 Print missing : before newline in mrb_parser_dump 2019-09-29 17:14:52 +09:00
Yukihiro "Matz" Matsumoto e55f881bc2 Merge pull request #4740 from dearblue/rethrow-break
Allow rethrowing `MRB_TT_BREAK`
2019-09-29 15:38:16 +09:00
dearblue d8f1099419 Allow rethrowing MRB_TT_BREAK 2019-09-29 15:11:36 +09:00
Yukihiro "Matz" Matsumoto ccf7a8248f Merge pull request #4739 from dearblue/restore-arena
Restore GC arena frequently
2019-09-29 14:40:29 +09:00
Yukihiro "Matz" Matsumoto a1886942eb Further refactoring over #4738 2019-09-29 14:30:41 +09:00
Yukihiro "Matz" Matsumoto c5d500d51e Merge pull request #4738 from dearblue/unneed-assign
Remove unnecessary assignments
2019-09-29 14:29:07 +09:00
dearblue 39855a3304 Restore GC arena frequently 2019-09-29 13:57:22 +09:00
Yukihiro "Matz" Matsumoto 704c40bfa2 Merge pull request #4737 from dearblue/hash-delete
Add an annotation about the return value
2019-09-29 13:56:31 +09:00
Yukihiro "Matz" Matsumoto bbfd64d01b Add an annotation of the return value from mrb_delete_key; #4737
The return value from `mrb_delete_key` needs to be protected from GC in
some cases.
2019-09-29 13:53:45 +09:00
dearblue e48207cdb3 Remove unnecessary assignments 2019-09-29 13:45:16 +09:00
Yukihiro "Matz" Matsumoto acbea6affe Merge pull request #4735 from shuujii/remove-unused-node-type-in-codegen
Remove unused node type in `codegen()`
2019-09-29 12:47:16 +09:00
dearblue f6d3d675ab Add an annotation about the return value 2019-09-29 11:49:15 +09:00
dearblue e2f54ff594 Escape the AST string 2019-09-29 10:39:55 +09:00
KOBAYASHI Shuji ae530d89c4 Remove unused node type in codegen() 2019-09-28 15:15:31 +09:00
Yukihiro "Matz" Matsumoto 19e4f56c67 Merge pull request #4734 from shuujii/simplify-arguments-check-in-String-rindex
Simplify arguments check in `String#rindex`
2019-09-28 00:20:01 +09:00
Yukihiro "Matz" Matsumoto 2de757eef0 Replace mrb_sym_name with mrb_sym_dump; ref #4684 2019-09-28 00:06:01 +09:00
KOBAYASHI Shuji 198683e914 Simplify arguments check in String#rindex
Also fix document about type of the first argument.
2019-09-27 17:13:57 +09:00
Yukihiro "Matz" Matsumoto 5cd6ed4511 Merge pull request #4733 from shuujii/use-type-predicate-macros-instead-of-mrb_type-if-possible
Use type predicate macros instead of `mrb_type` if possible
2019-09-27 00:00:03 +09:00
Yukihiro "Matz" Matsumoto d4be545d54 Fixed codedump for human readable symbol format; ref #4684 2019-09-26 23:56:40 +09:00