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.Clone) 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. */
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); }