-
-
Notifications
You must be signed in to change notification settings - Fork 922
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Truffle] Initial implementation of String#insert.
- Loading branch information
Showing
2 changed files
with
64 additions
and
5 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
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 |
---|---|---|
@@ -1,12 +1,7 @@ | ||
fails:String#insert with index, other inserts other before the character at the given index | ||
fails:String#insert with index, other modifies self in place | ||
fails:String#insert with index, other inserts after the given character on an negative count | ||
fails:String#insert with index, other raises an IndexError if the index is beyond string | ||
fails:String#insert with index, other converts index to an integer using to_int | ||
fails:String#insert with index, other converts other to a string using to_str | ||
fails:String#insert with index, other taints self if string to insert is tainted | ||
fails:String#insert with index, other raises a TypeError if other can't be converted to string | ||
fails:String#insert with index, other raises a RuntimeError if self is frozen | ||
fails:String#insert with index, other inserts a character into a multibyte encoded string | ||
fails:String#insert with index, other returns a String in the compatible encoding | ||
fails:String#insert with index, other raises an Encoding::CompatibilityError if the encodings are incompatible |
9d8cf7f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In both of the cases where you execute the child nodes, it's really important to understand that you're bypassing the DSL here. You're directly calling a specialisation. That looks fine in this case, but it isn't always. For an example using the DSL see for example https://github.com/jruby/jruby/blob/master/core/src/main/java/org/jruby/truffle/nodes/core/KernelNodes.java#L371. Here we define an abstract method that the DSL fills in for us as an entry point to the specialisation.