13514
|
1 /*
|
|
2 * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. This
|
|
3 * code is released under a tri EPL/GPL/LGPL license. You can use it,
|
|
4 * redistribute it and/or modify it under the terms of the:
|
|
5 *
|
|
6 * Eclipse Public License version 1.0
|
|
7 * GNU General Public License version 2
|
|
8 * GNU Lesser General Public License version 2.1
|
|
9 */
|
|
10 package com.oracle.truffle.ruby.runtime.control;
|
|
11
|
|
12 import com.oracle.truffle.api.nodes.*;
|
|
13 import com.oracle.truffle.ruby.runtime.*;
|
|
14
|
|
15 /**
|
|
16 * Controls throwing a value. Note that throwing is different to raising in Ruby, which is the
|
|
17 * reason we have both {@link ThrowException} and {@link RaiseException}.
|
|
18 */
|
|
19 public class ThrowException extends ControlFlowException {
|
|
20
|
|
21 private final Object tag;
|
|
22 private final Object value;
|
|
23
|
|
24 public ThrowException(Object tag, Object value) {
|
|
25 assert tag != null;
|
|
26 assert RubyContext.shouldObjectBeVisible(value);
|
|
27
|
|
28 this.tag = tag;
|
|
29 this.value = value;
|
|
30 }
|
|
31
|
|
32 public Object getTag() {
|
|
33 return tag;
|
|
34 }
|
|
35
|
|
36 public Object getValue() {
|
|
37 return value;
|
|
38 }
|
|
39
|
|
40 private static final long serialVersionUID = 8693305627979840677L;
|
|
41
|
|
42 }
|