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 8684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8695 "(%s) => { %s }"}; | 8695 "(%s) => { %s }"}; |
8696 | 8696 |
8697 struct { | 8697 struct { |
8698 const char* params; | 8698 const char* params; |
8699 const char* source; | 8699 const char* source; |
8700 bool ctxt_allocate; | 8700 bool ctxt_allocate; |
8701 } inners[] = { | 8701 } inners[] = { |
8702 // Context allocating because we need to: | 8702 // Context allocating because we need to: |
8703 {"", "my_var;", true}, | 8703 {"", "my_var;", true}, |
8704 {"", "if (true) { let my_var; } my_var;", true}, | 8704 {"", "if (true) { let my_var; } my_var;", true}, |
8705 {"", "eval(\"foo\");", true}, | 8705 {"", "eval('foo');", true}, |
8706 {"", "function inner2() { my_var; }", true}, | 8706 {"", "function inner2() { my_var; }", true}, |
8707 {"", "function inner2() { eval(\"foo\"); }", true}, | 8707 {"", "function inner2() { eval('foo'); }", true}, |
8708 {"", "var {my_var : a} = {my_var};", true}, | 8708 {"", "var {my_var : a} = {my_var};", true}, |
8709 {"", "let {my_var : a} = {my_var};", true}, | 8709 {"", "let {my_var : a} = {my_var};", true}, |
8710 {"", "const {my_var : a} = {my_var};", true}, | 8710 {"", "const {my_var : a} = {my_var};", true}, |
8711 {"a = my_var", "", true}, | 8711 {"a = my_var", "", true}, |
8712 {"", "function inner2(a = my_var) { }", true}, | 8712 {"", "function inner2(a = my_var) { }", true}, |
8713 {"", "(a = my_var) => { }", true}, | 8713 {"", "(a = my_var) => { }", true}, |
8714 {"{a} = {a: my_var}", "", true}, | 8714 {"{a} = {a: my_var}", "", true}, |
8715 {"", "function inner2({a} = {a: my_var}) { }", true}, | 8715 {"", "function inner2({a} = {a: my_var}) { }", true}, |
8716 {"", "({a} = {a: my_var}) => { }", true}, | 8716 {"", "({a} = {a: my_var}) => { }", true}, |
8717 {"[a] = [my_var]", "", true}, | 8717 {"[a] = [my_var]", "", true}, |
8718 {"", "function inner2([a] = [my_var]) { }", true}, | 8718 {"", "function inner2([a] = [my_var]) { }", true}, |
8719 {"", "([a] = [my_var]) => { }", true}, | 8719 {"", "([a] = [my_var]) => { }", true}, |
| 8720 {"", "function inner2(a = eval('')) { }", true}, |
| 8721 {"", "(a = eval('')) => { }", true}, |
8720 {"", "try { } catch (my_var) { } my_var;", true}, | 8722 {"", "try { } catch (my_var) { } my_var;", true}, |
8721 {"", "for (my_var in {}) { my_var; }", true}, | 8723 {"", "for (my_var in {}) { my_var; }", true}, |
8722 {"", "for (my_var in {}) { }", true}, | 8724 {"", "for (my_var in {}) { }", true}, |
8723 {"", "for (my_var of []) { my_var; }", true}, | 8725 {"", "for (my_var of []) { my_var; }", true}, |
8724 {"", "for (my_var of []) { }", true}, | 8726 {"", "for (my_var of []) { }", true}, |
8725 {"", "for ([a, my_var, b] in {}) { my_var; }", true}, | 8727 {"", "for ([a, my_var, b] in {}) { my_var; }", true}, |
8726 {"", "for ([a, my_var, b] of []) { my_var; }", true}, | 8728 {"", "for ([a, my_var, b] of []) { my_var; }", true}, |
8727 {"", "for ({x: my_var} in {}) { my_var; }", true}, | 8729 {"", "for ({x: my_var} in {}) { my_var; }", true}, |
8728 {"", "for ({x: my_var} of []) { my_var; }", true}, | 8730 {"", "for ({x: my_var} of []) { my_var; }", true}, |
8729 {"", "for ({my_var} in {}) { my_var; }", true}, | 8731 {"", "for ({my_var} in {}) { my_var; }", true}, |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8941 DCHECK_NULL(scope->sibling()); | 8943 DCHECK_NULL(scope->sibling()); |
8942 DCHECK(scope->is_function_scope()); | 8944 DCHECK(scope->is_function_scope()); |
8943 const i::AstRawString* var_name = | 8945 const i::AstRawString* var_name = |
8944 info.ast_value_factory()->GetOneByteString("my_var"); | 8946 info.ast_value_factory()->GetOneByteString("my_var"); |
8945 i::Variable* var = scope->Lookup(var_name); | 8947 i::Variable* var = scope->Lookup(var_name); |
8946 CHECK_EQ(inners[i].ctxt_allocate, | 8948 CHECK_EQ(inners[i].ctxt_allocate, |
8947 i::ScopeTestHelper::MustAllocateInContext(var)); | 8949 i::ScopeTestHelper::MustAllocateInContext(var)); |
8948 } | 8950 } |
8949 } | 8951 } |
8950 } | 8952 } |
OLD | NEW |