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 3507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Loading... |
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 } |
OLD | NEW |