Jeremy Evans
6a9ce1fea8
Support **nil syntax for specifying a method does not accept keyword arguments
...
This syntax means the method should be treated as a method that
uses keyword arguments, but no specific keyword arguments are
supported, and therefore calling the method with keyword arguments
will raise an ArgumentError. It is still allowed to double splat
an empty hash when calling the method, as that does not pass
any keyword arguments.
2019-08-30 12:39:31 -07:00
Yusuke Endoh
16c6984bb9
Separate keyword arguments from positional arguments
...
And, allow non-symbol keys as a keyword arugment
2019-08-30 12:39:31 -07:00
Nobuyoshi Nakada
01b723ba6d
Refined warnings against literal in flip-flop
2019-08-29 23:06:27 +09:00
Nobuyoshi Nakada
2ed68d0ff9
Revert "Add pipeline operator [Feature #15799 ]"
...
This reverts commits:
* d365fd5a02
* d780c36624
* aa7211836b
* 043f010c28
* bb4dd7c6af05c7821d572e2592ea3d0cc748d81f
* 043f010c28
* f169043d81
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/94645
2019-08-29 15:27:59 +09:00
Aaron Patterson
932a471d38
Directly mark compile options from the AST object
...
`rb_ast_t` holds a reference to this object, so it should mark the
object. Currently it is relying on the `mark_ary` on `node_buffer` to
ensure that the object stays alive. But since the array internals can
move, this could cause a segv if compaction impacts the array.
2019-08-27 11:43:18 -07:00
Kazuhiro NISHIYAMA
5d5502dc85
Fix typos
2019-08-24 21:26:24 +09:00
Nobuyoshi Nakada
d5b917d500
Named numbered parameter indexes
2019-08-24 01:10:42 +09:00
Jeremy Evans
53b3be5d58
Fix parsing of mutiple assignment with rescue modifier
...
Single assignment with rescue modifier applies rescue to the RHS:
a = raise rescue 1 # a = (raise rescue 1)
Previously, multiple assignment with rescue modifier applied rescue
to the entire expression:
a, b = raise rescue [1, 2] # (a, b = raise) rescue [1, 2]
This makes multiple assignment with rescue modifier consistent with
single assignment with rescue modifier, applying rescue to the RHS:
a, b = raise rescue [1, 2] # a, b = (raise rescue [1, 2])
Implements [Feature #8239 ]
Fixes [Bug #8279 ]
2019-08-09 09:25:30 -07:00
Takashi Kokubun
a3188f43a8
Revert "Revert "Fix dangling path name from fstring""
...
This reverts commit 326c00b6f8
.
We also confirmed that test_gced_eval_location fails without the changes:
567417818
20190804
T000003Z.fail.html.gz
20190804
T003005Z.fail.html.gz
20190804
T000007Z.fail.html.gz
20190804
T001806Z.fail.html.gz
20190804
T003005Z.fail.html.gz
2019-08-04 10:08:17 +09:00
Takashi Kokubun
326c00b6f8
Revert "Fix dangling path name from fstring"
...
This reverts commit 5931857281
temporarily,
leaving `TestEval#test_gced_eval_location` to see the impact for missing
the changes.
That's because too many CIs are failing for `require` behaviors:
20190803
T063004Z.fail.html.gz
20190803
T051806Z.fail.html.gz
20190803
T052406Z.fail.html.gz
20190803
T111909Z.fail.html.gz
20190803
T062506Z.fail.html.gz
20190803
T052505Z.fail.html.gz
5d4512c921
5d4512c921
http://ci.rvm.jp/results/trunk_gcc4@silicon-docker/2177591
http://ci.rvm.jp/results/trunk_gcc6@silicon-docker/2177596
http://ci.rvm.jp/results/trunk_clang_60@silicon-docker/2178802
http://ci.rvm.jp/results/trunk-theap-asserts@silicon-docker/2177555
http://ci.rvm.jp/results/trunk-mjit-wait@silicon-docker/2178747
Mostly `TestRequire#test_race_exception` failures, but in ci.rvm.jp
`require` inside rubyspec hangs very often.
2019-08-04 08:52:41 +09:00
Nobuyoshi Nakada
5931857281
Fix dangling path name from fstring
...
* parse.y (yycompile): make sure in advance that the `__FILE__`
object shares a fstring, to get rid of dangling path name.
Fixed up 53e9908d8a
. [Bug #16041 ]
* vm_eval.c (eval_make_iseq): ditto.
2019-08-03 13:48:29 +09:00
Nobuyoshi Nakada
688a59f8ac
Show the location of eval
which uses __FILE__
/__LINE__
2019-08-03 11:32:37 +09:00
Yusuke Endoh
e9e17cbc05
parse.y: make a warning for __FILE__ in eval by default
...
[Bug #4352 ]
2019-08-02 23:17:19 +09:00
Nobuyoshi Nakada
d488464106
Use predefined idOr
2019-08-01 16:35:43 +09:00
Nobuyoshi Nakada
fd461dea06
Ripper#validate_object: check if the object is hidden
2019-07-19 07:57:17 +09:00
Nobuyoshi Nakada
59d6ce4f4b
Moved RIPPER_DEBUG methods to Ripper from Kernel
2019-07-19 07:50:32 +09:00
Nobuyoshi Nakada
18bce998dd
Fixed build error with RIPPER_DEBUG
2019-07-19 07:50:32 +09:00
Nobuyoshi Nakada
a027c4b5b0
Use Qnull instead of 0 and Qundef
2019-07-19 06:23:19 +09:00
Nobuyoshi Nakada
0e23e0c3a0
Adjust indent [ci skip]
2019-07-17 17:04:37 +09:00
Yusuke Endoh
711dfec3fa
parse.y (here_document): remove dead code
...
str is always zero when evaluating the branch.
Found by Coverity Scan.
2019-07-15 14:08:17 +09:00
Yusuke Endoh
9e3971c3ad
Add a /* fall through */ comment
2019-07-15 00:29:56 +09:00
Yusuke Endoh
20a3fb3c4b
Add a /* fall through */ comment
2019-07-14 21:34:32 +09:00
Nobuyoshi Nakada
4e038a7e64
Revert "parse.y: Deprecate flip-flops"
...
This reverts commit bae638ad5b
.
[Feature #5400 ]
2019-07-11 14:52:02 +09:00
Nobuyoshi Nakada
49cad67635
Removed duplicate assignment
...
This `last_state` is set to `lex.state` just before the `switch`
statement, and `token_flush` nor `nextc` never change the state.
2019-07-10 00:20:00 +09:00
Nobuyoshi Nakada
995ae6d529
Check indent of end
against else
if present
2019-07-08 17:09:59 +09:00
Nobuyoshi Nakada
a13636e756
Message to pipe should end with a newline
2019-07-07 18:18:22 +09:00
Nobuyoshi Nakada
d548073f68
Enable indentation warning against if
just after else
...
```ruby
if false
puts 'false'
else if true
puts 'true'
end # -:5: warning: mismatched indentations at 'end' with 'if' at 3
end
```
[Feature #15990 ]
2019-07-07 15:47:40 +09:00
Nobuyoshi Nakada
789e49dc7e
Renamed column in token_info to indent
2019-07-07 14:43:54 +09:00
Nobuyoshi Nakada
d746a41e85
Multiple codepoints are not allowed at single character literal
...
It has unintentionally passed since 2.5.
2019-07-05 22:39:54 +09:00
Kazuhiro NISHIYAMA
fae4489a3a
Fix a typo
2019-07-05 19:00:37 +09:00
Nobuyoshi Nakada
f19e048d24
Do not dispatch a nil token in ripper
...
As a comment token includes the newline, so delayed newline token
just follows it should not be dispatched. [Bug #11485 ]
Co-Authored-By: Jeremy Evans <code@jeremyevans.net>
2019-07-04 15:58:47 +09:00
Nobuyoshi Nakada
78a8888c3e
Hoisted out f_rest_marg
...
* parse.y (f_rest_marg): extract named and unnamed rest parameter
in parenthesized method arguments, and should not be warned as
unused.
2019-06-30 10:57:24 +09:00
Nobuyoshi Nakada
27723b699b
Should not warn massign parameters as unused
2019-06-29 18:45:24 +09:00
Nobuyoshi Nakada
1f7cb4bee9
Omit EXPR_
prefix to show lex_state
2019-06-27 20:31:10 +09:00
Nobuyoshi Nakada
097554855c
Fix ripper fatal
...
* parse.y (parser_yylex): return END_OF_INPUT at unterminated here
document instead of an error. [Bug #15962 ]
2019-06-27 15:32:03 +09:00
Nobuyoshi Nakada
c8e9e0b74b
Fix wrong "void value expression" error
...
* parse.y (value_expr_check): `then` or `else` only `if` is not a
void value expression, as the counterpart is evaluated as `nil`.
[Bug #15932 ]
2019-06-17 22:30:52 +09:00
Nobuyoshi Nakada
01b3a38043
Fix wrong "void value expression" error
...
* parse.y (value_expr_check): if either of `then` or `else`
statements is not a void value expression, the whole `if` is not
also a void value expression. [Bug #15932 ]
2019-06-17 21:44:06 +09:00
Nobuyoshi Nakada
a064e46762
Support Bison 3
2019-06-17 03:09:52 +09:00
Nobuyoshi Nakada
53e9908d8a
Fix memory leak
...
* string.c (str_replace_shared_without_enc): free previous buffer
before replaced.
* parse.y (gettable): make sure in advance that the `__FILE__`
object shares a fstring, to get rid of replacement with the
fstring later.
TODO: this hack may be needed in other places.
[Bug #15916 ]
Co-Authored-By: luke-gru (Luke Gruber) <luke.gru@gmail.com>
2019-06-16 23:51:22 +09:00
Nobuyoshi Nakada
5d79054906
Revert github/pull/2230, commit miss
2019-06-15 12:04:16 +09:00
Nobuyoshi Nakada
6fa4c90448
Prefer enum yytokentype
to int
2019-06-15 11:58:02 +09:00
Josh Cheek
b8730f1251
Multiline method chain with leading dot works for blank lines
2019-06-15 11:25:38 +09:00
Josh Cheek
2240de98c0
Remove blank line I accidentally added
2019-06-15 11:25:38 +09:00
Josh Cheek
cc180e9371
Rename LINEND to EMPTYLN
2019-06-15 11:25:38 +09:00
Josh Cheek
5af5dd4639
Omg, it works!
...
I'll rename it and squash this commit later,
just wanted to make sure I couldn't lose it
(took a long time to come up with).
2019-06-15 11:25:13 +09:00
Nobuyoshi Nakada
d365fd5a02
An operator is not allowed just after |>
...
https://twitter.com/yukihiro_matz/status/1139454774640726019
2019-06-14 18:17:50 +09:00
Nobuyoshi Nakada
aa7211836b
Continue to the next line beginning with a pipeline
2019-06-13 22:19:47 +09:00
Nobuyoshi Nakada
043f010c28
parse.y: moved pipeline to expr
...
To allow arguments without parentheses.
2019-06-13 22:03:10 +09:00
Nobuyoshi Nakada
f169043d81
Add pipeline operator [Feature #15799 ]
2019-06-13 18:44:32 +09:00
Nobuyoshi Nakada
39ae88ad0d
Refined syntax error messages
2019-06-11 22:31:57 +09:00