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

583 Коммитов

Автор SHA1 Сообщение Дата
Jemma Issroff fe0827013b [PRISM] Implement NoKeywordsParameterNode 2023-10-25 13:02:44 -03:00
Jemma Issroff 39207b496e [PRISM] Implement compilation for PreExecutionNodes 2023-10-23 13:22:55 -07:00
Jemma Issroff 5abff9dbff [PRISM] Add PM_PUTNIL macro 2023-10-23 13:22:55 -07:00
Jemma Issroff 7c4e3ca27b [PRISM] Fix AssocSplat node
This commit emits the correct instructions for hashes which have
both AssocSplat and Assoc nodes contained within them
2023-10-23 13:15:52 -07:00
Jemma Issroff 60196b4780 [PRISM] Fix __LINE__ to be 1-indexed by default 2023-10-23 13:59:48 -03:00
Jemma Issroff 62c674f98c [PRISM] Fix compilation for IfNode, UnlessNode
This properly implements the branch condition for FlipFlopNodes on
If / UnlessNodes, and also fixes the bug in UnlessNodes
2023-10-23 12:37:50 -03:00
Jemma Issroff 01787d53bf [PRISM] Setup encodings in prism compiler 2023-10-20 16:29:06 -03:00
Jemma Issroff a426a230de [PRISM] Fixed StringConcatNode, uncommented tests 2023-10-20 11:49:53 -03:00
Nobuyoshi Nakada 9d1940ba3c [Bug #19966] [PRISM] Fix singleton method definition 2023-10-20 15:16:34 +09:00
Jemma Issroff 10c5063704 Address PR comments 2023-10-18 17:16:11 -07:00
Jemma Issroff 5408ce8c17 Fixed mistyping 2023-10-18 17:16:11 -07:00
Jemma Issroff ba3a99acaf Remove pm_compile_context_t, move the context onto ScopeNode
We changed ScopeNodes to point to their parent (previous) ScopeNodes.
Accordingly, we can remove pm_compile_context_t, and store all
necessary context in ScopeNodes, allowing us to access locals from
outer scopes.
2023-10-18 17:16:11 -07:00
Jemma Issroff 10d88ec9c3
[PRISM] Compile AliasGlobalVariableNode (#8675) 2023-10-16 12:00:01 -07:00
Jemma Issroff 728286d0e8
[PRISM] Fix more bugs in the compiler (#8658)
* Fixed ConstantPathWriteNode
* FIxed FlipFlopNode
2023-10-16 06:31:32 -07:00
Adam Hess 6e88b72d7b
[PRISM] prevent underflow on popped splatarray (#8657)
prevent underflow on popped splatarray

This only emits the splat array node when not popped
2023-10-16 05:22:07 -07:00
Jemma Issroff 34add1e595
[PRISM] Compile fixes (#8644)
* Fix compiling UndefNodes
* Fix compiling super on ClassNode
* Fix compile popped for ModuleNode
* Add checks for NULL nodes
* Only add newhash if not popped
2023-10-13 10:59:37 -07:00
Matt Valentine-House 05b9b58d55 [Prism] Fix IfNode and ElseNode
ElseNode looks to have been implemented at the same time as IfNode, but
was resulting in a stack underflow error.

The following is from the test code

```
if foo
  bar
end
```

```
❯ make run
compiling compile.c
linking miniruby
./miniruby -I./lib -I. -I.ext/common  -r./arm64-darwin22-fake  ./test.rb
CRUBY: **************************************************
== disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(2,19)>
0000 putself                                                          (   2)[Li]
0001 opt_send_without_block                 <calldata!mid:foo, argc:0, FCALL|VCALL|ARGS_SIMPLE>
0003 branchunless                           9
0005 putself
0006 opt_send_without_block                 <calldata!mid:bar, argc:0, FCALL|VCALL|ARGS_SIMPLE>
0008 pop
0009 putobject_INT2FIX_1_
0010 leave
PRISM: **************************************************
-- raw disasm--------
   0000 putself                                                          (   2)
   0001 send                 <calldata:foo, 0>, nil                      (   2)
   0004 branchunless         <L001>                                      (   2)
   0006 jump                 <L000>                                      (   2)
 <L000> [sp: 0]
*  0008 pop                                                              (   1)
   0009 putself                                                          (   2)
   0010 send                 <calldata:bar, 0>, nil                      (   2)
   0013 pop                                                              (   2)
   0014 jump                 <L002>                                      (   1)
 <L001> [sp: 0]
 <L002> [sp: -1]
   0016 putobject            1                                           (   2)
   0018 leave                                                            (   1)
---------------------
<compiled>: <compiled>:1: argument stack underflow (-1) (SyntaxError)
make: *** [run] Error 1
```

This commit fixes the stack underflow error for both IfNode and ElseNode
and introduces tests for them.
2023-10-04 13:53:31 -04:00
Benoit Daloze fd984ac869 Adopt prism CallNode#name changes 2023-10-02 09:18:56 -04:00
Kevin Newton 2de5c57dce Move more things through pm_static_literal_value 2023-09-29 09:51:23 -04:00
Kevin Newton 2e25289aee Handle static array nodes 2023-09-29 09:51:23 -04:00
Kevin Newton 38e3cafe62 Compile implicit nodes 2023-09-29 09:51:23 -04:00
Kevin Newton 396042a25c Fix up static hash compilation 2023-09-29 09:51:23 -04:00
Kevin Newton 3ec6be1a4b More documentation for pattern matching compilation 2023-09-28 15:13:09 -04:00
Kevin Newton 9c8ba84675 Support if and unless guards on patterns 2023-09-28 15:13:09 -04:00
Kevin Newton b1a28b05db Support local variable targeting in pattern matching 2023-09-28 15:13:09 -04:00
Kevin Newton 41d3e23582 Support the AlternationPatternNode 2023-09-28 15:13:09 -04:00
Kevin Newton 64da9be3af Fill in other missing pattern matching expression types 2023-09-28 15:13:09 -04:00
Kevin Newton 6e88a56f63 Compile basic pattern matching expressions 2023-09-28 15:13:09 -04:00
Kevin Newton 5a376f0f71 Consolidate regexp options, interpolated match last line 2023-09-28 14:11:34 -04:00
Nobuyoshi Nakada d2c5867357
Fix up indentation [ci skip] 2023-09-29 00:55:43 +09:00
Matt Valentine-House 414c781158 [YARP] Implement MatchWriteNode 2023-09-28 16:51:30 +01:00
Kevin Newton 40b2c8e5e7
Fix up indentation in prism_compile.c 2023-09-28 09:47:46 -04:00
Kevin Newton a213d21448 Move CRuby-specific prism files to top level 2023-09-28 09:44:16 -04:00