ident-name-keyword-memberexpr.js (2457B)
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-2-2 6 description: > 7 Allow reserved words as property names by dot operator 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 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);