summaryrefslogtreecommitdiff
path: root/java/src/json/ext/Parser.rl
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/json/ext/Parser.rl')
-rw-r--r--java/src/json/ext/Parser.rl16
1 files changed, 8 insertions, 8 deletions
diff --git a/java/src/json/ext/Parser.rl b/java/src/json/ext/Parser.rl
index bb6a38f..fd759f5 100644
--- a/java/src/json/ext/Parser.rl
+++ b/java/src/json/ext/Parser.rl
@@ -663,10 +663,10 @@ public class Parser extends RubyObject {
fhold;
fbreak;
} else {
- if (parser.arrayClass != getRuntime().getArray()) {
- result.callMethod(context, "<<", res.result);
+ if (parser.arrayClass == getRuntime().getArray()) {
+ ((RubyArray)result).append(res.result);
} else {
- result.append(res.result);
+ result.callMethod(context, "<<", res.result);
}
fexec res.p;
}
@@ -700,12 +700,12 @@ public class Parser extends RubyObject {
// this is guaranteed to be a RubyArray due to the earlier
// allocator test at OptionsReader#getClass
- RubyArray result;
- if (parser.arrayClass != getRuntime().getArray()) {
- result = (RubyArray)parser.arrayClass.newInstance(context,
- IRubyObject.NULL_ARRAY, Block.NULL_BLOCK);
- } else {
+ IRubyObject result;
+ if (parser.arrayClass == getRuntime().getArray()) {
result = RubyArray.newArray(getRuntime());
+ } else {
+ result = parser.arrayClass.newInstance(context,
+ IRubyObject.NULL_ARRAY, Block.NULL_BLOCK);
}
%% write init;