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 an explicit return from a method.
|
|
17 */
|
|
18 public final class ReturnException extends ControlFlowException {
|
|
19
|
|
20 private final long returnID;
|
|
21 private final Object value;
|
|
22
|
|
23 public ReturnException(long returnID, Object value) {
|
|
24 assert RubyContext.shouldObjectBeVisible(value);
|
|
25
|
|
26 this.returnID = returnID;
|
|
27 this.value = value;
|
|
28 }
|
|
29
|
|
30 /**
|
|
31 * Return the return ID of this return that identifies where it intends to return to.
|
|
32 */
|
|
33 public long getReturnID() {
|
|
34 return returnID;
|
|
35 }
|
|
36
|
|
37 /**
|
|
38 * Get the value that has been returned.
|
|
39 */
|
|
40 public Object getValue() {
|
|
41 return value;
|
|
42 }
|
|
43
|
|
44 private static final long serialVersionUID = -9177536212065610691L;
|
|
45
|
|
46 }
|