[Swift-commit] r6267 - in branches/faster/src/org/griphyn/vdl/karajan: . lib/swiftscript
hategan at ci.uchicago.edu
hategan at ci.uchicago.edu
Wed Feb 13 13:34:20 CST 2013
Author: hategan
Date: 2013-02-13 13:34:19 -0600 (Wed, 13 Feb 2013)
New Revision: 6267
Modified:
branches/faster/src/org/griphyn/vdl/karajan/AssertFailedException.java
branches/faster/src/org/griphyn/vdl/karajan/lib/swiftscript/Assert.java
Log:
fixed assert
Modified: branches/faster/src/org/griphyn/vdl/karajan/AssertFailedException.java
===================================================================
--- branches/faster/src/org/griphyn/vdl/karajan/AssertFailedException.java 2013-02-13 18:15:05 UTC (rev 6266)
+++ branches/faster/src/org/griphyn/vdl/karajan/AssertFailedException.java 2013-02-13 19:34:19 UTC (rev 6267)
@@ -20,6 +20,8 @@
import k.rt.ExecutionException;
+import org.globus.cog.karajan.compiled.nodes.Node;
+
/**
* Generated only by SwiftScript @assert().
*
@@ -32,7 +34,7 @@
String message = null;
- public AssertFailedException(String message) {
- super(message);
+ public AssertFailedException(Node n, String message) {
+ super(n, message);
}
}
Modified: branches/faster/src/org/griphyn/vdl/karajan/lib/swiftscript/Assert.java
===================================================================
--- branches/faster/src/org/griphyn/vdl/karajan/lib/swiftscript/Assert.java 2013-02-13 18:15:05 UTC (rev 6266)
+++ branches/faster/src/org/griphyn/vdl/karajan/lib/swiftscript/Assert.java 2013-02-13 19:34:19 UTC (rev 6267)
@@ -45,8 +45,14 @@
@Override
public Object function(Stack stack) {
AbstractDataNode hmessage = this.message.getValue(stack);
- hmessage.waitFor(this);
- String message = (String) hmessage.getValue();
+ String message;
+ if (hmessage != null) {
+ hmessage.waitFor(this);
+ message = (String) hmessage.getValue();
+ }
+ else {
+ message = "Assertion failed";
+ }
AbstractDataNode hvalue = this.value.getValue(stack);
hvalue.waitFor(this);
@@ -70,7 +76,7 @@
throw new ExecutionException(this, "First argument to assert() must be boolean or int!");
}
if (!success) {
- throw new AssertFailedException(message);
+ throw new AssertFailedException(this, message);
}
}
}
More information about the Swift-commit
mailing list