| 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-1-2 |
| 6 |
description: > |
| 7 |
Allow reserved words as property names at object initialization. |
| 8 |
---*/ |
| 9 |
|
| 10 |
var tokenCodes = { |
| 11 |
await: 'await', |
| 12 |
break: 'break', |
| 13 |
case: 'case', |
| 14 |
catch: 'catch', |
| 15 |
class: 'class', |
| 16 |
const: 'const', |
| 17 |
continue: 'continue', |
| 18 |
debugger: 'debugger', |
| 19 |
default: 'default', |
| 20 |
delete: 'delete', |
| 21 |
do: 'do', |
| 22 |
else: 'else', |
| 23 |
export: 'export', |
| 24 |
extends: 'extends', |
| 25 |
finally: 'finally', |
| 26 |
for: 'for', |
| 27 |
function: 'function', |
| 28 |
if: 'if', |
| 29 |
import: 'import', |
| 30 |
in: 'in', |
| 31 |
instanceof: 'instanceof', |
| 32 |
new: 'new', |
| 33 |
return: 'return', |
| 34 |
super: 'super', |
| 35 |
switch: 'switch', |
| 36 |
this: 'this', |
| 37 |
throw: 'throw', |
| 38 |
try: 'try', |
| 39 |
typeof: 'typeof', |
| 40 |
var: 'var', |
| 41 |
void: 'void', |
| 42 |
while: 'while', |
| 43 |
with: 'with', |
| 44 |
yield: 'yield', |
| 45 |
|
| 46 |
enum: 'enum', |
| 47 |
|
| 48 |
implements: 'implements', |
| 49 |
interface: 'interface', |
| 50 |
package: 'package', |
| 51 |
protected: 'protected', |
| 52 |
private: 'private', |
| 53 |
public: 'public', |
| 54 |
|
| 55 |
let: 'let', |
| 56 |
static: 'static', |
| 57 |
}; |
| 58 |
|
| 59 |
var arr = [ |
| 60 |
'await', |
| 61 |
'break', |
| 62 |
'case', |
| 63 |
'catch', |
| 64 |
'class', |
| 65 |
'const', |
| 66 |
'continue', |
| 67 |
'debugger', |
| 68 |
'default', |
| 69 |
'delete', |
| 70 |
'do', |
| 71 |
'else', |
| 72 |
'export', |
| 73 |
'extends', |
| 74 |
'finally', |
| 75 |
'for', |
| 76 |
'function', |
| 77 |
'if', |
| 78 |
'import', |
| 79 |
'in', |
| 80 |
'instanceof', |
| 81 |
'new', |
| 82 |
'return', |
| 83 |
'super', |
| 84 |
'switch', |
| 85 |
'this', |
| 86 |
'throw', |
| 87 |
'try', |
| 88 |
'typeof', |
| 89 |
'var', |
| 90 |
'void', |
| 91 |
'while', |
| 92 |
'with', |
| 93 |
'yield', |
| 94 |
|
| 95 |
'enum', |
| 96 |
|
| 97 |
'implements', |
| 98 |
'interface', |
| 99 |
'package', |
| 100 |
'protected', |
| 101 |
'private', |
| 102 |
'public', |
| 103 |
|
| 104 |
'let', |
| 105 |
'static', |
| 106 |
]; |
| 107 |
|
| 108 |
for (var i = 0; i < arr.length; ++i) { |
| 109 |
var propertyName = arr[i]; |
| 110 |
|
| 111 |
assert(tokenCodes.hasOwnProperty(propertyName), |
| 112 |
'Property "' + propertyName + '" found'); |
| 113 |
|
| 114 |
assert.sameValue(tokenCodes[propertyName], propertyName, |
| 115 |
'Property "' + propertyName + '" has correct value'); |
| 116 |
} |
| 117 |
|
| 118 |
reportCompare(0, 0); |