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

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

Issue 2656753003: [ast/parsing] Pessimistically assume all top-level variables will be assigned. (Closed)
Patch Set: Rebase. 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
« no previous file with comments | « src/parsing/pattern-rewriter.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 3507 matching lines...) Expand 10 before | Expand all | Expand 10 after
3518 3518
3519 TEST(MaybeAssignedTopLevel) { 3519 TEST(MaybeAssignedTopLevel) {
3520 i::Isolate* isolate = CcTest::i_isolate(); 3520 i::Isolate* isolate = CcTest::i_isolate();
3521 i::HandleScope scope(isolate); 3521 i::HandleScope scope(isolate);
3522 LocalContext env; 3522 LocalContext env;
3523 i::Factory* factory = isolate->factory(); 3523 i::Factory* factory = isolate->factory();
3524 3524
3525 const char* prefixes[] = { 3525 const char* prefixes[] = {
3526 "let foo; ", "let foo = 0; ", 3526 "let foo; ", "let foo = 0; ",
3527 "let [foo] = [1]; ", "let {foo} = {foo: 2}; ", 3527 "let [foo] = [1]; ", "let {foo} = {foo: 2}; ",
3528 "let {foo=3} = {}; ", 3528 "let {foo=3} = {}; ", "function foo() {}; ",
3529 "var foo; ", "var foo = 0; ",
3530 "var [foo] = [1]; ", "var {foo} = {foo: 2}; ",
3531 "var {foo=3} = {}; ", "function* foo() {}; ",
3529 }; 3532 };
3530 const char* sources[] = { 3533 const char* sources[] = {
3531 "function bar() {foo = 42}; ext(bar); ext(foo)", 3534 "function bar() {foo = 42}; ext(bar); ext(foo)",
3532 "ext(function() {foo++}); ext(foo)", 3535 "ext(function() {foo++}); ext(foo)",
3533 "bar = () => --foo; ext(bar); ext(foo)", 3536 "bar = () => --foo; ext(bar); ext(foo)",
3534 "function* bar() {eval(ext)}; ext(bar); ext(foo)", 3537 "function* bar() {eval(ext)}; ext(bar); ext(foo)",
3535 }; 3538 };
3536 3539
3537 for (unsigned i = 0; i < arraysize(prefixes); ++i) { 3540 for (unsigned i = 0; i < arraysize(prefixes); ++i) {
3538 const char* prefix = prefixes[i]; 3541 const char* prefix = prefixes[i];
(...skipping 5623 matching lines...) Expand 10 before | Expand all | Expand 10 after
9162 eager_info.literal()->scope()->inner_scope()->inner_scope(); 9165 eager_info.literal()->scope()->inner_scope()->inner_scope();
9163 DCHECK_NOT_NULL(scope); 9166 DCHECK_NOT_NULL(scope);
9164 DCHECK_NULL(scope->sibling()); 9167 DCHECK_NULL(scope->sibling());
9165 DCHECK(scope->is_function_scope()); 9168 DCHECK(scope->is_function_scope());
9166 9169
9167 size_t index = 0; 9170 size_t index = 0;
9168 i::ScopeTestHelper::CompareScopeToData( 9171 i::ScopeTestHelper::CompareScopeToData(
9169 scope, lazy_info.preparsed_scope_data(), index); 9172 scope, lazy_info.preparsed_scope_data(), index);
9170 } 9173 }
9171 } 9174 }
OLDNEW
« no previous file with comments | « src/parsing/pattern-rewriter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698