1486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org// Copyright 2011 the V8 project authors. All rights reserved.
2486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org// Redistribution and use in source and binary forms, with or without
3486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org// modification, are permitted provided that the following conditions are
4486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org// met:
5486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org//
6486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org//     * Redistributions of source code must retain the above copyright
7486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org//       notice, this list of conditions and the following disclaimer.
8486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org//     * Redistributions in binary form must reproduce the above
9486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org//       copyright notice, this list of conditions and the following
10486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org//       disclaimer in the documentation and/or other materials provided
11486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org//       with the distribution.
12486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org//     * Neither the name of Google Inc. nor the names of its
13486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org//       contributors may be used to endorse or promote products derived
14486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org//       from this software without specific prior written permission.
15486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org//
16486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org
28486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.orgfunction Test() {
29486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org  var left  = 'XXX';
30486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org  var right = 'YYY';
31486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org  for (var i = 0; i < 3; i++) {
32486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org    var cons = left + right;
33486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org    var substring = cons.substring(2, 4);
34486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org    try {
35486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org      with ({Test: i})
36486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org          continue;
37486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org    } finally { }
38486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org  }
39486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org  return substring;
40486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org}
41486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.org
42486075aa3f2e6d0031ff182961b9eab00e1081d8jkummerow@chromium.orgassertEquals('XY', Test());
43