From 13be8d88969caa266b07d09294094a4cce8bbd8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Sun, 10 Apr 2011 11:10:56 +0200 Subject: 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. --- lib/compiler/src/beam_bsm.erl | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'lib/compiler/src/beam_bsm.erl') 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. -- cgit v1.2.3