comparison graal/com.oracle.truffle.api.dsl/src/com/oracle/truffle/api/dsl/UnsupportedSpecializationException.java @ 13861:28479abd1a69

Truffle-DSL: implemented support for UnsupportedSpecializationException#getSuppliedNodes().
author Christian Humer <christian.humer@gmail.com>
date Mon, 03 Feb 2014 20:59:57 +0100
parents f270f09616da
children 79fb8b5ef185
comparison
equal deleted inserted replaced
13858:6b91134526a7 13861:28479abd1a69
35 public final class UnsupportedSpecializationException extends RuntimeException { 35 public final class UnsupportedSpecializationException extends RuntimeException {
36 36
37 private static final long serialVersionUID = -2122892028296836269L; 37 private static final long serialVersionUID = -2122892028296836269L;
38 38
39 private final Node node; 39 private final Node node;
40 private final Node[] suppliedNodes;
40 private final Object[] suppliedValues; 41 private final Object[] suppliedValues;
41 42
42 public UnsupportedSpecializationException(Node node, Object... suppliedValues) { 43 public UnsupportedSpecializationException(Node node, Node[] suppliedNodes, Object... suppliedValues) {
43 super("Unexpected values provided for " + node + ": " + Arrays.toString(suppliedValues)); 44 super("Unexpected values provided for " + node + ": " + Arrays.toString(suppliedValues));
45 Objects.requireNonNull(suppliedNodes, "The suppliedNodes parameter must not be null.");
46 if (suppliedNodes.length != suppliedValues.length) {
47 throw new IllegalArgumentException("The length of suppliedNodes must match the length of suppliedValues.");
48 }
44 this.node = node; 49 this.node = node;
50 this.suppliedNodes = suppliedNodes;
45 this.suppliedValues = suppliedValues; 51 this.suppliedValues = suppliedValues;
46 } 52 }
47 53
48 /** 54 /**
49 * Returns the {@link Node} that caused the this {@link UnsupportedSpecializationException}. 55 * Returns the {@link Node} that caused the this {@link UnsupportedSpecializationException}.
51 public Node getNode() { 57 public Node getNode() {
52 return node; 58 return node;
53 } 59 }
54 60
55 /** 61 /**
56 * Returns the dynamic values that were supplied to the node. 62 * Returns the children of the {@link Node} returned by {@link #getNode()} which produced the
63 * values returned by {@link #getSuppliedValues()}. The array returned by
64 * {@link #getSuppliedNodes()} has the same length as the array returned by
65 * {@link #getSuppliedValues()}. Never returns null.
66 */
67 public Node[] getSuppliedNodes() {
68 return suppliedNodes;
69 }
70
71 /**
72 * Returns the dynamic values that were supplied to the node.The array returned by
73 * {@link #getSuppliedNodes()} has the same length as the array returned by
74 * {@link #getSuppliedValues()}. Never returns null.
57 */ 75 */
58 public Object[] getSuppliedValues() { 76 public Object[] getSuppliedValues() {
59 return suppliedValues; 77 return suppliedValues;
60 } 78 }
61 79