keith_miller@apple.com | bcc77f2 | 2016-07-15 06:03:25 +0000 | [diff] [blame] | 1 | // Copyright (c) 2012 Ecma International. All rights reserved. |
| 2 | // This code is governed by the BSD license found in the LICENSE file. |
| 3 | |
| 4 | /*--- |
| 5 | es5id: 7.6.1-4-10 |
| 6 | description: > |
| 7 | Allow reserved words as property names by set function within an |
| 8 | object, verified with hasOwnProperty: in, try, class |
| 9 | ---*/ |
| 10 | |
| 11 | var test0 = 0, test1 = 1, test2 = 2;
|
| 12 | var tokenCodes = {
|
| 13 | set in(value){
|
| 14 | test0 = value;
|
| 15 | },
|
| 16 | get in(){
|
| 17 | return test0;
|
| 18 | },
|
| 19 | set try(value){
|
| 20 | test1 = value;
|
| 21 | },
|
| 22 | get try(){
|
| 23 | return test1
|
| 24 | },
|
| 25 | set class(value){
|
| 26 | test2 = value;
|
| 27 | },
|
| 28 | get class(){
|
| 29 | return test2;
|
| 30 | }
|
| 31 | };
|
| 32 | var arr = [
|
| 33 | 'in',
|
| 34 | 'try',
|
| 35 | 'class'
|
| 36 | ];
|
| 37 | for(var p in tokenCodes) {
|
| 38 | for(var p1 in arr) {
|
| 39 | if(arr[p1] === p) {
|
| 40 | assert(tokenCodes.hasOwnProperty(arr[p1]), 'tokenCodes.hasOwnProperty(arr[p1]) !== true');
|
| 41 | }
|
| 42 | }
|
| 43 | }
|