Mercurial > urweb
comparison src/jscomp.sml @ 1848:e15234fbb163
Basis.tryRpc
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Tue, 16 Apr 2013 10:55:48 -0400 |
parents | 8958b580d026 |
children | 98895243b5b6 |
comparison
equal
deleted
inserted
replaced
1847:8958b580d026 | 1848:e15234fbb163 |
---|---|
1 (* Copyright (c) 2008-2012, Adam Chlipala | 1 (* Copyright (c) 2008-2013, Adam Chlipala |
2 * All rights reserved. | 2 * All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are met: | 5 * modification, are permitted provided that the following conditions are met: |
6 * | 6 * |
928 e, | 928 e, |
929 str ",null)}"], | 929 str ",null)}"], |
930 st) | 930 st) |
931 end | 931 end |
932 | 932 |
933 | EServerCall (e, t, eff) => | 933 | EServerCall (e, t, eff, fm) => |
934 let | 934 let |
935 val (e, st) = jsE inner (e, st) | 935 val (e, st) = jsE inner (e, st) |
936 val (unurl, st) = unurlifyExp loc (t, st) | 936 val (unurl, st) = unurlifyExp loc (t, st) |
937 val lastArg = case fm of | |
938 None => "null" | |
939 | Error => | |
940 let | |
941 val isN = if isNullable t then | |
942 "true" | |
943 else | |
944 "false" | |
945 in | |
946 "cons({c:\"c\",v:" ^ isN ^ "},null)" | |
947 end | |
937 in | 948 in |
938 (strcat [str ("{c:\"f\",f:rc,a:cons({c:\"c\",v:\"" | 949 (strcat [str ("{c:\"f\",f:rc,a:cons({c:\"c\",v:\"" |
939 ^ Settings.getUrlPrefix () | 950 ^ Settings.getUrlPrefix () |
940 ^ "\"},cons("), | 951 ^ "\"},cons("), |
941 e, | 952 e, |
942 str (",cons({c:\"c\",v:function(s){var t=s.split(\"/\");var i=0;return " | 953 str (",cons({c:\"c\",v:function(s){var t=s.split(\"/\");var i=0;return " |
943 ^ unurl ^ "}},cons({c:\"K\"},cons({c:\"c\",v:" | 954 ^ unurl ^ "}},cons({c:\"K\"},cons({c:\"c\",v:" |
944 ^ (case eff of | 955 ^ (case eff of |
945 ReadCookieWrite => "true" | 956 ReadCookieWrite => "true" |
946 | _ => "false") | 957 | _ => "false") |
947 ^ "},null)))))}")], | 958 ^ "}," ^ lastArg ^ ")))))}")], |
948 st) | 959 st) |
949 end | 960 end |
950 | 961 |
951 | ERecv (e, t) => | 962 | ERecv (e, t) => |
952 let | 963 let |
1229 val (e, st) = exp outer (e, st) | 1240 val (e, st) = exp outer (e, st) |
1230 in | 1241 in |
1231 ((ESignalSource e, loc), st) | 1242 ((ESignalSource e, loc), st) |
1232 end | 1243 end |
1233 | 1244 |
1234 | EServerCall (e1, t, ef) => | 1245 | EServerCall (e1, t, ef, fm) => |
1235 let | 1246 let |
1236 val (e1, st) = exp outer (e1, st) | 1247 val (e1, st) = exp outer (e1, st) |
1237 in | 1248 in |
1238 ((EServerCall (e1, t, ef), loc), st) | 1249 ((EServerCall (e1, t, ef, fm), loc), st) |
1239 end | 1250 end |
1240 | ERecv (e1, t) => | 1251 | ERecv (e1, t) => |
1241 let | 1252 let |
1242 val (e1, st) = exp outer (e1, st) | 1253 val (e1, st) = exp outer (e1, st) |
1243 in | 1254 in |