jan_flanders

Untitled

Dec 12th, 2012
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
OCaml 0.86 KB | None | 0 0
  1.     let make_constant_value r c t =
  2.         let v = (match classify ctx t, c with
  3.         | _, None -> HVNone
  4.         | (KInt | KFloat | KUInt | KBool) as kind, Some c ->
  5.             (match c with
  6.             | TInt i -> if kind = KUInt then HVUInt i else HVInt i
  7.             | TFloat s -> HVFloat (float_of_string s)
  8.             | TBool b -> HVBool b
  9.             | TNull -> error ("In Flash9, null can't be used as basic type " ^ s_type (print_context()) t) p
  10.             | _ -> assert false)
  11.             | KType(HMPath([],"String")), (Some (TString s)) -> HVString s
  12.         | _, Some TNull -> HVNone
  13.         | k, Some c ->
  14.             (*write ctx (HReg r.rid); *)
  15.             (*write ctx HNull; *)
  16.             (*let j = jump ctx J3Neq in *)
  17.             (*gen_constant ctx c t p; *)
  18.             (*coerce ctx k; *)
  19.             (*write ctx (HSetReg r.rid); *)
  20.             (*j(); *)
  21.             HVNone
  22.         ) in
  23.         match !dparams with
  24.         | None -> if c <> None then dparams := Some [v]
  25.         | Some l -> dparams := Some (v :: l)
  26.     in
Advertisement
Add Comment
Please, Sign In to add comment