X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fibex%2Fjs%2FJS.java;h=1e38ce53ca621283a1e64396abba55fe855685e7;hb=2c3f170edc8e0da2de19f8a902e59fd04ea6c990;hp=3158851b59aeec50064ec738a6f60b847b219ff9;hpb=e4a8b8cbccc958639f4552d94c5a7c84d09f0ebc;p=org.ibex.core.git diff --git a/src/org/ibex/js/JS.java b/src/org/ibex/js/JS.java index 3158851..1e38ce5 100644 --- a/src/org/ibex/js/JS.java +++ b/src/org/ibex/js/JS.java @@ -2,13 +2,14 @@ package org.ibex.js; import org.ibex.util.*; -import org.ibex.*; import java.io.*; import java.util.*; /** The minimum set of functionality required for objects which are manipulated by JavaScript */ public class JS extends org.ibex.util.BalancedTree { + public static boolean checkAssertions = false; + public static final Object METHOD = new Object(); public final JS unclone() { return _unclone(); } public Enumeration keys() throws JSExn { return entries == null ? emptyEnumeration : entries.keys(); } @@ -67,7 +68,7 @@ public class JS extends org.ibex.util.BalancedTree { return new JS.UnpauseCallback(i); } - public static class UnpauseCallback implements Scheduler.Task { + public static class UnpauseCallback implements Task { Interpreter i; UnpauseCallback(Interpreter i) { this.i = i; } public void perform() throws JSExn { unpause(null); } @@ -130,7 +131,12 @@ public class JS extends org.ibex.util.BalancedTree { if((int)d == d) return Integer.toString((int)d); return o.toString(); } - throw new RuntimeException("can't coerce that!"); + if (o instanceof JS) return ((JS)o).coerceToString(); // HACK for now, this will probably go away + throw new RuntimeException("can't coerce "+o+" [" + o.getClass().getName() + "] to type String."); + } + + public String coerceToString() { + throw new RuntimeException("can't coerce "+this+" [" + getClass().getName() + "] to type String."); } // Instance Methods ////////////////////////////////////////////////////////////////////