diff options
author | Björn Gustavsson <[email protected]> | 2011-04-10 11:10:56 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2011-04-12 05:54:47 +0200 |
commit | 13be8d88969caa266b07d09294094a4cce8bbd8f (patch) | |
tree | be3383139f04f5ac481e1443a9e9860306d68f6d /lib/compiler | |
parent | 2c67e91d20daf46e4ffff91b10208768d97e8ec8 (diff) | |
download | otp-13be8d88969caa266b07d09294094a4cce8bbd8f.tar.gz otp-13be8d88969caa266b07d09294094a4cce8bbd8f.tar.bz2 otp-13be8d88969caa266b07d09294094a4cce8bbd8f.zip |
beam_bsm: Eliminate uncovered line in warning generation
In warning_translate_label/2, gb_trees:lookup/2 is called
to translate from the entry label for a function to its name.
Since the gb_tree has an entry for all functions in the module,
there is no way that the lookup can fail unless there is a
serious bug.
Therefore, use gb_trees:get/2 so that an exception and an
internal compiler error will be generated if the lookup would
ever fail.
Diffstat (limited to 'lib/compiler')
-rw-r--r-- | lib/compiler/src/beam_bsm.erl | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/compiler/src/beam_bsm.erl b/lib/compiler/src/beam_bsm.erl index 2a36fda1ea..5cc8252b99 100644 --- a/lib/compiler/src/beam_bsm.erl +++ b/lib/compiler/src/beam_bsm.erl @@ -651,10 +651,8 @@ add_warning(Term, Anno, Ws) -> warning_translate_label(Term, D) when is_tuple(Term) -> case element(1, Term) of {label,F} -> - case gb_trees:lookup(F, D) of - none -> Term; - {value,FA} -> setelement(1, Term, FA) - end; + FA = gb_trees:get(F, D), + setelement(1, Term, FA); _ -> Term end; warning_translate_label(Term, _) -> Term. |