Skip to content

Commit 5b7a8e1

Browse files
committed
Try -> TryTable in AST
1 parent c2f7fca commit 5b7a8e1

File tree

7 files changed

+7
-7
lines changed

7 files changed

+7
-7
lines changed

interpreter/binary/encode.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ struct
168168
op 0x04; block_type bt; list instr es1;
169169
if es2 <> [] then op 0x05;
170170
list instr es2; end_ ()
171-
| Try (bt, cs, es) ->
171+
| TryTable (bt, cs, es) ->
172172
op 0x1f; block_type bt; vec catch cs; list instr es; end_ ()
173173
| Br x -> op 0x0c; var x
174174
| BrIf x -> op 0x0d; var x

interpreter/exec/eval.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ let rec step (c : config) : config =
239239
| ThrowRef, Ref (ExnRef (t, args)) :: vs ->
240240
vs, [Throwing (t, args) @@ e.at]
241241

242-
| Try (bt, cs, es'), vs ->
242+
| TryTable (bt, cs, es'), vs ->
243243
let FuncType (ts1, ts2) = block_type frame.inst bt in
244244
let n1 = Lib.List32.length ts1 in
245245
let n2 = Lib.List32.length ts2 in

interpreter/syntax/ast.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ and instr' =
185185
| Unary of unop (* unary numeric operator *)
186186
| Binary of binop (* binary numeric operator *)
187187
| Convert of cvtop (* conversion *)
188-
| Try of block_type * catch list * instr list (* try *)
188+
| TryTable of block_type * catch list * instr list (* handle exceptions *)
189189
| Throw of var (* throw exception *)
190190
| ThrowRef (* rethrow exception *)
191191
| VecConst of vec (* constant *)

interpreter/syntax/free.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ let rec instr (e : instr) =
8484
tables (var x) ++ types (var y)
8585
| Throw x -> tags (var x)
8686
| ThrowRef -> empty
87-
| Try (bt, cs, es) ->
87+
| TryTable (bt, cs, es) ->
8888
block_type bt ++ list catch cs ++ block es
8989
| LocalGet x | LocalSet x | LocalTee x -> locals (var x)
9090
| GlobalGet x | GlobalSet x -> globals (var x)

interpreter/syntax/operators.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ let select t = Select t
2020
let block bt es = Block (bt, es)
2121
let loop bt es = Loop (bt, es)
2222
let if_ bt es1 es2 = If (bt, es1, es2)
23-
let try_table bt cs es = Try (bt, cs, es)
23+
let try_table bt cs es = TryTable (bt, cs, es)
2424
let br x = Br x
2525
let br_if x = BrIf x
2626
let br_table xs x = BrTable (xs, x)

interpreter/text/arrange.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ let rec instr e =
458458
"return_call_indirect " ^ var x, [Node ("type " ^ var y, [])]
459459
| Throw x -> "throw " ^ var x, []
460460
| ThrowRef -> "throw_ref", []
461-
| Try (bt, cs, es) ->
461+
| TryTable (bt, cs, es) ->
462462
"try_table", block_type bt @ list catch cs @ list instr es
463463
| LocalGet x -> "local.get " ^ var x, []
464464
| LocalSet x -> "local.set " ^ var x, []

interpreter/valid/valid.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ let rec check_instr (c : context) (e : instr) (s : infer_result_type) : op_type
319319
| ThrowRef ->
320320
[RefType ExnRefType] -->... []
321321

322-
| Try (bt, cs, es) ->
322+
| TryTable (bt, cs, es) ->
323323
let FuncType (ts1, ts2) as ft = check_block_type c bt in
324324
let c' = {c with labels = ts2 :: c.labels} in
325325
List.iter (fun ct -> check_catch c ct ts2 e.at) cs;

0 commit comments

Comments
 (0)