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

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

Issue 2685293003: [parsing] Fix maybe-assigned for top-level class declarations. (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
« 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 3835 matching lines...) Expand 10 before | Expand all | Expand 10 after
3846 } 3846 }
3847 } 3847 }
3848 3848
3849 TEST(MaybeAssignedTopLevel) { 3849 TEST(MaybeAssignedTopLevel) {
3850 i::Isolate* isolate = CcTest::i_isolate(); 3850 i::Isolate* isolate = CcTest::i_isolate();
3851 i::HandleScope scope(isolate); 3851 i::HandleScope scope(isolate);
3852 LocalContext env; 3852 LocalContext env;
3853 i::Factory* factory = isolate->factory(); 3853 i::Factory* factory = isolate->factory();
3854 3854
3855 const char* prefixes[] = { 3855 const char* prefixes[] = {
3856 "let foo; ", "let foo = 0; ", 3856 "let foo; ",
3857 "let [foo] = [1]; ", "let {foo} = {foo: 2}; ", 3857 "let foo = 0; ",
3858 "let {foo=3} = {}; ", "function foo() {}; ", 3858 "let [foo] = [1]; ",
3859 "var foo; ", "var foo = 0; ", 3859 "let {foo} = {foo: 2}; ",
3860 "var [foo] = [1]; ", "var {foo} = {foo: 2}; ", 3860 "let {foo=3} = {}; ",
3861 "var {foo=3} = {}; ", "function* foo() {}; ", 3861 "var foo; ",
3862 "var foo = 0; ",
3863 "var [foo] = [1]; ",
3864 "var {foo} = {foo: 2}; ",
3865 "var {foo=3} = {}; ",
3866 "function foo() {}; ",
3867 "function* foo() {}; ",
3868 "async function foo() {}; ",
3869 "class foo {}; ",
3870 "class foo extends null {}; ",
3862 }; 3871 };
3863 const char* sources[] = { 3872 const char* sources[] = {
3864 "function bar() {foo = 42}; ext(bar); ext(foo)", 3873 "function bar() {foo = 42}; ext(bar); ext(foo)",
3865 "ext(function() {foo++}); ext(foo)", 3874 "ext(function() {foo++}); ext(foo)",
3866 "bar = () => --foo; ext(bar); ext(foo)", 3875 "bar = () => --foo; ext(bar); ext(foo)",
3867 "function* bar() {eval(ext)}; ext(bar); ext(foo)", 3876 "function* bar() {eval(ext)}; ext(bar); ext(foo)",
3868 }; 3877 };
3869 3878
3870 for (unsigned i = 0; i < arraysize(prefixes); ++i) { 3879 for (unsigned i = 0; i < arraysize(prefixes); ++i) {
3871 const char* prefix = prefixes[i]; 3880 const char* prefix = prefixes[i];
(...skipping 5561 matching lines...) Expand 10 before | Expand all | Expand 10 after
9433 DCHECK_NULL(scope->sibling()); 9442 DCHECK_NULL(scope->sibling());
9434 DCHECK(scope->is_function_scope()); 9443 DCHECK(scope->is_function_scope());
9435 const i::AstRawString* var_name = 9444 const i::AstRawString* var_name =
9436 info.ast_value_factory()->GetOneByteString("my_var"); 9445 info.ast_value_factory()->GetOneByteString("my_var");
9437 i::Variable* var = scope->Lookup(var_name); 9446 i::Variable* var = scope->Lookup(var_name);
9438 CHECK_EQ(inners[i].ctxt_allocate, 9447 CHECK_EQ(inners[i].ctxt_allocate,
9439 i::ScopeTestHelper::MustAllocateInContext(var)); 9448 i::ScopeTestHelper::MustAllocateInContext(var));
9440 } 9449 }
9441 } 9450 }
9442 } 9451 }
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