-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
149: Implement the 'perform:WithArguments' and friends primitives. r=vext01 a=ltratt This PR implements the various `perform:withArguments` primitives. Some of the complexity in ef599ea is to make sure that yksom doesn't suffer from the same problems as JavaSOM (see SOM-st/SOM#43 (comment)). bf02eaa is then a simple general optimisation opened up by the first commit. I then factored out the common `perform` code in d58f3e8 which made implementing the other primitives relatively simple. Co-authored-by: Laurence Tratt <[email protected]>
- Loading branch information
Showing
9 changed files
with
207 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
" | ||
VM: | ||
status: success | ||
stdout: | ||
2 | ||
instance of perform_in_superclass | ||
" | ||
|
||
perform_in_superclass = ( | ||
run = ( | ||
self println. | ||
self perform: #println inSuperclass: Object. | ||
) | ||
|
||
println = ( | ||
2 println. | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
" | ||
VM: | ||
status: success | ||
stdout: | ||
2 | ||
4 | ||
instance of perform_in_superclass_with_args | ||
" | ||
|
||
perform_in_superclass_with_args = ( | ||
run = ( | ||
(self ifNil: 2) println. | ||
(self perform: #ifNil: withArguments: #(3) inSuperclass: Object) println. | ||
) | ||
|
||
ifNil: aBlock = ( | ||
aBlock println. | ||
^ 4. | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
" | ||
VM: | ||
status: success | ||
stdout: | ||
5 | ||
6 | ||
7 | ||
" | ||
|
||
perform_witharguments = ( | ||
run = ( | ||
self perform: #f:b:c: withArguments: #(5 6 7). | ||
) | ||
|
||
f: a b: b c: c = ( | ||
a println. | ||
b println. | ||
c println. | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
" | ||
VM: | ||
status: error | ||
stderr: | ||
Traceback... | ||
... | ||
Tried passing 1 arguments to a function that requires 3. | ||
" | ||
|
||
perform_witharguments_wrong = ( | ||
run = ( | ||
self perform: #f:b:c: withArguments: #(5). | ||
) | ||
|
||
f: a b: b c: c = ( | ||
a println. | ||
b println. | ||
c println. | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.