2015-07-16 16:44:58 +00:00
|
|
|
// Copyright 2015 the V8 project authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
//
|
2015-08-05 21:32:25 +00:00
|
|
|
// Flags: --harmony-destructuring
|
2015-09-30 19:49:46 +00:00
|
|
|
// Flags: --strong-mode --allow-natives-syntax
|
2015-07-16 16:44:58 +00:00
|
|
|
|
|
|
|
(function() {
|
2015-08-26 14:59:05 +00:00
|
|
|
var f = (function() {
|
|
|
|
"use strong";
|
|
|
|
return function f({ x = function() { return []; } }) { return x(); };
|
|
|
|
})();
|
2015-07-16 16:44:58 +00:00
|
|
|
var a = f({ x: undefined });
|
|
|
|
assertTrue(%IsStrong(a));
|
|
|
|
|
|
|
|
// TODO(rossberg): Loading non-existent properties during destructuring should
|
|
|
|
// not throw in strong mode.
|
|
|
|
assertThrows(function() { f({}); }, TypeError);
|
|
|
|
|
|
|
|
function weakf({ x = function() { return []; } }) { return x(); }
|
|
|
|
a = weakf({});
|
|
|
|
assertFalse(%IsStrong(a));
|
|
|
|
|
|
|
|
function outerf() { return []; }
|
2015-08-26 14:59:05 +00:00
|
|
|
var f2 = (function() {
|
|
|
|
"use strong";
|
|
|
|
return function f2({ x = outerf }) { return x(); };
|
|
|
|
})();
|
2015-07-16 16:44:58 +00:00
|
|
|
a = f2({ x: undefined });
|
|
|
|
assertFalse(%IsStrong(a));
|
|
|
|
})();
|