@@ -58,10 +58,8 @@ let verify_invoke_args args const_info func_name =
58
58
if (List. length args <> List. length const_info) then
59
59
raise(WrongInvokedArgumentsLength (" actual and formal argument lists differ in length" ))
60
60
else
61
- begin
62
- (* Use List.iter2 to compare to list*)
61
+ (* Use List.iter2 to compare to list*)
63
62
List. iter2 compare_args args const_info
64
- end
65
63
66
64
(* verify declared types of variables in constructor arguments or methods arguments *)
67
65
let verify_declared_args current_env arguments =
@@ -101,28 +99,12 @@ let verify_name s env current_env =
101
99
(* check the type of the assignment operation *)
102
100
let verify_assignop_type t1 t2 op =
103
101
if t1 <> t2 then
104
- begin
105
- raise(WrongTypesAssignOperation (stringOfOpt t1, string_of_assign_op op ,stringOfOpt t2));
106
- match t1 with
107
- | Some t ->
108
- print_string " \n ************************\n " ;
109
- print_string ((stringOf t));
110
- print_string " \n ************************\n " ;
111
- match t2 with
112
- | Some t ->
113
- print_string " \n ++++++++++++++++++++++\n " ;
114
- print_string ((stringOf t));
115
- print_string " \n ++++++++++++++++++++++\n " ;
116
- | None -> ()
117
- | None -> ()
118
- end
102
+ raise(WrongTypesAssignOperation (stringOfOpt t1, string_of_assign_op op ,stringOfOpt t2))
119
103
120
104
(* check the type of the operation eg: ==, + *)
121
105
let verify_operation_type t1 op t2 =
122
106
if t1 <> t2 then
123
- begin
124
- raise(WrongTypesOperation (stringOfOpt t1, string_of_infix_op op, stringOfOpt t2));
125
- end
107
+ raise(WrongTypesOperation (stringOfOpt t1, string_of_infix_op op, stringOfOpt t2))
126
108
127
109
(* check the type of call expression when it existe the method name, the arguments and global env *)
128
110
let verify_call_expr meth_name args env class_name =
@@ -153,7 +135,6 @@ let rec verify_array_init_list el =
153
135
raise(WrongTypeArrayInitList (stringOfOpt h.etype, stringOfOpt h1.etype)));
154
136
verify_array_init_list t
155
137
156
-
157
138
(* check the type of the expressions *)
158
139
let rec verify_expression env current_env e =
159
140
(* print_string(string_of_expression_desc(e.edesc)); *)
@@ -416,10 +397,6 @@ let rec verify_statement current_env envs statement =
416
397
417
398
(* check type for constructors *)
418
399
let verify_constructors envs current_class consts =
419
- (* consts is of astconst structure *)
420
- (* print_endline ("=====verify_constructors======");
421
- print_class_env(Hashtbl.find envs current_class);
422
- print_endline ("=====verify_constructors======"); *)
423
400
let current_env = {
424
401
returntype = Type. Ref ({ tpath = [] ; tid = consts.cname });
425
402
variables = Hashtbl. create 17 ;
@@ -471,7 +448,6 @@ let add_constructors env current_class consts =
471
448
let consts_table = (Hashtbl. find env current_class).constructors in
472
449
if (Hashtbl. mem consts_table consts.cname) <> true
473
450
then (
474
- (* print_const " " consts; *)
475
451
Hashtbl. add consts_table consts.cname
476
452
{ftype = Type. Ref {tpath= [] ; tid= current_class};
477
453
fargs = consts.cargstype;
@@ -484,21 +460,19 @@ let add_methods env current_class meths =
484
460
let meths_table = (Hashtbl. find env current_class).methods in
485
461
if (Hashtbl. mem meths_table meths.mname) <> true
486
462
then (
487
- (* print_method " " meths; *)
488
463
Hashtbl. add meths_table meths.mname
489
464
{ftype = meths.mreturntype;
490
465
fargs = meths.margstype;
491
466
fthrows = meths.mthrows }
492
467
)
493
- (* TODO: check override and overload*)
468
+ (* TODO: check override and overload *)
494
469
else raise(MethodAlreadyExists (meths.mname))
495
470
496
471
(* check if attribute has already exist in hash table *)
497
472
let add_attributes env current_class attrs =
498
473
let attrs_table = (Hashtbl. find env current_class).attributes in
499
474
if (Hashtbl. mem attrs_table attrs.aname) <> true
500
475
then (
501
- (* print_attribute " " attrs; *)
502
476
Hashtbl. add attrs_table attrs.aname attrs.atype
503
477
)
504
478
else raise(AttributeAlreadyExists (attrs.aname))
0 commit comments