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