comparison truffle/com.oracle.truffle.sl/src/com/oracle/truffle/sl/builtins/SLAssertTrueBuiltin.java @ 22251:8dddde8b20d4

Truffle/SL: provide an "unavailable" SourceSection for every RootNode, using a newly defined static name that identifies "SL Builtin" RootNodes.
author Michael Van De Vanter <michael.van.de.vanter@oracle.com>
date Thu, 24 Sep 2015 13:16:52 -0700
parents dc83cc1f94f2
children
comparison
equal deleted inserted replaced
22250:0fb3522e5b72 22251:8dddde8b20d4
43 import com.oracle.truffle.api.CompilerDirectives; 43 import com.oracle.truffle.api.CompilerDirectives;
44 import com.oracle.truffle.api.dsl.Specialization; 44 import com.oracle.truffle.api.dsl.Specialization;
45 import com.oracle.truffle.api.nodes.NodeInfo; 45 import com.oracle.truffle.api.nodes.NodeInfo;
46 import com.oracle.truffle.api.source.SourceSection; 46 import com.oracle.truffle.api.source.SourceSection;
47 import com.oracle.truffle.sl.SLAssertionError; 47 import com.oracle.truffle.sl.SLAssertionError;
48 import com.oracle.truffle.sl.SLLanguage;
48 import com.oracle.truffle.sl.runtime.SLNull; 49 import com.oracle.truffle.sl.runtime.SLNull;
49 50
50 /** 51 /**
51 * Asserts a given value to be <code>true</code> and throws an {@link AssertionError} if the value 52 * Asserts a given value to be <code>true</code> and throws an {@link AssertionError} if the value
52 * was <code>false</code>. 53 * was <code>false</code>.
53 */ 54 */
54 @NodeInfo(shortName = "assertTrue") 55 @NodeInfo(shortName = "assertTrue")
55 public abstract class SLAssertTrueBuiltin extends SLBuiltinNode { 56 public abstract class SLAssertTrueBuiltin extends SLBuiltinNode {
56 57
57 public SLAssertTrueBuiltin() { 58 public SLAssertTrueBuiltin() {
58 super(SourceSection.createUnavailable("SL builtin", "assertTrue")); 59 super(SourceSection.createUnavailable(SLLanguage.builtinKind, "assertTrue"));
59 } 60 }
60 61
61 @Specialization 62 @Specialization
62 public boolean doAssert(boolean value, String message) { 63 public boolean doAssert(boolean value, String message) {
63 if (!value) { 64 if (!value) {