Skip to content

Commit cf89fd2

Browse files
committed
[Truffle] String#byte_append.
1 parent e09e135 commit cf89fd2

File tree

11 files changed

+25
-18
lines changed

11 files changed

+25
-18
lines changed

spec/truffle/tags/rubysl/rubysl-stringio/spec/append_tags.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,3 @@ fails:StringIO#<< when passed [Object] taints self's String when the passed argu
66
fails:StringIO#<< when passed [Object] does not taint self when the passed argument is tainted
77
fails:StringIO#<< when passed [Object] updates self's position
88
fails:StringIO#<< when passed [Object] tries to convert the passed argument to a String using #to_s
9-
fails:StringIO#<< when in append mode appends the passed argument to the end of self, ignoring current position
10-
fails:StringIO#<< when in append mode correctly updates self's position

spec/truffle/tags/rubysl/rubysl-stringio/spec/initialize_copy_tags.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

spec/truffle/tags/rubysl/rubysl-stringio/spec/printf_tags.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,3 @@ fails:StringIO#printf returns nil
22
fails:StringIO#printf pads self with \000 when the current position is after the end
33
fails:StringIO#printf performs format conversion
44
fails:StringIO#printf updates the current position
5-
fails:StringIO#printf when in append mode appends the passed argument to the end of self
6-
fails:StringIO#printf when in append mode correctly updates self's position

spec/truffle/tags/rubysl/rubysl-stringio/spec/putc_tags.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@ fails:StringIO#putc when passed [String] writes a byte into the io
66
fails:StringIO#putc when passed [Object] it writes the passed Integer % 256 to self
77
fails:StringIO#putc when passed [Object] pads self with \000 when the current position is after the end
88
fails:StringIO#putc when passed [Object] tries to convert the passed argument to an Integer using #to_int
9-
fails:StringIO#putc when in append mode appends to the end of self

spec/truffle/tags/rubysl/rubysl-stringio/spec/puts_tags.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,3 @@ fails:StringIO#puts when passed 1 or more objects prints a newline when passed n
1313
fails:StringIO#puts when passed no arguments returns nil
1414
fails:StringIO#puts when passed no arguments prints a newline
1515
fails:StringIO#puts when passed no arguments does not honor the global output record separator $\
16-
fails:StringIO#puts when in append mode appends the passed argument to the end of self
17-
fails:StringIO#puts when in append mode correctly updates self's position
18-
fails:StringIO#puts when passed an encoded string stores the bytes unmodified

spec/truffle/tags/rubysl/rubysl-stringio/spec/reopen_tags.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,4 @@ fails:StringIO#reopen when passed [Object, Integer] raises a TypeError when tryi
77
fails:StringIO#reopen when passed [Object, Integer] raises a RuntimeError when trying to reopen self with a frozen String in truncate-mode
88
fails:StringIO#reopen when passed [Object, Integer] does not raise IOError when passed a frozen String in read-mode
99
fails:StringIO#reopen reopens a stream when given a String argument
10-
fails:StringIO#reopen reopens a stream in append mode when flagged as such
11-
fails:StringIO#reopen reopens and truncate when reopened in write mode
1210
fails:StringIO#reopen does not truncate the content even when the StringIO argument is in the truncate mode

spec/truffle/tags/rubysl/rubysl-stringio/spec/syswrite_tags.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,3 @@ fails:StringIO#syswrite when passed [String] does not taint self when the passed
88
fails:StringIO#syswrite when passed [String] writes binary data into the io
99
fails:StringIO#syswrite when passed [String] retains the original encoding
1010
fails:StringIO#syswrite when passed [String] pads multibyte characters properly
11-
fails:StringIO#syswrite when in append mode appends the passed argument to the end of self
12-
fails:StringIO#syswrite when in append mode correctly updates self's position

spec/truffle/tags/rubysl/rubysl-stringio/spec/write_nonblock_tags.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,3 @@ fails:StringIO#write_nonblock when passed [String] does not taint self when the
88
fails:StringIO#write_nonblock when passed [String] writes binary data into the io
99
fails:StringIO#write_nonblock when passed [String] retains the original encoding
1010
fails:StringIO#write_nonblock when passed [String] pads multibyte characters properly
11-
fails:StringIO#write_nonblock when in append mode appends the passed argument to the end of self
12-
fails:StringIO#write_nonblock when in append mode correctly updates self's position

spec/truffle/tags/rubysl/rubysl-stringio/spec/write_tags.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,3 @@ fails:StringIO#write when passed [String] does not taint self when the passed ar
88
fails:StringIO#write when passed [String] writes binary data into the io
99
fails:StringIO#write when passed [String] retains the original encoding
1010
fails:StringIO#write when passed [String] pads multibyte characters properly
11-
fails:StringIO#write when in append mode appends the passed argument to the end of self
12-
fails:StringIO#write when in append mode correctly updates self's position

truffle/src/main/java/org/jruby/truffle/nodes/rubinius/StringPrimitiveNodes.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,4 +687,24 @@ public Object stringToInum(RubyString string, int fixBase, boolean strict) {
687687

688688
}
689689

690+
@RubiniusPrimitive(name = "string_byte_append")
691+
public static abstract class StringByteAppendPrimitiveNode extends RubiniusPrimitiveNode {
692+
693+
public StringByteAppendPrimitiveNode(RubyContext context, SourceSection sourceSection) {
694+
super(context, sourceSection);
695+
}
696+
697+
public StringByteAppendPrimitiveNode(StringByteAppendPrimitiveNode prev) {
698+
super(prev);
699+
}
700+
701+
@Specialization
702+
public RubyString stringByteAppend(RubyString string, RubyString other) {
703+
notDesignedForCompilation();
704+
string.getByteList().append(other.getByteList());
705+
return string;
706+
}
707+
708+
}
709+
690710
}

0 commit comments

Comments
 (0)