14f693d6b99ffdbc05e5e211e08ed5039e13279d2ricow@chromium.org// Copyright 2011 the V8 project authors. All rights reserved.
24f693d6b99ffdbc05e5e211e08ed5039e13279d2ricow@chromium.org// Redistribution and use in source and binary forms, with or without
34f693d6b99ffdbc05e5e211e08ed5039e13279d2ricow@chromium.org// modification, are permitted provided that the following conditions are
44f693d6b99ffdbc05e5e211e08ed5039e13279d2ricow@chromium.org// met:
54f693d6b99ffdbc05e5e211e08ed5039e13279d2ricow@chromium.org//
64f693d6b99ffdbc05e5e211e08ed5039e13279d2ricow@chromium.org//     * Redistributions of source code must retain the above copyright
74f693d6b99ffdbc05e5e211e08ed5039e13279d2ricow@chromium.org//       notice, this list of conditions and the following disclaimer.
84f693d6b99ffdbc05e5e211e08ed5039e13279d2ricow@chromium.org//     * Redistributions in binary form must reproduce the above
94f693d6b99ffdbc05e5e211e08ed5039e13279d2ricow@chromium.org//       copyright notice, this list of conditions and the following
104f693d6b99ffdbc05e5e211e08ed5039e13279d2ricow@chromium.org//       disclaimer in the documentation and/or other materials provided
114f693d6b99ffdbc05e5e211e08ed5039e13279d2ricow@chromium.org//       with the distribution.
124f693d6b99ffdbc05e5e211e08ed5039e13279d2ricow@chromium.org//     * Neither the name of Google Inc. nor the names of its
134f693d6b99ffdbc05e5e211e08ed5039e13279d2ricow@chromium.org//       contributors may be used to endorse or promote products derived
144f693d6b99ffdbc05e5e211e08ed5039e13279d2ricow@chromium.org//       from this software without specific prior written permission.
154f693d6b99ffdbc05e5e211e08ed5039e13279d2ricow@chromium.org//
164f693d6b99ffdbc05e5e211e08ed5039e13279d2ricow@chromium.org// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
174f693d6b99ffdbc05e5e211e08ed5039e13279d2ricow@chromium.org// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
184f693d6b99ffdbc05e5e211e08ed5039e13279d2ricow@chromium.org// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
194f693d6b99ffdbc05e5e211e08ed5039e13279d2ricow@chromium.org// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
204f693d6b99ffdbc05e5e211e08ed5039e13279d2ricow@chromium.org// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
214f693d6b99ffdbc05e5e211e08ed5039e13279d2ricow@chromium.org// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
224f693d6b99ffdbc05e5e211e08ed5039e13279d2ricow@chromium.org// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
234f693d6b99ffdbc05e5e211e08ed5039e13279d2ricow@chromium.org// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
244f693d6b99ffdbc05e5e211e08ed5039e13279d2ricow@chromium.org// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
254f693d6b99ffdbc05e5e211e08ed5039e13279d2ricow@chromium.org// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
264f693d6b99ffdbc05e5e211e08ed5039e13279d2ricow@chromium.org// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
274f693d6b99ffdbc05e5e211e08ed5039e13279d2ricow@chromium.org
284f693d6b99ffdbc05e5e211e08ed5039e13279d2ricow@chromium.org// With (or catch) scopes nested inside catch scopes should look at the
294f693d6b99ffdbc05e5e211e08ed5039e13279d2ricow@chromium.org// first outer non-catch scope to decide which closure to use when
304f693d6b99ffdbc05e5e211e08ed5039e13279d2ricow@chromium.org// allocating the new context.
314f693d6b99ffdbc05e5e211e08ed5039e13279d2ricow@chromium.org
324f693d6b99ffdbc05e5e211e08ed5039e13279d2ricow@chromium.org// Code below should not assert or crash.
334f693d6b99ffdbc05e5e211e08ed5039e13279d2ricow@chromium.orgtry {
344f693d6b99ffdbc05e5e211e08ed5039e13279d2ricow@chromium.org  fail;
354f693d6b99ffdbc05e5e211e08ed5039e13279d2ricow@chromium.org} catch (e) {
364f693d6b99ffdbc05e5e211e08ed5039e13279d2ricow@chromium.org  with({}) {  // With scope inside catch scope.
374f693d6b99ffdbc05e5e211e08ed5039e13279d2ricow@chromium.org    // Dynamic declaration forces runtime lookup to observe the context chain.
384f693d6b99ffdbc05e5e211e08ed5039e13279d2ricow@chromium.org    eval('const x = 7');
394f693d6b99ffdbc05e5e211e08ed5039e13279d2ricow@chromium.org  }
404f693d6b99ffdbc05e5e211e08ed5039e13279d2ricow@chromium.org}
41