| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 assertFalse(a[0][0] === b[0][0]); | 98 assertFalse(a[0][0] === b[0][0]); |
| 99 assertFalse(a[0][1] === b[0][1]); | 99 assertFalse(a[0][1] === b[0][1]); |
| 100 | 100 |
| 101 function makeRegexpInObject() { return { a: { b: /b*/, c: {} } }; } | 101 function makeRegexpInObject() { return { a: { b: /b*/, c: {} } }; } |
| 102 a = makeRegexpInObject(); | 102 a = makeRegexpInObject(); |
| 103 b = makeRegexpInObject(); | 103 b = makeRegexpInObject(); |
| 104 assertFalse(a.a.b === b.a.b); | 104 assertFalse(a.a.b === b.a.b); |
| 105 assertFalse(a.a.c === b.a.c); | 105 assertFalse(a.a.c === b.a.c); |
| 106 | 106 |
| 107 | 107 |
| 108 // Test keywords valid as property names in initializers and dot-access. | 108 // Test keywords are valid as property names in initializers and dot-access. |
| 109 var keywords = [ | 109 var keywords = [ |
| 110 "break", | 110 "break", |
| 111 "case", | 111 "case", |
| 112 "catch", | 112 "catch", |
| 113 "const", | 113 "const", |
| 114 "continue", | 114 "continue", |
| 115 "debugger", | 115 "debugger", |
| 116 "default", | 116 "default", |
| 117 "delete", | 117 "delete", |
| 118 "do", | 118 "do", |
| 119 "else", | 119 "else", |
| 120 "false", | 120 "false", |
| 121 "finally", | 121 "finally", |
| 122 "for", | 122 "for", |
| 123 "function", | 123 "function", |
| 124 "if", | 124 "if", |
| 125 "in", | 125 "in", |
| 126 "instanceof", | 126 "instanceof", |
| 127 "native", | |
| 128 "new", | 127 "new", |
| 129 "null", | 128 "null", |
| 130 "return", | 129 "return", |
| 131 "switch", | 130 "switch", |
| 132 "this", | 131 "this", |
| 133 "throw", | 132 "throw", |
| 134 "true", | 133 "true", |
| 135 "try", | 134 "try", |
| 136 "typeof", | 135 "typeof", |
| 137 "var", | 136 "var", |
| 138 "void", | 137 "void", |
| 139 "while", | 138 "while", |
| 140 "with", | 139 "with" |
| 141 ]; | 140 ]; |
| 142 | 141 |
| 143 function testKeywordProperty(keyword) { | 142 function testKeywordProperty(keyword) { |
| 144 var exception = false; | 143 var exception = false; |
| 145 try { | 144 try { |
| 146 // Sanity check that what we get is a keyword. | 145 // Sanity check that what we get is a keyword. |
| 147 eval("var " + keyword + " = 42;"); | 146 eval("var " + keyword + " = 42;"); |
| 148 } catch (e) { | 147 } catch (e) { |
| 149 exception = true; | 148 exception = true; |
| 150 } | 149 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 function construct() { this.constructed = true; } | 183 function construct() { this.constructed = true; } |
| 185 var v = eval("({" + keyword + ": construct})"); | 184 var v = eval("({" + keyword + ": construct})"); |
| 186 var vo = eval("new v." + keyword + "()"); | 185 var vo = eval("new v." + keyword + "()"); |
| 187 assertTrue(vo instanceof construct); | 186 assertTrue(vo instanceof construct); |
| 188 assertTrue(vo.constructed); | 187 assertTrue(vo.constructed); |
| 189 } | 188 } |
| 190 | 189 |
| 191 for (var i = 0; i < keywords.length; i++) { | 190 for (var i = 0; i < keywords.length; i++) { |
| 192 testKeywordProperty(keywords[i]); | 191 testKeywordProperty(keywords[i]); |
| 193 } | 192 } |
| OLD | NEW |