Skip to content

Commit 3432de5

Browse files
committed
---
yaml --- r: 908 b: refs/heads/master c: fce535c h: refs/heads/master v: v3
1 parent 53c76be commit 3432de5

File tree

2 files changed

+15
-17
lines changed

2 files changed

+15
-17
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: ae570016a4d0c93c321702e14b16b2785d47ca60
2+
refs/heads/master: fce535c04ae30d508debf9980cfc0c9475e08adc

trunk/src/boot/fe/cexp.ml

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ and parse_eq_pexp_opt (ps:pstate) : Ast.pexp option =
303303

304304
type pval =
305305
PVAL_str of string
306-
| PVAL_num of int64
306+
| PVAL_int of int64
307307
| PVAL_bool of bool
308308
;;
309309

@@ -325,7 +325,7 @@ let unexpected_val (expected:string) (v:pval) =
325325
let got =
326326
match v with
327327
PVAL_str s -> "str \"" ^ (String.escaped s) ^ "\""
328-
| PVAL_num i -> "num " ^ (Int64.to_string i)
328+
| PVAL_int i -> "int " ^ (Int64.to_string i)
329329
| PVAL_bool b -> if b then "bool true" else "bool false"
330330
in
331331
(* FIXME (issue #70): proper error reporting, please. *)
@@ -494,9 +494,9 @@ and eval_pexp (env:env) (exp:Ast.pexp) : pval =
494494
(Ast.BINOP_add, PVAL_str az, PVAL_str bz) ->
495495
PVAL_str (az ^ bz)
496496
| _ ->
497-
let av = (need_num av) in
498-
let bv = (need_num bv) in
499-
PVAL_num
497+
let av = (need_int av) in
498+
let bv = (need_int bv) in
499+
PVAL_int
500500
begin
501501
match bop with
502502
Ast.BINOP_add -> Int64.add av bv
@@ -515,7 +515,7 @@ and eval_pexp (env:env) (exp:Ast.pexp) : pval =
515515
Ast.UNOP_not ->
516516
PVAL_bool (not (eval_pexp_to_bool env a))
517517
| Ast.UNOP_neg ->
518-
PVAL_num (Int64.neg (eval_pexp_to_num env a))
518+
PVAL_int (Int64.neg (eval_pexp_to_int env a))
519519
| _ -> bug () "Unexpected unop in Cexp.eval_pexp"
520520
end
521521

@@ -530,10 +530,8 @@ and eval_pexp (env:env) (exp:Ast.pexp) : pval =
530530
| Ast.PEXP_lit (Ast.LIT_bool b) ->
531531
PVAL_bool b
532532

533-
| Ast.PEXP_lit (Ast.LIT_int i)
534-
| Ast.PEXP_lit (Ast.LIT_uint i)
535-
| Ast.PEXP_lit (Ast.LIT_mach_int (_, i)) ->
536-
PVAL_num i
533+
| Ast.PEXP_lit (Ast.LIT_int i) ->
534+
PVAL_int i
537535

538536
| Ast.PEXP_str s ->
539537
PVAL_str s
@@ -546,13 +544,13 @@ and eval_pexp_to_str (env:env) (exp:Ast.pexp) : string =
546544
PVAL_str s -> s
547545
| v -> unexpected_val "str" v
548546

549-
and need_num (cv:pval) : int64 =
547+
and need_int (cv:pval) : int64 =
550548
match cv with
551-
PVAL_num n -> n
552-
| v -> unexpected_val "num" v
549+
PVAL_int n -> n
550+
| v -> unexpected_val "int" v
553551

554-
and eval_pexp_to_num (env:env) (exp:Ast.pexp) : int64 =
555-
need_num (eval_pexp env exp)
552+
and eval_pexp_to_int (env:env) (exp:Ast.pexp) : int64 =
553+
need_int (eval_pexp env exp)
556554

557555
and eval_pexp_to_bool (env:env) (exp:Ast.pexp) : bool =
558556
match eval_pexp env exp with
@@ -655,7 +653,7 @@ let parse_crate_file
655653
ident) ps)
656654
| Some (PVAL_bool b) -> LIT_BOOL b
657655
| Some (PVAL_str s) -> LIT_STR s
658-
| Some (PVAL_num n) -> LIT_INT n
656+
| Some (PVAL_int n) -> LIT_INT n
659657
in
660658
let ps =
661659
make_parser crate_cache sess get_mod get_cenv_tok

0 commit comments

Comments
 (0)