X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fibex%2Fjs%2FJSU.java;fp=src%2Forg%2Fibex%2Fjs%2FJSU.java;h=805224b7749f23dc7e74d2f42f86243bda107f45;hb=f3ad8b6cba43f3c5364dc2cd9f1d050c1f48f167;hp=9fa3630f46c8e27ea8da6d0bad46aa558dc754d5;hpb=f63da7aeac2f942be41aefde91002d14117a8573;p=org.ibex.js.git diff --git a/src/org/ibex/js/JSU.java b/src/org/ibex/js/JSU.java index 9fa3630..805224b 100644 --- a/src/org/ibex/js/JSU.java +++ b/src/org/ibex/js/JSU.java @@ -9,8 +9,11 @@ public class JSU { public static final JS[] emptyArgs = new JS[] { }; - // FIXME - public static InputStream getInputStream(JS j) { return null; } + public static InputStream getInputStream(JS j) throws IOException { + while(j != null && j instanceof JS.Cloneable) j = j.unclone(); + if (j != null && j instanceof Fountain) return ((Fountain)j).getInputStream(); + return null; + } /** returns a Pausable which will restart the context; * expects a value to be pushed onto the stack when unpaused. */ @@ -119,13 +122,8 @@ public class JSU { public static JS fromReader(String sourceName, int firstLine, Reader source) throws IOException { return Parser.fromReader(sourceName, firstLine, source); } - // FIXME public static JS cloneWithNewGlobalScope(JS js, JS s) { - if(js instanceof JSFunction) - return ((JSFunction)js)._cloneWithNewParentScope(new JSScope.Top(s)); - else - return js; - } + return js instanceof JSFunction ? ((JSFunction)js)._cloneWithNewParentScope(new JSScope.Top(s)) : js; } /** log a message with the current JavaScript sourceName/line */ public static void log(Object message) { info(message); }