Skip to content

Commit

Permalink
Showing 3 changed files with 6 additions and 14 deletions.
3 changes: 3 additions & 0 deletions core/src/main/java/org/jruby/truffle/nodes/RubyNode.java
Original file line number Diff line number Diff line change
@@ -222,4 +222,7 @@ public static void notDesignedForCompilation() {
CompilerAsserts.neverPartOfCompilation();
}

public static boolean isNil(RubyObject o) {
return o instanceof RubyNilClass;
}
}
Original file line number Diff line number Diff line change
@@ -55,14 +55,11 @@ public boolean or(RubyNilClass other) {
return false;
}

@Specialization(guards = "isNotNil")
@Specialization(guards = "!isNil")
public boolean or(RubyObject other) {
return true;
}

static boolean isNotNil(RubyObject o) {
return ! (o instanceof RubyNilClass);
}
}

@CoreMethod(names = "^", needsSelf = false, required = 1)
@@ -86,15 +83,11 @@ public boolean xor(RubyNilClass other) {
return false;
}

@Specialization(guards = "isNotNil")
@Specialization(guards = "!isNil")
public boolean xor(RubyObject other) {
return true;
}

static boolean isNotNil(RubyObject o) {
return ! (o instanceof RubyNilClass);
}

}

@CoreMethod(names = {"to_s", "inspect"}, needsSelf = false)
Original file line number Diff line number Diff line change
@@ -38,14 +38,10 @@ public boolean and(RubyNilClass other) {
return false;
}

@Specialization(guards = "isNotNil")
@Specialization(guards = "!isNil")
public boolean and(RubyObject other) {
return true;
}

static boolean isNotNil(RubyObject o) {
return ! (o instanceof RubyNilClass);
}
}

@CoreMethod(names = "|", needsSelf = false, required = 1)

0 comments on commit 89bdf82

Please sign in to comment.