Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // Flags: --strong-mode --allow-natives-syntax | |
| 6 // Flags: --harmony-arrow-functions --harmony-rest-parameters | |
| 7 | |
| 8 | |
| 9 (function WeakObjectLiterals() { | |
| 10 assertTrue(!%IsStrong({})); | |
| 11 assertTrue(!%IsStrong({a: 0, b: 0})); | |
| 12 assertTrue(!%IsStrong({f: function(){}})); | |
| 13 assertTrue(!%IsStrong(Realm.eval(Realm.current(), | |
| 14 "({f: function(){}})"))); | |
| 15 })(); | |
| 16 | |
| 17 (function StrongObjectLiterals() { | |
| 18 'use strong'; | |
| 19 assertTrue(%IsStrong({})); | |
| 20 assertTrue(%IsStrong({a: 0, b: 0})); | |
|
arv (Not doing code reviews)
2015/05/13 16:39:37
Please add tests with accessors, methods, __proto_
Dmitry Lomov (no reviews)
2015/05/18 09:15:56
Also regexps, if I understand the patch correctly.
rossberg
2015/05/18 09:32:37
Done. Turns out that super does not work currently
rossberg
2015/05/18 09:32:37
Those don't work yet, see the existing tests below
Dmitry Lomov (no reviews)
2015/05/18 10:56:30
I see, missed that.
| |
| 21 // Object literals with constant functions are treated specially, | |
| 22 // but currently only on the toplevel. | |
| 23 assertTrue(%IsStrong({f: function(){}})); | |
| 24 // TODO(rossberg): implement strong object literals with functions | |
| 25 // assertTrue(%IsStrong(Realm.eval(Realm.current(), | |
| 26 // "'use strong'; ({f: function(){}})"))); | |
| 27 })(); | |
| 28 | |
| 29 (function WeakArrayLiterals(...args) { | |
| 30 assertTrue(!%IsStrong(args)); | |
| 31 assertTrue(!%IsStrong([])); | |
| 32 assertTrue(!%IsStrong([1, 2, 3])); | |
| 33 })(); | |
| 34 | |
| 35 (function StrongArrayLiterals(...args) { | |
| 36 'use strong'; | |
| 37 // TODO(rossberg): implement strong array literals | |
| 38 // assertTrue(%IsStrong(args)); | |
| 39 // assertTrue(%IsStrong([])); | |
| 40 // assertTrue(%IsStrong([1, 2, 3])); | |
| 41 })(0); // TODO(arv): drop dummy | |
| 42 | |
| 43 (function WeakFunctionLiterals() { | |
| 44 function f() {} | |
| 45 assertTrue(!%IsStrong(f)); | |
| 46 assertTrue(!%IsStrong(function(){})); | |
| 47 assertTrue(!%IsStrong(() => {})); | |
| 48 assertTrue(!%IsStrong(x => x)); | |
| 49 })(); | |
| 50 | |
| 51 (function StrongFunctionLiterals(g) { | |
| 52 'use strong'; | |
| 53 function f() {} | |
| 54 assertTrue(%IsStrong(f)); | |
| 55 assertTrue(%IsStrong(g)); | |
| 56 assertTrue(%IsStrong(function(){})); | |
| 57 assertTrue(%IsStrong(() => {})); | |
| 58 assertTrue(%IsStrong(x => x)); | |
| 59 })(function() { 'use strong' }); | |
| 60 | |
| 61 (function WeakRegExpLiterals() { | |
| 62 assertTrue(!%IsStrong(/abc/)); | |
| 63 })(); | |
| 64 | |
| 65 (function StrongRegExpLiterals() { | |
| 66 'use strong'; | |
| 67 // TODO(rossberg): implement strong regexp literals | |
| 68 // assertTrue(%IsStrong(/abc/)); | |
| 69 })(); | |
| OLD | NEW |