Received: by 10.204.130.7 with SMTP id q7mr4067694bks.2.1343120128479; Tue, 24 Jul 2012 01:55:28 -0700 (PDT) X-BeenThere: closure-compiler-discuss@googlegroups.com Received: by 10.204.146.82 with SMTP id g18ls7519073bkv.3.gmail; Tue, 24 Jul 2012 01:55:25 -0700 (PDT) Received: by 10.205.139.2 with SMTP id iu2mr4066010bkc.7.1343120125280; Tue, 24 Jul 2012 01:55:25 -0700 (PDT) Received: by 10.205.139.2 with SMTP id iu2mr4066008bkc.7.1343120125268; Tue, 24 Jul 2012 01:55:25 -0700 (PDT) Return-Path: Received: from forward8.mail.yandex.net (forward8.mail.yandex.net. [77.88.61.38]) by gmr-mx.google.com with ESMTP id q3si4350900bkv.1.2012.07.24.01.55.25; Tue, 24 Jul 2012 01:55:25 -0700 (PDT) Received-SPF: pass (google.com: domain of alaku...@yandex.ru designates 77.88.61.38 as permitted sender) client-ip=77.88.61.38; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of alaku...@yandex.ru designates 77.88.61.38 as permitted sender) smtp.mail=alaku...@yandex.ru; dkim=pass header...@yandex.ru Received: from smtp7.mail.yandex.net (smtp7.mail.yandex.net [77.88.61.55]) by forward8.mail.yandex.net (Yandex) with ESMTP id 786EFF61491 for ; Tue, 24 Jul 2012 12:55:24 +0400 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1343120124; bh=n1D82kglTFcklR+dVsLRzbwLOB/cQCvwxwCmsDp1YUI=; h=MIME-Version:In-Reply-To:References:Date:Message-ID:Subject:From: To:Content-Type; b=ZsThsFCTiKw/m4imJE4Xjzh9CddUoxU8H4mPwj06bV7fca65v00SmB3yRHIPjv2GL bH/2mZmYT23qK3ozQd1sX7D/Hu/U6izmWNH0/oHidwaeQ5qXDfVtekxFPKdMTtfpcO Kc/ZZfUxr5XuuQwo2Wmd8vHyww54Xdv3kf+H8mMc= Received: from smtp7.mail.yandex.net (localhost [127.0.0.1]) by smtp7.mail.yandex.net (Yandex) with ESMTP id 64C5E158050B for ; Tue, 24 Jul 2012 12:55:24 +0400 (MSK) Received: from mail-pb0-f48.google.com (mail-pb0-f48.google.com [209.85.160.48]) by smtp7.mail.yandex.net (nwsmtp/Yandex) with ESMTP id tLKOLKdw-tNKCf5w8; Tue, 24 Jul 2012 12:55:23 +0400 X-Yandex-Rcpt-Suid: closure-compiler-discuss@googlegroups.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1343120124; bh=n1D82kglTFcklR+dVsLRzbwLOB/cQCvwxwCmsDp1YUI=; h=Received:MIME-Version:Received:Received:In-Reply-To:References: Date:Message-ID:Subject:From:To:Content-Type; b=hPWhkSLqMyyRR6C9GPIqZk1Mlbgs+BW3rNaCmR/PD4Klnxj0qwM6JsceiFeuTh1uG tnNcm6eedykJiz91Y8ClVJOB8UvXIZgZB1dXPFa1S8wdbzo5kaBDJiqOh46Oicm9N9 aN5sDj1k48UN7c1cGHRKrwVxhjGTDjqgCrWUcQIg= Received: by pbbrq8 with SMTP id rq8so13722393pbb.21 for ; Tue, 24 Jul 2012 01:55:21 -0700 (PDT) MIME-Version: 1.0 Received: by 10.68.131.41 with SMTP id oj9mr42512331pbb.130.1343120121485; Tue, 24 Jul 2012 01:55:21 -0700 (PDT) Received: by 10.68.65.98 with HTTP; Tue, 24 Jul 2012 01:55:21 -0700 (PDT) In-Reply-To: References: <24544524-5acc-4e09-a9e3-7dd661867d87@googlegroups.com> <36c9b20a-533b-42ec-838b-414f8e0e45e8@googlegroups.com> Date: Tue, 24 Jul 2012 12:55:21 +0400 Message-ID: Subject: Re: [closure-compiler-discuss] False "Missing return statement" warning From: Alexey Lakutin To: closure-compiler-discuss@googlegroups.com Content-Type: text/plain; charset=ISO-8859-1 Well, I understand this, but not sure about compiler. Actually, I do not need to throw and return value at the same time. And I do not want to catch exception here. Guess, I understand Compiler thoughts about my code: it is how "finally" block processed. Probably Compiler knows that "finally" is the last block of function (in execution order), but it does not take into account that it is NOT the block that should return a value and erroneously expect it, though value is returned by "previous" execution block, which is the last statement of normal execution flow. Not sure is it bug of compiler or not. Guess it should check "normal" and "catch" execution paths for return value, but omit "finally" block. 2012/7/24 Chris Price : > The difference is that finally doesn't swallow the exception so the > function never returns any value, instead it throws the exception [1]. > As far as I'm aware there isn't any way to propagate the exception at > the same time as returning a value, it just doesn't make sense. You > could instead catch the exception and then return false [2]. > > [1] http://jsfiddle.net/tVdpb/ > [2] http://jsfiddle.net/tVdpb/1/ > > On Tue, Jul 24, 2012 at 8:58 AM, LioLick wrote: >> Thanks Chris, >> it is just a minimal sample code that can reproduce such a problem. >> I'm trying to compile large amount of existing code with Closure Compiler. >> I've discovered that moving "return true;" into finally block resolves the >> problem, but still want to know - what's the difference from Closure >> Compiler point: >> code flow is the same in both cases. >> @throws tag does not satisfy compiler. >> Common use case is: >> try >> { >> // some dangerous operation >> } >> finally >> { >> // restore initial state in both cases: success or failure >> } >> >> // postprocess result on success or pass exception up >> return result;