| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 2200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2211 "new foo.bar();", | 2211 "new foo.bar();", |
| 2212 "new foo.bar.baz;", | 2212 "new foo.bar.baz;", |
| 2213 "new foo.bar().baz;", | 2213 "new foo.bar().baz;", |
| 2214 "new foo[bar];", | 2214 "new foo[bar];", |
| 2215 "new foo[bar]();", | 2215 "new foo[bar]();", |
| 2216 "new foo[bar][baz];", | 2216 "new foo[bar][baz];", |
| 2217 "new foo[bar]()[baz];", | 2217 "new foo[bar]()[baz];", |
| 2218 "new foo[bar].baz(baz)()[bar].baz;", | 2218 "new foo[bar].baz(baz)()[bar].baz;", |
| 2219 "new \"foo\"", // Runtime error | 2219 "new \"foo\"", // Runtime error |
| 2220 "new 1", // Runtime error | 2220 "new 1", // Runtime error |
| 2221 "new foo++", | |
| 2222 // This even runs: | 2221 // This even runs: |
| 2223 "(new new Function(\"this.x = 1\")).x;", | 2222 "(new new Function(\"this.x = 1\")).x;", |
| 2224 "new new Test_Two(String, 2).v(0123).length;", | 2223 "new new Test_Two(String, 2).v(0123).length;", |
| 2225 NULL | 2224 NULL |
| 2226 }; | 2225 }; |
| 2227 | 2226 |
| 2228 RunParserSyncTest(context_data, statement_data, kSuccess); | 2227 RunParserSyncTest(context_data, statement_data, kSuccess); |
| 2229 } | 2228 } |
| 2230 | 2229 |
| 2231 | 2230 |
| 2232 TEST(ErrorsNewExpression) { | 2231 TEST(ErrorsNewExpression) { |
| 2233 const char* context_data[][2] = { | 2232 const char* context_data[][2] = { |
| 2234 {"", ""}, | 2233 {"", ""}, |
| 2235 {"var f =", ""}, | 2234 {"var f =", ""}, |
| 2236 { NULL, NULL } | 2235 { NULL, NULL } |
| 2237 }; | 2236 }; |
| 2238 | 2237 |
| 2239 const char* statement_data[] = { | 2238 const char* statement_data[] = { |
| 2240 "new foo bar", | 2239 "new foo bar", |
| 2241 "new ) foo", | 2240 "new ) foo", |
| 2242 "new ++foo", | 2241 "new ++foo", |
| 2242 // TODO(marja): Activate this test once the preparser checks correctly. |
| 2243 // "new foo ++", |
| 2243 NULL | 2244 NULL |
| 2244 }; | 2245 }; |
| 2245 | 2246 |
| 2246 RunParserSyncTest(context_data, statement_data, kError); | 2247 RunParserSyncTest(context_data, statement_data, kError); |
| 2247 } | 2248 } |
| 2248 | 2249 |
| 2249 | 2250 |
| 2250 TEST(StrictObjectLiteralChecking) { | 2251 TEST(StrictObjectLiteralChecking) { |
| 2251 const char* strict_context_data[][2] = { | 2252 const char* strict_context_data[][2] = { |
| 2252 {"\"use strict\"; var myobject = {", "};"}, | 2253 {"\"use strict\"; var myobject = {", "};"}, |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2371 | 2372 |
| 2372 const char* statement_data[] = { | 2373 const char* statement_data[] = { |
| 2373 statement, | 2374 statement, |
| 2374 NULL | 2375 NULL |
| 2375 }; | 2376 }; |
| 2376 | 2377 |
| 2377 // The test is quite slow, so run it with a reduced set of flags. | 2378 // The test is quite slow, so run it with a reduced set of flags. |
| 2378 static const ParserFlag empty_flags[] = {kAllowLazy}; | 2379 static const ParserFlag empty_flags[] = {kAllowLazy}; |
| 2379 RunParserSyncTest(context_data, statement_data, kError, empty_flags, 1); | 2380 RunParserSyncTest(context_data, statement_data, kError, empty_flags, 1); |
| 2380 } | 2381 } |
| OLD | NEW |