# HG changeset patch # User Adam Chlipala # Date 1313937559 14400 # Node ID 5f530f8e35110152997da62ef75dcfd940dd2ae1 # Parent a99b743a30873cd732e8520dc45c6281b94a6127 Fix crash in list unurlification diff -r a99b743a3087 -r 5f530f8e3511 src/cjr_print.sml --- a/src/cjr_print.sml Fri Aug 19 15:23:01 2011 -0400 +++ b/src/cjr_print.sml Sun Aug 21 10:39:19 2011 -0400 @@ -541,16 +541,21 @@ fun unurlify fromClient env (t, loc) = let + fun deStar request = + case request of + "(*request)" => "request" + | _ => "&" ^ request + fun unurlify' request t = case t of - TFfi ("Basis", "unit") => string ("uw_Basis_unurlifyUnit(ctx, &" ^ request ^ ")") + TFfi ("Basis", "unit") => string ("uw_Basis_unurlifyUnit(ctx, " ^ deStar request ^ ")") | TFfi ("Basis", "string") => string (if fromClient then - "uw_Basis_unurlifyString_fromClient(ctx, &" ^ request ^ ")" + "uw_Basis_unurlifyString_fromClient(ctx, " ^ deStar request ^ ")" else - "uw_Basis_unurlifyString(ctx, &" ^ request ^ ")") - | TFfi (m, t) => string ("uw_" ^ ident m ^ "_unurlify" ^ capitalize t ^ "(ctx, &" ^ request ^ ")") + "uw_Basis_unurlifyString(ctx, " ^ deStar request ^ ")") + | TFfi (m, t) => string ("uw_" ^ ident m ^ "_unurlify" ^ capitalize t ^ "(ctx, " ^ deStar request ^ ")") - | TRecord 0 => string ("uw_Basis_unurlifyUnit(ctx, &" ^ request ^ ")") + | TRecord 0 => string ("uw_Basis_unurlifyUnit(ctx, " ^ deStar request ^ ")") | TRecord i => let val xts = E.lookupStruct env i @@ -623,7 +628,7 @@ if IS.member (!unurlifies, i) then box [string "unurlify_", string (Int.toString i), - string ("(ctx, &" ^ request ^ ")")] + string ("(ctx, " ^ deStar request ^ ")")] else let val (x, _) = E.lookupDatatype env i @@ -721,7 +726,7 @@ if IS.member (!unurlifies, i) then box [string "unurlify_", string (Int.toString i), - string ("(ctx, &" ^ request ^ ")")] + string ("(ctx, " ^ deStar request ^ ")")] else let val (x, xncs) = E.lookupDatatype env i @@ -807,14 +812,14 @@ box [string "unurlify_", string (Int.toString i), - string ("(ctx, &" ^ request ^ ")")] + string ("(ctx, " ^ deStar request ^ ")")] end | TList (t', i) => if IS.member (!unurlifies, i) then box [string "unurlify_list_", string (Int.toString i), - string ("(ctx, &" ^ request ^ ")")] + string ("(ctx, " ^ deStar request ^ ")")] else (unurlifies := IS.add (!unurlifies, i); addUrlHandler (box [string "static", @@ -832,7 +837,7 @@ space, string "+=", space, - string "3, ((*request)[0] == '/' ? *request++ = 0 : 0), NULL) : ((!strncmp(*request, \"Cons\", 4) && ((*request)[4] == 0 ", + string "3, ((*request)[0] == '/' ? ((*request)[0] = 0, (*request)++) : NULL)) : ((!strncmp(*request, \"Cons\", 4) && ((*request)[4] == 0 ", string "|| (*request)[4] == '/')) ? (*request", space, string "+=", @@ -874,7 +879,7 @@ box [string "unurlify_list_", string (Int.toString i), - string ("(ctx, &" ^ request ^ ")")]) + string ("(ctx, " ^ deStar request ^ ")")]) | TOption t => box [string ("(" ^ request ^ "[0] == '/' ? ++" ^ request ^ " : " ^ request ^ ", "), diff -r a99b743a3087 -r 5f530f8e3511 tests/rpcList2.ur --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/rpcList2.ur Sun Aug 21 10:39:19 2011 -0400 @@ -0,0 +1,7 @@ +fun rpcFunc l : transaction {} = return () + +fun main () : transaction page = return +