comparison src/iflow.sml @ 1932:98895243b5b6

Change handling of returned text blobs, to activate the normal EWrite optimizations
author Adam Chlipala <adam@chlipala.net>
date Wed, 11 Dec 2013 18:22:10 -0500
parents 3c93e91e97da
children 4d64af730e35
comparison
equal deleted inserted replaced
1931:1a04b1edded2 1932:98895243b5b6
1585 | EStrcat (e1, e2) => 1585 | EStrcat (e1, e2) =>
1586 evalExp env e1 (fn e1 => 1586 evalExp env e1 (fn e1 =>
1587 evalExp env e2 (fn e2 => 1587 evalExp env e2 (fn e2 =>
1588 k (Func (Other "cat", [e1, e2])))) 1588 k (Func (Other "cat", [e1, e2]))))
1589 | EError (e, _) => evalExp env e (fn e => St.send (e, loc)) 1589 | EError (e, _) => evalExp env e (fn e => St.send (e, loc))
1590 | EReturnBlob {blob = b, mimeType = m, ...} => 1590 | EReturnBlob {blob = NONE, ...} => raise Fail "Iflow doesn't support blob optimization"
1591 | EReturnBlob {blob = SOME b, mimeType = m, ...} =>
1591 evalExp env b (fn b => 1592 evalExp env b (fn b =>
1592 (St.send (b, loc); 1593 (St.send (b, loc);
1593 evalExp env m 1594 evalExp env m
1594 (fn m => St.send (m, loc)))) 1595 (fn m => St.send (m, loc))))
1595 | ERedirect (e, _) => 1596 | ERedirect (e, _) =>
2058 NONE => doV Unknown 2059 NONE => doV Unknown
2059 | SOME inp => doV (SubInput inp) 2060 | SOME inp => doV (SubInput inp)
2060 end 2061 end
2061 | EStrcat (e1, e2) => (EStrcat (doExp env e1, doExp env e2), loc) 2062 | EStrcat (e1, e2) => (EStrcat (doExp env e1, doExp env e2), loc)
2062 | EError (e1, t) => (EError (doExp env e1, t), loc) 2063 | EError (e1, t) => (EError (doExp env e1, t), loc)
2063 | EReturnBlob {blob = b, mimeType = m, t} => 2064 | EReturnBlob {blob = NONE, mimeType = m, t} =>
2064 (EReturnBlob {blob = doExp env b, mimeType = doExp env m, t = t}, loc) 2065 (EReturnBlob {blob = NONE, mimeType = doExp env m, t = t}, loc)
2066 | EReturnBlob {blob = SOME b, mimeType = m, t} =>
2067 (EReturnBlob {blob = SOME (doExp env b), mimeType = doExp env m, t = t}, loc)
2065 | ERedirect (e1, t) => (ERedirect (doExp env e1, t), loc) 2068 | ERedirect (e1, t) => (ERedirect (doExp env e1, t), loc)
2066 | EWrite e1 => (EWrite (doExp env e1), loc) 2069 | EWrite e1 => (EWrite (doExp env e1), loc)
2067 | ESeq (e1, e2) => (ESeq (doExp env e1, doExp env e2), loc) 2070 | ESeq (e1, e2) => (ESeq (doExp env e1, doExp env e2), loc)
2068 | ELet (x, t, e1, e2) => (ELet (x, t, doExp env e1, doExp (Unknown :: env) e2), loc) 2071 | ELet (x, t, e1, e2) => (ELet (x, t, doExp env e1, doExp (Unknown :: env) e2), loc)
2069 | EClosure (n, es) => (EClosure (n, map (doExp env) es), loc) 2072 | EClosure (n, es) => (EClosure (n, map (doExp env) es), loc)