Report abuse

    @Override
    public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
        IRubyObject value = caseNode == null ? null : caseNode.interpret(runtime, context, self, aBlock);

        context.pollThreadEvents();

        // We know all cases are when nodes...assert?
        for (Node child : cases.childNodes()) {
            WhenNode when = (WhenNode) child;
            if (runtime.hasEventHooks()) ASTInterpreter.callTraceFunction(runtime, context, RubyEvent.LINE);
            IRubyObject result = when.when(value, context, runtime, self, aBlock);
            if (result != null) return result;
            context.pollThreadEvents();
        }

        return elseNode != null ? elseNode.interpret(runtime, context, self, aBlock) : runtime.getNil();
    }