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

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: code review (vogelheim@) 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/ast/scopes.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 9314 matching lines...) Expand 10 before | Expand all | Expand 10 after
9325 {"", "var var1; function f1() { eval(''); }"}, 9325 {"", "var var1; function f1() { eval(''); }"},
9326 {"", "let var1; eval('');"}, 9326 {"", "let var1; eval('');"},
9327 {"", "let var1; function f1() { eval(''); }"}, 9327 {"", "let var1; function f1() { eval(''); }"},
9328 {"", "const var1 = 10; eval('');"}, 9328 {"", "const var1 = 10; eval('');"},
9329 {"", "const var1 = 10; function f1() { eval(''); }"}, 9329 {"", "const var1 = 10; function f1() { eval(''); }"},
9330 9330
9331 {"", "for (var var1 = 0; var1 < 10; ++var1) { }"}, 9331 {"", "for (var var1 = 0; var1 < 10; ++var1) { }"},
9332 {"", "for (let var1 = 0; var1 < 10; ++var1) { }"}, 9332 {"", "for (let var1 = 0; var1 < 10; ++var1) { }"},
9333 {"", "for (const var1 = 0; var1 < 10; ++var1) { }"}, 9333 {"", "for (const var1 = 0; var1 < 10; ++var1) { }"},
9334 9334
9335 // FIXME(marja): make the corresponding cases work when foo is a sloppy 9335 {"",
9336 // block function. 9336 "for (var var1 = 0; var1 < 10; ++var1) { function foo() { var1; } }"},
9337 {"",
9338 "for (let var1 = 0; var1 < 10; ++var1) { function foo() { var1; } }"},
9339 {"",
9340 "for (const var1 = 0; var1 < 10; ++var1) { function foo() { var1; } }"},
9337 {"", 9341 {"",
9338 "'use strict'; for (var var1 = 0; var1 < 10; ++var1) { function foo() { " 9342 "'use strict'; for (var var1 = 0; var1 < 10; ++var1) { function foo() { "
9339 "var1; } }"}, 9343 "var1; } }"},
9340 {"", 9344 {"",
9341 "'use strict'; for (let var1 = 0; var1 < 10; ++var1) { function foo() { " 9345 "'use strict'; for (let var1 = 0; var1 < 10; ++var1) { function foo() { "
9342 "var1; } }"}, 9346 "var1; } }"},
9343 {"", 9347 {"",
9344 "'use strict'; for (const var1 = 0; var1 < 10; ++var1) { function foo() " 9348 "'use strict'; for (const var1 = 0; var1 < 10; ++var1) { function foo() "
9345 "{ var1; } }"}, 9349 "{ var1; } }"},
9350
9351 {"", "if (true) { function f1() {} }"},
9352 {"", "if (true) { function f1() {} function f1() {} }"},
9353 {"", "if (true) { if (true) { function f1() {} } }"},
9354 {"", "if (true) { if (true) { function f1() {} function f1() {} } }"},
9355 {"", "if (true) { function f1() {} f1 = 3; }"},
9356
9357 {"", "if (true) { function f1() {} function foo() { f1; } }"},
9358 {"", "if (true) { function f1() {} } function foo() { f1; }"},
9359 {"",
9360 "if (true) { function f1() {} function f1() {} function foo() { f1; } "
9361 "}"},
9362 {"",
9363 "if (true) { function f1() {} function f1() {} } function foo() { f1; "
9364 "}"},
9365 {"",
9366 "if (true) { if (true) { function f1() {} } function foo() { f1; } }"},
9367 {"",
9368 "if (true) { if (true) { function f1() {} function f1() {} } function "
9369 "foo() { f1; } }"},
9370 {"", "if (true) { function f1() {} f1 = 3; function foo() { f1; } }"},
9371 {"", "if (true) { function f1() {} f1 = 3; } function foo() { f1; }"},
9372
9373 {"", "function inner2() { if (true) { function f1() {} } }"},
9374 {"", "function inner2() { if (true) { function f1() {} f1 = 3; } }"},
9375
9376 {"", "var f1 = 1; if (true) { function f1() {} }"},
9377 {"", "var f1 = 1; if (true) { function f1() {} } function foo() { f1; }"},
9346 }; 9378 };
9347 9379
9348 for (unsigned i = 0; i < arraysize(inners); ++i) { 9380 for (unsigned i = 0; i < arraysize(inners); ++i) {
9349 // First compile with the lazy inner function and extract the scope data. 9381 // First compile with the lazy inner function and extract the scope data.
9350 const char* inner_function = lazy_inner; 9382 const char* inner_function = lazy_inner;
9351 int inner_function_len = Utf8LengthHelper(inner_function) - 4; 9383 int inner_function_len = Utf8LengthHelper(inner_function) - 4;
9352 9384
9353 int params_len = Utf8LengthHelper(inners[i].params); 9385 int params_len = Utf8LengthHelper(inners[i].params);
9354 int source_len = Utf8LengthHelper(inners[i].source); 9386 int source_len = Utf8LengthHelper(inners[i].source);
9355 int len = 9387 int len =
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
9405 eager_info.literal()->scope()->inner_scope()->inner_scope(); 9437 eager_info.literal()->scope()->inner_scope()->inner_scope();
9406 DCHECK_NOT_NULL(scope); 9438 DCHECK_NOT_NULL(scope);
9407 DCHECK_NULL(scope->sibling()); 9439 DCHECK_NULL(scope->sibling());
9408 DCHECK(scope->is_function_scope()); 9440 DCHECK(scope->is_function_scope());
9409 9441
9410 size_t index = 0; 9442 size_t index = 0;
9411 i::ScopeTestHelper::CompareScopeToData( 9443 i::ScopeTestHelper::CompareScopeToData(
9412 scope, lazy_info.preparsed_scope_data(), index); 9444 scope, lazy_info.preparsed_scope_data(), index);
9413 } 9445 }
9414 } 9446 }
OLDNEW
« src/ast/scopes.cc ('K') | « src/parsing/preparser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698