Commit 24d9870
authored
fix: parser improvements for v0.0.40 (#22)
* fix: support private/protected/public def syntax parsing (#17)
Add visibility modifier support for method definitions:
- Parse `private def`, `protected def`, `public def` syntax
- Extract visibility info and include in parse result
- Preserve visibility keywords during type erasure
- Add VISIBILITY_PATTERN constant for reuse
Fixes #17
* fix: skip heredoc content during parsing (#18)
Add HeredocDetector to identify heredoc regions and skip them during
parsing. This prevents def patterns inside heredoc from being
incorrectly recognized as method definitions.
- Add HeredocDetector class with detect() and inside_heredoc?() methods
- Support <<DELIM, <<-DELIM, <<~DELIM, <<'DELIM', <<"DELIM" syntax
- Integrate heredoc detection in Parser.parse()
- Add comprehensive tests for HeredocDetector
Fixes #18
* feat: support visibility modifiers in RBS generation
Add private/protected visibility prefix to generated RBS method
signatures. Both TRuby::RBSGenerator and TRuby::IR::RBSGenerator
now output correct RBS format like 'private def method: () -> Type'.
Related to #17
* feat: add visibility support to RBS generation with E2E tests
- Pass visibility from parser to IR MethodDef nodes
- Add private prefix to RBS output (RBS doesn't support protected)
- Add E2E tests for visibility in RBS and compiled Ruby
- Update unit tests for RBS generator visibility handling
RBS only supports private, not protected (ruby/rbs#579)
Related to #17
* fix: skip =begin/=end block comments during parsing
Extend HeredocDetector to also detect Ruby block comments.
Parser now correctly ignores def patterns inside =begin/=end blocks.
Related to #18
* refactor: remove legacy compiler path
Remove legacy components that are no longer needed:
- Remove TRuby::RBSGenerator (use IR::RBSGenerator)
- Remove LegacyCompiler class
- Remove LegacyParser class
- Remove use_ir parameter from Compiler (always use IR)
- Remove use_combinator parameter from Parser (always enabled)
This simplifies the codebase by eliminating dual-path maintenance.
* fix: preserve default values when erasing type annotations (#21)1 parent a9d85aa commit 24d9870
File tree
13 files changed
+557
-340
lines changed- lib
- t_ruby
- spec
- e2e
- t_ruby
13 files changed
+557
-340
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
21 | | - | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
10 | 12 | | |
11 | 13 | | |
12 | | - | |
| 14 | + | |
13 | 15 | | |
14 | | - | |
| 16 | + | |
15 | 17 | | |
16 | | - | |
17 | 18 | | |
18 | 19 | | |
19 | | - | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
45 | | - | |
46 | | - | |
| 46 | + | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | | - | |
| 50 | + | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
54 | | - | |
| 55 | + | |
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
| |||
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
| 67 | + | |
71 | 68 | | |
72 | 69 | | |
73 | 70 | | |
| |||
87 | 84 | | |
88 | 85 | | |
89 | 86 | | |
90 | | - | |
91 | | - | |
| 87 | + | |
| 88 | + | |
92 | 89 | | |
93 | 90 | | |
94 | | - | |
| 91 | + | |
95 | 92 | | |
96 | 93 | | |
97 | 94 | | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
109 | 98 | | |
110 | 99 | | |
111 | 100 | | |
| |||
134 | 123 | | |
135 | 124 | | |
136 | 125 | | |
137 | | - | |
| 126 | + | |
138 | 127 | | |
139 | 128 | | |
140 | 129 | | |
| |||
380 | 369 | | |
381 | 370 | | |
382 | 371 | | |
383 | | - | |
| 372 | + | |
384 | 373 | | |
385 | 374 | | |
386 | | - | |
| 375 | + | |
387 | 376 | | |
388 | 377 | | |
389 | 378 | | |
| |||
396 | 385 | | |
397 | 386 | | |
398 | 387 | | |
399 | | - | |
400 | | - | |
401 | | - | |
402 | | - | |
403 | | - | |
404 | | - | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | | - | |
409 | 388 | | |
410 | 389 | | |
| 390 | + | |
| 391 | + | |
411 | 392 | | |
412 | 393 | | |
413 | 394 | | |
414 | 395 | | |
415 | 396 | | |
416 | | - | |
417 | | - | |
418 | | - | |
419 | | - | |
420 | | - | |
421 | | - | |
422 | | - | |
423 | | - | |
424 | | - | |
425 | | - | |
426 | 397 | | |
427 | 398 | | |
428 | 399 | | |
| |||
511 | 482 | | |
512 | 483 | | |
513 | 484 | | |
514 | | - | |
| 485 | + | |
| 486 | + | |
515 | 487 | | |
516 | 488 | | |
517 | 489 | | |
| |||
558 | 530 | | |
559 | 531 | | |
560 | 532 | | |
561 | | - | |
| 533 | + | |
562 | 534 | | |
563 | | - | |
564 | | - | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
565 | 540 | | |
566 | 541 | | |
567 | 542 | | |
| |||
580 | 555 | | |
581 | 556 | | |
582 | 557 | | |
583 | | - | |
584 | | - | |
585 | | - | |
586 | | - | |
587 | | - | |
588 | | - | |
589 | | - | |
590 | 558 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
778 | 778 | | |
779 | 779 | | |
780 | 780 | | |
781 | | - | |
| 781 | + | |
| 782 | + | |
782 | 783 | | |
783 | 784 | | |
784 | 785 | | |
| |||
1051 | 1052 | | |
1052 | 1053 | | |
1053 | 1054 | | |
1054 | | - | |
| 1055 | + | |
| 1056 | + | |
1055 | 1057 | | |
1056 | 1058 | | |
1057 | 1059 | | |
| |||
1092 | 1094 | | |
1093 | 1095 | | |
1094 | 1096 | | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
1095 | 1108 | | |
1096 | 1109 | | |
1097 | 1110 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
787 | 787 | | |
788 | 788 | | |
789 | 789 | | |
790 | | - | |
| 790 | + | |
791 | 791 | | |
792 | 792 | | |
793 | 793 | | |
| |||
0 commit comments