Граф коммитов

2389 Коммитов

Автор SHA1 Сообщение Дата
TSUYUSATO Kitsune fe746747b4 Reject 'class << (return); end` by "void value expression" 2023-11-21 14:07:47 +09:00
yui-knk 51149f335e Keep unused literal nodes
For static analysis, it’s better to keep unused literal nodes.
If simply change `block_append` to fall through, both "unused literal ignored"
and "possibly useless use of a literal in void context" warnings
are shown for the same line. But it’s verbose then remove
"unused literal ignored" warning.

This kind of optimization is already implemented on compile.c.
`compile_block` calls `iseq_compile_each0` with `popped = 1` when NODE_BLOCK
has next.
2023-10-31 17:49:12 +09:00
Nobuyoshi Nakada 13c9cbe09e
Embed `rb_args_info` in `rb_node_args_t` 2023-10-30 00:19:43 +09:00
Nobuyoshi Nakada c8d162c889
[Bug #19973] Warn duplicated keyword arguments after keyword splat 2023-10-26 14:28:39 +09:00
Nobuyoshi Nakada 2f8a719b6a Removed unused argument
Eventually, `read_escape` does not use `encp`.
2023-10-25 21:40:41 +09:00
Nobuyoshi Nakada 839b763119 Use named reference for dyna_push 2023-10-23 17:40:33 +09:00
Nobuyoshi Nakada 7e80f0b5a2 Extract p_in_kwarg to save and update lexer contexts 2023-10-23 17:40:33 +09:00
Nobuyoshi Nakada 428f9f5dc0 Move push_pvtbl and push_pktbl in nterms 2023-10-23 17:40:33 +09:00
Nobuyoshi Nakada 3b05238289 Extract p_assoc and p_in to save lexer contexts 2023-10-23 17:40:33 +09:00
yui-knk 08e25985d1 Expand OP_ASGN1 nd_args to nd_index and nd_rvalue
ARGSCAT has been used for nd_args to hold index and rvalue,
because there was limitation on the number of members for Node.
We can easily change structure of node now, let's expand it.
2023-10-20 07:56:20 +09:00
yui-knk 606452d1a9 Remove not used fields from STR 2023-10-15 16:16:06 +09:00
yui-knk 5342dbf00b Check node type before accessing nd_next
This is also a preparation for removing not_used members from
STR NODE. Current codes work without node type check because NODE_STR
has not_used2 member corresponding to nd_next of NODE_LIST and
NODE_DSTR. However it causes problme once not_used members are
removed from NODE_STR.
2023-10-15 16:16:06 +09:00
yui-knk e7e31d7784 Stop updating node type from NODE_STR to NODE_DSTR
This is a preparation for removing not_used members from STR NODE.
Once not_used members are removed from STR NODE, STR NODE is smaller than
DSTR NODE. Therefore allocate NODE_DSTR instead of reusing NODE_STR.
2023-10-15 16:16:06 +09:00
yui-knk a4e3d595cd Remove not used fields from XSTR 2023-10-15 16:16:06 +09:00
yui-knk cab67d227a Remove not used fields from LIT 2023-10-15 16:16:06 +09:00
yui-knk 25072d2e87 Fix node type casts
Use new node type set by nd_set_type.
2023-10-14 11:12:20 +09:00
Nobuyoshi Nakada a405b28e85 Delete heredoc line mark references 2023-10-14 11:08:43 +09:00
Nobuyoshi Nakada 5fc9810bf3 Shorten `rb_strterm_literal_t` members 2023-10-14 11:08:43 +09:00
Nobuyoshi Nakada a075c55d0c Manage `rb_strterm_t` without imemo 2023-10-14 11:08:43 +09:00
Nobuyoshi Nakada cb06b6632a Remove unions in `rb_strterm` structs for alignment 2023-10-14 11:08:43 +09:00
yui-knk 2794a8fef6 [Bug #19919] Warn class variable assignment and constant declaration in condition 2023-10-13 07:35:24 +09:00
Nobuyoshi Nakada 81399a5c46
Use `lex_eol` macros 2023-10-13 02:32:45 +09:00
Nobuyoshi Nakada 17b0643392
[Bug #19924] Source code should be unsigned char stream
Use `peekc` or `nextc` to fetch the next character, instead of reading
from `lex.pcur` directly, for compilers that plain char is signed.
2023-10-13 02:28:35 +09:00
yui-knk f9fe7aeef4 Extract NODE_FL_NEWLINE access to macro 2023-10-11 19:22:34 +09:00
Nobuyoshi Nakada a84d0945fa
Semicolon after `SWITCH_BY_COND_TYPE` for auto-indent [ci skip] 2023-10-11 10:37:40 +09:00
Nobuyoshi Nakada 47274ba8c1 Extract numparam nterms 2023-10-10 16:32:40 +09:00
Nobuyoshi Nakada 9095e712a3 Use `rb_node_exits_t` instead of `NODE` 2023-10-10 16:32:40 +09:00
Nobuyoshi Nakada e2998c42e1 Forward declaration of `struct RNode_DEF_TEMP` and its typedef 2023-10-10 16:32:40 +09:00
yui-knk 5245123a4b Remove not used fields from DEFN 2023-10-10 11:05:29 +09:00
Nobuyoshi Nakada a8d71535ff Pre-allocate `NODE_DEFN`/`NODE_DEFS` nodes
To fix the order of node IDs, for typeprof tests.
2023-10-10 00:09:52 +09:00
Nobuyoshi Nakada 4c00ab7fd6 Refactor NODE_DEF_TEMP
Use `NODE_DEF_TEMP` as the wrapper of `NODE_DEFS` in ripper, not only
of `NODE_DEFN`, so that `endless_method_name` works consistently.
2023-10-10 00:09:52 +09:00
yui-knk b9a2348632 Take care of internal node type
In parse.y, node can be NODE_DEF_TEMP or NODE_EXITS.
Hit "unknown node" without taking care of them.
For example `ruby --dump=y lib/cgi/util.rb` causes
"[BUG] unknown node: 107".
2023-10-09 12:38:32 +09:00
yui-knk b5d74f4f26 Remove not used fields from EVSTR 2023-10-08 16:34:32 +09:00
yui-knk 5810304c2e Remove not used fields from asgn nodes 2023-10-07 17:54:35 +09:00
yui-knk b7ee728a83 Correctly casting node for accessing nd_value and nd_vid in parse.y 2023-10-07 17:54:35 +09:00
yui-knk f28d380374 Pass nd_value to NODE_REQUIRED_KEYWORD_P 2023-10-07 17:54:35 +09:00
yui-knk b1a3c11c86 Use rb_node_masgn_t instead of NODE 2023-10-07 17:54:35 +09:00
yui-knk 5c779dc45d Remove not used fields from MATCH3 2023-10-06 15:32:33 +09:00
yui-knk 58fc45325f Remove not used fields from YIELD 2023-10-06 07:31:53 +09:00
yui-knk f6a2af255b Remove not used fields from ZLIST 2023-10-06 07:31:22 +09:00
Nobuyoshi Nakada a5cc6341c0
Remove `NODE_VALUES`
This node type was added for the multi-value experiment back in 2004.
The feature itself was removed after a few years, but this is its
remnant.
2023-10-06 03:39:58 +09:00
Nobuyoshi Nakada efa18fd6b3 Chain nodes to exit only 2023-10-05 14:23:42 +09:00
Nobuyoshi Nakada 5c82b9baed Do not chain unexpected node 2023-10-05 14:23:42 +09:00
Nobuyoshi Nakada f5f3b35b93 Remove unused nodes in NODE_RETURN and NODE_REDO 2023-10-05 14:23:42 +09:00
Nobuyoshi Nakada 70e1635950 Move internal NODE_DEF_TEMP to parse.y 2023-10-05 14:23:42 +09:00
yui-knk a472fd55da Remove not used fields from colon nodes 2023-10-05 13:19:09 +09:00
yui-knk 4a3f88f161 Fix cast type 2023-10-05 13:19:09 +09:00
yui-knk ed8a3428e4 Remove not used fields from variable nodes 2023-10-04 12:15:39 +09:00
Nobuyoshi Nakada 9059dfce12
`yield` cannot be placed outside methods even in blocks 2023-10-02 23:20:03 +09:00
yui-knk 4da04d5f43 Include new node types into %printer 2023-10-02 13:49:57 +09:00