| 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 13 matching lines...) Expand all Loading... |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #include <stdio.h> | 28 #include <stdio.h> |
| 29 #include <stdlib.h> | 29 #include <stdlib.h> |
| 30 #include <string.h> | 30 #include <string.h> |
| 31 | 31 |
| 32 #include "src/v8.h" | 32 #include "src/v8.h" |
| 33 | 33 |
| 34 #include "src/ast-numbering.h" |
| 34 #include "src/ast-value-factory.h" | 35 #include "src/ast-value-factory.h" |
| 35 #include "src/compiler.h" | 36 #include "src/compiler.h" |
| 36 #include "src/execution.h" | 37 #include "src/execution.h" |
| 37 #include "src/isolate.h" | 38 #include "src/isolate.h" |
| 38 #include "src/objects.h" | 39 #include "src/objects.h" |
| 39 #include "src/parser.h" | 40 #include "src/parser.h" |
| 40 #include "src/preparser.h" | 41 #include "src/preparser.h" |
| 41 #include "src/rewriter.h" | 42 #include "src/rewriter.h" |
| 42 #include "src/scanner-character-streams.h" | 43 #include "src/scanner-character-streams.h" |
| 43 #include "src/token.h" | 44 #include "src/token.h" |
| (...skipping 3107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3151 i::Handle<i::Script> script = factory->NewScript(source); | 3152 i::Handle<i::Script> script = factory->NewScript(source); |
| 3152 i::CompilationInfoWithZone info(script); | 3153 i::CompilationInfoWithZone info(script); |
| 3153 i::Parser::ParseInfo parse_info = { | 3154 i::Parser::ParseInfo parse_info = { |
| 3154 isolate->stack_guard()->real_climit(), | 3155 isolate->stack_guard()->real_climit(), |
| 3155 isolate->heap()->HashSeed(), isolate->unicode_cache()}; | 3156 isolate->heap()->HashSeed(), isolate->unicode_cache()}; |
| 3156 i::Parser parser(&info, &parse_info); | 3157 i::Parser parser(&info, &parse_info); |
| 3157 parser.set_allow_harmony_scoping(true); | 3158 parser.set_allow_harmony_scoping(true); |
| 3158 CHECK(parser.Parse()); | 3159 CHECK(parser.Parse()); |
| 3159 CHECK(i::Rewriter::Rewrite(&info)); | 3160 CHECK(i::Rewriter::Rewrite(&info)); |
| 3160 CHECK(i::Scope::Analyze(&info)); | 3161 CHECK(i::Scope::Analyze(&info)); |
| 3162 CHECK(i::AstNumbering::Renumber(&info)); |
| 3161 CHECK(info.function() != NULL); | 3163 CHECK(info.function() != NULL); |
| 3162 | 3164 |
| 3163 i::Scope* scope = info.function()->scope(); | 3165 i::Scope* scope = info.function()->scope(); |
| 3164 CHECK_EQ(scope->inner_scopes()->length(), 1); | 3166 CHECK_EQ(scope->inner_scopes()->length(), 1); |
| 3165 i::Scope* inner_scope = scope->inner_scopes()->at(0); | 3167 i::Scope* inner_scope = scope->inner_scopes()->at(0); |
| 3166 const i::AstRawString* var_name = | 3168 const i::AstRawString* var_name = |
| 3167 info.ast_value_factory()->GetOneByteString("x"); | 3169 info.ast_value_factory()->GetOneByteString("x"); |
| 3168 i::Variable* var = inner_scope->Lookup(var_name); | 3170 i::Variable* var = inner_scope->Lookup(var_name); |
| 3169 bool expected = outers[i].assigned || inners[j].assigned; | 3171 bool expected = outers[i].assigned || inners[j].assigned; |
| 3170 CHECK(var != NULL); | 3172 CHECK(var != NULL); |
| (...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4080 | 4082 |
| 4081 const char* name_data[] = { | 4083 const char* name_data[] = { |
| 4082 "function* g() { ({yield}); }", | 4084 "function* g() { ({yield}); }", |
| 4083 NULL | 4085 NULL |
| 4084 }; | 4086 }; |
| 4085 | 4087 |
| 4086 static const ParserFlag always_flags[] = {kAllowHarmonyObjectLiterals}; | 4088 static const ParserFlag always_flags[] = {kAllowHarmonyObjectLiterals}; |
| 4087 RunParserSyncTest(context_data, name_data, kError, NULL, 0, | 4089 RunParserSyncTest(context_data, name_data, kError, NULL, 0, |
| 4088 always_flags, arraysize(always_flags)); | 4090 always_flags, arraysize(always_flags)); |
| 4089 } | 4091 } |
| OLD | NEW |