dearblue
f5d5caaf82
Clean duplicate code
...
Removed duplicates in the code entered for "Concatenate string literal".
2019-05-03 11:36:31 +09:00
Yukihiro "Matz" Matsumoto
e74a8a7360
Merge pull request #4376 from dearblue/leak-symbols
...
Fix leaked function symbols
2019-04-14 20:35:19 +09:00
dearblue
3f3e4754d9
Fix leaked function symbols
...
- `free_heap()` in src/gc.c
- `symhash()` in src/symbol.c
- `no_optimize()` in mrbgems/mruby-compiler/core/codegen.c
2019-04-14 17:23:16 +09:00
dearblue
dac0f3f5e8
Fix string index for appending
...
`sizeof(string-literal)` is included `'\0'` character
2019-04-14 16:16:05 +09:00
dearblue
c2fa935fee
Fix hexdigits convertion
2019-04-14 16:11:21 +09:00
Yukihiro "Matz" Matsumoto
befdf59e61
Deallocate s->lines in codegen_error; ref #4370
2019-04-12 22:54:25 +09:00
Yukihiro "Matz" Matsumoto
00545fc51d
The number of local variables should be less than 1024; fix #4370
...
The `env` stores stack length in a 10 bit field.
See `MRB_ENV_STACK_LEN()` macro.
2019-04-12 22:52:26 +09:00
Clayton Smith
57e617620a
Fix buffer overflows in parser.
2019-04-11 20:07:43 -04:00
Yukihiro "Matz" Matsumoto
d529501cbf
Rename itoa to dump_int to avoid name crash; ref #4173
2019-04-10 05:55:40 +09:00
Yukihiro "Matz" Matsumoto
ec1688807e
Avoid using snprintf when MRB_DISABLE_STDIO is set; fix #4173
2019-04-08 19:06:36 +09:00
Yukihiro "Matz" Matsumoto
2871d0cdc5
Avoid keeping pointers from mrb_sym2name_len(); fix #4342
...
The addresses for packed inline symbols reference `mrb->symbuf` that
could be overridden by the later call of `mrb_sym2name_len`. Since
file names in call stack information are kept as symbols, keeping the
address in the C structures could cause problems like #4342 .
This changes small incompatible changes in function prototypes:
* `mrb_parser_get_filename`: return value changed to `mrb_sym`.
* `mrb_debug_get_filename`: add `mrb_state*` as a first argument.
* `mrb_debug_get_line`: ditto.
I believe above functions are almost internal, and no third-party
mrbgem use them.
2019-04-01 14:13:06 +09:00
Yukihiro "Matz" Matsumoto
a5a6b51126
Use uppercase version of ctype macros e.g. ISSPACE; fix #4338
2019-03-25 22:05:31 +09:00
KOBAYASHI Shuji
8c04ba2222
Add warning: prefix to parser warning message
2019-02-28 19:54:45 +09:00
Yukihiro "Matz" Matsumoto
4f3067fe2f
Merge pull request #4301 from shuujii/remove-unnecessary-backticks
...
Remove unnecessary backticks; ref #2858
2019-02-28 12:55:26 +09:00
dearblue
e871a1538d
Compositing NODE_DSTR and NODE_DSTR
2019-02-27 22:58:13 +09:00
dearblue
4d2bb3cb47
Compositing NODE_DSTR and NODE_STR
2019-02-27 22:58:13 +09:00
dearblue
8ead6da913
Compositing NODE_STR and NODE_DSTR
2019-02-27 22:58:13 +09:00
dearblue
25957421bc
Replacement to function for composite two string nodes
2019-02-27 22:58:13 +09:00
dearblue
477e5285e8
Replacement to function for NODE_STR cheking
2019-02-27 22:58:09 +09:00
dearblue
9913643ed8
Compositing NODE_STR and NODE_STR
2019-02-27 22:57:45 +09:00
dearblue
cece016389
Concatenate string literals
2019-02-27 22:35:53 +09:00
KOBAYASHI Shuji
c11bd075f7
Remove unnecessary backticks; ref #2858
2019-02-27 20:27:29 +09:00
KOBAYASHI Shuji
2894625089
Use yywarning() instead of yywarning_s() for MRB_WITHOUT_FLOAT
2019-02-27 20:21:40 +09:00
Yukihiro "Matz" Matsumoto
4ccc3f1525
Use key argument register for OP_KEY_P to reduce register use.
2019-02-18 17:25:01 +09:00
KOBAYASHI Shuji
c6e2d91536
Small refactoring in codegen.c
2019-02-11 21:09:40 +09:00
Yukihiro "Matz" Matsumoto
bdc9de875f
Add OP_ENTER to blocks without parameters; fix #4175
...
So that `lambda{}.call(1)` raises `ArgumentError` as CRuby does.
Also, fixed junk assignment for `lambda{|;a|p a}.call{}`.
2019-02-07 22:44:36 +09:00
KOBAYASHI Shuji
abbc501433
class/module expression with empty body should return nil
...
Before:
p(class A end) #=> A
p(class << self; end) #=> #<Class:#<Object:0x7fdc3880e420>>
p(module B end) #=> B
After/Ruby:
p(class A end) #=> nil
p(class << self; end) #=> nil
p(module B end) #=> nil
2019-01-28 21:29:55 +09:00
KOBAYASHI Shuji
c8f904b7f5
Fix 0.0 and -0.0 handling.
...
Fix the following issue:
Good:
$ bin/mruby -e 'p(-0.0)' #=> "-0"
Bad:
$ bin/mruby -e 'a=0.0; p(-0.0)' #=> "0"
2019-01-06 23:05:13 +09:00
Yukihiro "Matz" Matsumoto
b04506cdcc
Should not check non-node value to void_expr_error; fix #4203
...
This is also a reason for #4192 as well.
2018-12-31 12:52:27 +09:00
Yukihiro "Matz" Matsumoto
94b73b1440
Add NULL pointer check before void_expr_error(); fix #4192
2018-12-21 09:35:10 +09:00
Yukihiro "Matz" Matsumoto
762f682b80
Allow destructuring in formal arguments.
...
e.g.
```
def m(a,(b,c),d); p [a,b,c,d]; end
m(1,[2,3],4) # => [1,2,3,4]
```
mruby limitation:
Destructured arguments (`b` and `c` in above example) cannot be accessed
from the default expression of optional arguments and keyword arguments,
since actual assignment is done after the evaluation of those default
expressions. Thus:
```
def f(a,(b,c),d=b)
p [a,b,c,d]
end
f(1,[2,3])
```
raises `NoMethodError` for `b` in mruby.
2018-11-25 09:07:49 +09:00
Yukihiro "Matz" Matsumoto
e6b72b2121
Remove redundant rules from parse.y.
2018-11-25 07:30:32 +09:00
Yukihiro "Matz" Matsumoto
ec19c34a20
Fixed a bug in mirb heredoc handling; fix #3989
2018-11-20 10:39:34 +09:00
Yukihiro "Matz" Matsumoto
f1eeaad84a
Stop special treating of \r in the lexer; fix #4132
2018-11-20 09:35:38 +09:00
Yukihiro "Matz" Matsumoto
423f872c84
Need to keep rooms for empty splat; fix #4166
2018-11-19 15:26:19 +09:00
Yukihiro "Matz" Matsumoto
418ad65db4
Fixed a bug in continuous read of target files; ref #4138
...
Line number information in a compiled file was wrong.
2018-11-15 23:34:32 +09:00
Yukihiro "Matz" Matsumoto
7e3e8d8ed5
Shrink file name table size to uint16_t; ref #4138
2018-11-15 23:34:32 +09:00
Yukihiro "Matz" Matsumoto
61f49690e4
Remove filename&lines from mrb_irep struct.
...
This patch slightly reduce memory consumption (2% for my test).
2018-11-15 21:01:56 +09:00
Yukihiro "Matz" Matsumoto
d9e2532552
Remove reserved symbols for now.
...
It should be done by planned embedded symbols.
2018-11-02 22:58:12 +09:00
take-cheeze
6a6586ca84
Reduce unnecessary symbol table entry
2018-10-29 19:40:33 +09:00
take-cheeze
3248de83b6
Reduce instruction size
2018-10-29 19:17:05 +09:00
take-cheeze
b37b312081
Rename libmruby stuff to avoid confusion
2018-10-29 14:07:16 +09:00
Yukihiro "Matz" Matsumoto
fdd5ce8fac
Fixed a bug caused by too much optimization; fix #4137
2018-10-13 00:31:13 +09:00
Yukihiro "Matz" Matsumoto
d2313aebd6
Fixed broken stack consistency; fix #4135
2018-10-12 23:26:14 +09:00
dearblue
366848996a
Clear terminated space
2018-09-07 22:32:34 +09:00
Yukihiro "Matz" Matsumoto
4cd4c64266
Need to support multiple ** splats in argument list; fix #4106
2018-09-06 14:40:21 +09:00
Yukihiro "Matz" Matsumoto
a657117e4e
Avoid warning in MSVC compilation.
2018-09-01 17:36:35 +09:00
Yukihiro "Matz" Matsumoto
20c0c6330f
Too much peephole optimization in gen_call; fix #4091
...
It causes trouble for safe navigation operator.
2018-09-01 17:14:54 +09:00
Yukihiro "Matz" Matsumoto
75a01af710
Remove consequent OP_RETURN by peephole optimization.
2018-08-30 01:23:17 +09:00
Yukihiro "Matz" Matsumoto
441ff45a51
Merge branch 'node_negate_fix' of https://github.com/ukrainskiysergey/mruby into ukrainskiysergey-node_negate_fix
2018-08-29 13:29:54 +09:00