소스 검색

Fixed some compilation warnings

Taddeus Kroes 11 년 전
부모
커밋
ad3781f9c3
5개의 변경된 파일11개의 추가작업 그리고 11개의 파일을 삭제
  1. 1 1
      phases/constprop.ml
  2. 4 4
      phases/print.ml
  3. 2 2
      phases/typecheck.ml
  4. 1 1
      phases/unroll.ml
  5. 3 3
      util.ml

+ 1 - 1
phases/constprop.ml

@@ -107,7 +107,7 @@ let eval node =
 
   (* Binop - logical *)
   | Binop (And, Const (BoolVal left, _), Const (BoolVal right, _), ann) ->
-    Const (BoolVal (left & right), ann)
+    Const (BoolVal (left && right), ann)
   | Binop (Or, Const (BoolVal left, _), Const (BoolVal right, _), ann) ->
     Const (BoolVal (left || right), ann)
 

+ 4 - 4
phases/print.ml

@@ -25,9 +25,9 @@ let op2str = function
 
 let prefix = function
   | Void    -> ""
-  | Bool _  -> "b"
-  | Int _   -> "i"
-  | Float _ -> "f"
+  | Bool    -> "b"
+  | Int     -> "i"
+  | Float   -> "f"
   | Array _ -> "a"
   | _ -> raise (FatalError (Msg "invalid type"))
 
@@ -74,7 +74,7 @@ let rec instr2str = function
     tab ^ prefix ctype ^ "store" ^ suffix scope ^ " " ^ si index
 
   (* Load *)
-  | Load (ctype, Current, index) when index >= 0 & index <= 3 ->
+  | Load (ctype, Current, index) when index >= 0 && index <= 3 ->
     tab ^ prefix ctype ^ "load_" ^ si index
   | Load (ctype, scope, index) ->
     tab ^ prefix ctype ^ "load" ^ suffix scope ^ " " ^ si index

+ 2 - 2
phases/typecheck.ml

@@ -44,7 +44,7 @@ let type2str_error = function
 
 let check_type ?(msg="") expected node =
   let got = typeof node in
-  if expected <> Unknown & got <> Unknown & (spec got) <> (spec expected)
+  if expected <> Unknown && got <> Unknown && (spec got) <> (spec expected)
     then begin
       let msg = match msg with
       | "" -> sprintf "type mismatch: expected type %s, got %s"
@@ -68,7 +68,7 @@ let op_result_type opnd_type = function
 (* Check if the given operator can be applied to the given type *)
 let check_type_op allowed_types desc node =
   let got = typeof node in
-  if got <> Unknown & not (List.mem got allowed_types)
+  if got <> Unknown && not (List.mem got allowed_types)
     then
       [NodeMsg (node, sprintf
         "%s cannot be applied to type %s, only to %s"

+ 1 - 1
phases/unroll.ml

@@ -51,7 +51,7 @@ let rec unroll_body counters = function
       _),
       Block body,
     _) as loop) :: tl
-    when is_generated_id i & comp = i ->
+    when is_generated_id i && comp = i ->
     begin
       match get_body_step i [] body with
       | Some (step, rest) ->

+ 3 - 3
util.ml

@@ -47,12 +47,12 @@ let generate_const id num = generate_id id num ^ "_"
 
 let fresh_const id = fresh_id id ^ "_"
 
-let is_generated_id id = String.length id >= 1 & id.[0] = '_'
+let is_generated_id id = String.length id >= 1 && id.[0] = '_'
 
 let is_const_id id =
   String.length id >= 2
-  & id.[0] = '_'
-  & id.[String.length id - 1] = '_'
+  && id.[0] = '_'
+  && id.[String.length id - 1] = '_'
 
 let loc_from_lexpos pstart pend =
   let (fname, ystart, yend, xstart, xend) = begin