Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(302)

Side by Side Diff: test/cctest/test-parsing.cc

Issue 2670633003: [parser] Skipping inner funcs: produce the same scopes / variables for sloppy block funcs. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« src/parsing/preparser.cc ('K') | « src/parsing/preparser.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 9315 matching lines...) Expand 10 before | Expand all | Expand 10 after
9326 {"", "var var1; function f1() { eval(''); }"}, 9326 {"", "var var1; function f1() { eval(''); }"},
9327 {"", "let var1; eval('');"}, 9327 {"", "let var1; eval('');"},
9328 {"", "let var1; function f1() { eval(''); }"}, 9328 {"", "let var1; function f1() { eval(''); }"},
9329 {"", "const var1 = 10; eval('');"}, 9329 {"", "const var1 = 10; eval('');"},
9330 {"", "const var1 = 10; function f1() { eval(''); }"}, 9330 {"", "const var1 = 10; function f1() { eval(''); }"},
9331 9331
9332 {"", "for (var var1 = 0; var1 < 10; ++var1) { }"}, 9332 {"", "for (var var1 = 0; var1 < 10; ++var1) { }"},
9333 {"", "for (let var1 = 0; var1 < 10; ++var1) { }"}, 9333 {"", "for (let var1 = 0; var1 < 10; ++var1) { }"},
9334 {"", "for (const var1 = 0; var1 < 10; ++var1) { }"}, 9334 {"", "for (const var1 = 0; var1 < 10; ++var1) { }"},
9335 9335
9336 // FIXME(marja): make the corresponding cases work when foo is a sloppy 9336 {"",
9337 // block function. 9337 "for (var var1 = 0; var1 < 10; ++var1) { function foo() { var1; } }"},
9338 {"",
9339 "for (let var1 = 0; var1 < 10; ++var1) { function foo() { var1; } }"},
9340 {"",
9341 "for (const var1 = 0; var1 < 10; ++var1) { function foo() { var1; } }"},
9338 {"", 9342 {"",
9339 "'use strict'; for (var var1 = 0; var1 < 10; ++var1) { function foo() { " 9343 "'use strict'; for (var var1 = 0; var1 < 10; ++var1) { function foo() { "
9340 "var1; } }"}, 9344 "var1; } }"},
9341 {"", 9345 {"",
9342 "'use strict'; for (let var1 = 0; var1 < 10; ++var1) { function foo() { " 9346 "'use strict'; for (let var1 = 0; var1 < 10; ++var1) { function foo() { "
9343 "var1; } }"}, 9347 "var1; } }"},
9344 {"", 9348 {"",
9345 "'use strict'; for (const var1 = 0; var1 < 10; ++var1) { function foo() " 9349 "'use strict'; for (const var1 = 0; var1 < 10; ++var1) { function foo() "
9346 "{ var1; } }"}, 9350 "{ var1; } }"},
9351
9352 {"", "if (true) { function f1() {} }"},
9353 {"", "if (true) { function f1() {} function f1() {} }"},
9354 {"", "if (true) { if (true) { function f1() {} } }"},
9355 {"", "if (true) { if (true) { function f1() {} function f1() {} } }"},
9356 {"", "if (true) { function f1() {} f1 = 3; }"},
9357
9358 {"", "if (true) { function f1() {} function foo() { f1; } }"},
9359 {"", "if (true) { function f1() {} } function foo() { f1; }"},
9360 {"",
9361 "if (true) { function f1() {} function f1() {} function foo() { f1; } "
9362 "}"},
9363 {"",
9364 "if (true) { function f1() {} function f1() {} } function foo() { f1; "
9365 "}"},
9366 {"",
9367 "if (true) { if (true) { function f1() {} } function foo() { f1; } }"},
9368 {"",
9369 "if (true) { if (true) { function f1() {} function f1() {} } function "
9370 "foo() { f1; } }"},
9371 {"", "if (true) { function f1() {} f1 = 3; function foo() { f1; } }"},
9372 {"", "if (true) { function f1() {} f1 = 3; } function foo() { f1; }"},
9373
9374 {"", "function inner2() { if (true) { function f1() {} } }"},
9375 {"", "function inner2() { if (true) { function f1() {} f1 = 3; } }"},
9376
9377 {"", "var f1 = 1; if (true) { function f1() {} }"},
9378 {"", "var f1 = 1; if (true) { function f1() {} } function foo() { f1; }"},
9347 }; 9379 };
9348 9380
9349 for (unsigned i = 0; i < arraysize(inners); ++i) { 9381 for (unsigned i = 0; i < arraysize(inners); ++i) {
9350 // First compile with the lazy inner function and extract the scope data. 9382 // First compile with the lazy inner function and extract the scope data.
9351 const char* inner_function = lazy_inner; 9383 const char* inner_function = lazy_inner;
9352 int inner_function_len = Utf8LengthHelper(inner_function) - 4; 9384 int inner_function_len = Utf8LengthHelper(inner_function) - 4;
9353 9385
9354 int params_len = Utf8LengthHelper(inners[i].params); 9386 int params_len = Utf8LengthHelper(inners[i].params);
9355 int source_len = Utf8LengthHelper(inners[i].source); 9387 int source_len = Utf8LengthHelper(inners[i].source);
9356 int len = 9388 int len =
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
9406 eager_info.literal()->scope()->inner_scope()->inner_scope(); 9438 eager_info.literal()->scope()->inner_scope()->inner_scope();
9407 DCHECK_NOT_NULL(scope); 9439 DCHECK_NOT_NULL(scope);
9408 DCHECK_NULL(scope->sibling()); 9440 DCHECK_NULL(scope->sibling());
9409 DCHECK(scope->is_function_scope()); 9441 DCHECK(scope->is_function_scope());
9410 9442
9411 size_t index = 0; 9443 size_t index = 0;
9412 i::ScopeTestHelper::CompareScopeToData( 9444 i::ScopeTestHelper::CompareScopeToData(
9413 scope, lazy_info.preparsed_scope_data(), index); 9445 scope, lazy_info.preparsed_scope_data(), index);
9414 } 9446 }
9415 } 9447 }
OLDNEW
« src/parsing/preparser.cc ('K') | « src/parsing/preparser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698