File tree Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -215,7 +215,7 @@ let rec verify_expression env current_env e =
215
215
if (e1.etype <> Some (Primitive (Int )) && e1.etype <> Some (Primitive (Float ))) then
216
216
raise(WrongTypePostfixOperation (string_of_expression(e1)^ " --" ))
217
217
);
218
- e.etype < - e1.etype;
218
+ e.etype < - e1.etype
219
219
| Pre (op ,e1 ) ->
220
220
verify_expression env current_env e1;
221
221
(match op with
@@ -238,11 +238,17 @@ let rec verify_expression env current_env e =
238
238
| Op_cor | Op_cand | Op_eq | Op_ne | Op_gt | Op_lt | Op_ge | Op_le -> e.etype < - Some (Primitive (Boolean ))
239
239
| Op_or | Op_and | Op_xor | Op_shl | Op_shr | Op_shrr | Op_add | Op_sub | Op_mul | Op_div | Op_mod -> e.etype < - e1.etype)
240
240
| CondOp (e1 ,e2 ,e3 ) -> () (* TODO*)
241
- | Cast (t ,e ) -> () (* TODO*)
242
- | Type t -> () (* TODO*)
243
- | ClassOf t -> () (* TODO*)
244
- | Instanceof (e1 , t )-> () (* TODO*)
245
- | VoidClass -> () (* TODO*)
241
+ | Cast (t ,e1 ) ->
242
+ verify_expression env current_env e1;
243
+ e.etype < - Some (t)
244
+ | Type t ->
245
+ e.etype < - Some (t)
246
+ | ClassOf t ->
247
+ e.etype < - Some (t)
248
+ | Instanceof (e1 , t ) ->
249
+ verify_expression env current_env e1;
250
+ e.etype < - Some (Primitive (Boolean ))
251
+ | VoidClass -> ()
246
252
247
253
(* add a local variable to the current environment *)
248
254
let add_local_variable current_env id t =
Original file line number Diff line number Diff line change @@ -16,6 +16,9 @@ public I(int e) {
16
16
int g = ~5 ;
17
17
float h = (-8.5f );
18
18
boolean boo = I .a ;
19
+ int sr = 5 ;
20
+ long l = (long ) sr ;
21
+ boolean test = my instanceof I ;
19
22
private String func1 (int a ) {
20
23
int b = 1 ;
21
24
b += (5 +4 );
You can’t perform that action at this time.
0 commit comments