Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cduce
cduce
Commits
0e4517e9
Commit
0e4517e9
authored
Jul 10, 2007
by
Pietro Abate
Browse files
[r2003-05-25 12:20:16 by cvscast] No warning for embedded unused branches
Original author: cvscast Date: 2003-05-25 12:20:16+00:00
parent
719d0ee9
Changes
1
Hide whitespace changes
Inline
Side-by-side
typing/typer.ml
View file @
0e4517e9
...
...
@@ -537,7 +537,9 @@ let pat p =
module
Fv
=
IdSet
let
all_branches
=
ref
[]
type
branch
=
Branch
of
Typed
.
branch
*
branch
list
let
cur_branch
:
branch
list
ref
=
ref
[]
let
exp
loc
fv
e
=
fv
,
...
...
@@ -636,6 +638,8 @@ let rec expr loc = function
let
fv
=
ref
Fv
.
empty
in
let
accept
=
ref
Types
.
empty
in
let
branch
(
p
,
e
)
=
let
cur_br
=
!
cur_branch
in
cur_branch
:=
[]
;
let
(
fv2
,
e
)
=
expr
noloc
e
in
let
br_loc
=
merge_loc
p
.
loc
e
.
Typed
.
exp_loc
in
let
p
=
pat
p
in
...
...
@@ -648,7 +652,7 @@ let rec expr loc = function
Typed
.
br_used
=
br_loc
=
noloc
;
Typed
.
br_pat
=
p
;
Typed
.
br_body
=
e
}
in
all
_branch
es
:=
br
::
!
all_branches
;
cur
_branch
:=
Branch
(
br
,
!
cur_branch
)
::
cur_br
;
br
in
let
b
=
List
.
map
branch
b
in
(
!
fv
,
...
...
@@ -935,9 +939,17 @@ and type_rec_funs env l =
|
_
->
assert
false
)
l
;
types
let
report_unused_branches
()
=
let
rec
unused_branches
b
=
List
.
iter
(
fun
b
->
if
not
b
.
br_used
then
warning
b
.
br_loc
"This branch is not used"
)
!
all_branches
;
all_branches
:=
[]
(
fun
(
Branch
(
br
,
s
))
->
if
not
br
.
br_used
then
warning
br
.
br_loc
"This branch is not used"
else
unused_branches
s
)
b
let
report_unused_branches
()
=
unused_branches
!
cur_branch
;
cur_branch
:=
[]
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment