summaryrefslogtreecommitdiff
path: root/src/pretty_typing.ml
diff options
context:
space:
mode:
authorAlex AUVOLAT <alex.auvolat@ens.fr>2013-12-26 21:53:50 +0100
committerAlex AUVOLAT <alex.auvolat@ens.fr>2013-12-26 21:53:50 +0100
commitb5b6163332977297617990863564659d49d3e086 (patch)
tree343b68771afbac1fde37c11b4454bd8b8158e273 /src/pretty_typing.ml
parent62d931b6b52bbb952a2c280823dcc8bb5bd591bd (diff)
downloadLPC-Projet-b5b6163332977297617990863564659d49d3e086.tar.gz
LPC-Projet-b5b6163332977297617990863564659d49d3e086.zip
Fuck yeah all tests pass.
Diffstat (limited to 'src/pretty_typing.ml')
-rw-r--r--src/pretty_typing.ml12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/pretty_typing.ml b/src/pretty_typing.ml
index 3e5f144..a6ec2eb 100644
--- a/src/pretty_typing.ml
+++ b/src/pretty_typing.ml
@@ -47,11 +47,12 @@ let rec expr_string e = match e.te_desc with
| TEUnary(e, f) -> (unop_str e) ^ (expr_string f)
| TEBinary(e1, o, e2) -> "(" ^ (expr_string e1) ^ " " ^ (binop_str o) ^ " " ^ (expr_string e2) ^ ")"
| TEMember(e1, i) -> "(" ^ (expr_string e1) ^ ")@" ^ (string_of_int i)
+ | TEPointerCast(e1, i) -> "(" ^ (expr_string e1) ^ ")+" ^ (string_of_int i)
| TENew(c, proto, arg) -> "new " ^ c.tc_name
- ^ (match proto with | None -> "" | Some p -> " ." ^ p)
+ ^ " ." ^ proto
^ " (" ^ (csl expr_string (List.map fst arg)) ^ ")"
- | TECallVirtual(exp, pos1, pos2, args, _) ->
- "(" ^ (expr_string exp) ^ ")@" ^ (string_of_int pos1) ^ "#" ^ (string_of_int pos2) ^ "(" ^ (csl expr_string (List.map fst args)) ^ ")"
+ | TECallVirtual(exp, pos2, args, _) ->
+ "(" ^ (expr_string exp) ^ ")#" ^ (string_of_int pos2) ^ "(" ^ (csl expr_string (List.map fst args)) ^ ")"
let rec print_stmt l x =
for i = 1 to l do print_string " " done;
@@ -77,7 +78,8 @@ let rec print_stmt l x =
| TSDeclare(ty, i) -> print_string (i ^ " : " ^ (var_type_str ty) ^ "\n")
| TSDeclareAssignExpr((ty,b), i, e) -> let addr = (if b then "&" else "") in
print_string (addr ^ i ^ " : " ^ (var_type_str ty) ^ " = " ^ (expr_string e) ^ "\n")
- | TSDeclareAssignConstructor(cls, i, c, a) -> print_string "XXX\n"
+ | TSDeclareAssignConstructor(cls, i, c, a) ->
+ print_string (i ^ " : " ^ cls.tc_name ^ " = ." ^ c ^ " (" ^(csl expr_string (List.map fst a)) ^ ")\n")
| TSWriteCout(k) -> print_string ("std::cout" ^
(List.fold_left (fun x k -> x ^ " << " ^ (match k with
| TSEExpr e -> expr_string e
@@ -101,7 +103,7 @@ let proto_str p =
p.tp_args)
^ ") : " ^ (match p.tp_ret_type with | Some (ty,b) -> var_type_str ty | None -> "constructor")
^ " ." ^ p.tp_unique_ident
- ^ (match p.tp_virtual with | None -> "" | Some (k, l) -> " @" ^ (string_of_int k) ^ "#" ^ (string_of_int l))
+ ^ (match p.tp_virtual with | None -> "" | Some (k, l) -> " @" ^ (string_of_int k.h_pos) ^ "#" ^ (string_of_int l))
let print_class_decl c =
print_string ("class " ^ c.tc_name ^ " (size : " ^ (string_of_int c.tc_size) ^ ") {\n");