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 5964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5975 "export {foob};"; | 5975 "export {foob};"; |
5976 i::Handle<i::String> source = factory->NewStringFromAsciiChecked(kSource); | 5976 i::Handle<i::String> source = factory->NewStringFromAsciiChecked(kSource); |
5977 i::Handle<i::Script> script = factory->NewScript(source); | 5977 i::Handle<i::Script> script = factory->NewScript(source); |
5978 i::Zone zone(CcTest::i_isolate()->allocator()); | 5978 i::Zone zone(CcTest::i_isolate()->allocator()); |
5979 i::ParseInfo info(&zone, script); | 5979 i::ParseInfo info(&zone, script); |
5980 i::Parser parser(&info); | 5980 i::Parser parser(&info); |
5981 info.set_module(); | 5981 info.set_module(); |
5982 CHECK(parser.Parse(&info)); | 5982 CHECK(parser.Parse(&info)); |
5983 CHECK(i::Compiler::Analyze(&info)); | 5983 CHECK(i::Compiler::Analyze(&info)); |
5984 i::FunctionLiteral* func = info.literal(); | 5984 i::FunctionLiteral* func = info.literal(); |
5985 i::DeclarationScope* module_scope = func->scope(); | 5985 i::ModuleScope* module_scope = func->scope()->AsModuleScope(); |
5986 i::Scope* outer_scope = module_scope->outer_scope(); | 5986 i::Scope* outer_scope = module_scope->outer_scope(); |
5987 CHECK(outer_scope->is_script_scope()); | 5987 CHECK(outer_scope->is_script_scope()); |
5988 CHECK_NULL(outer_scope->outer_scope()); | 5988 CHECK_NULL(outer_scope->outer_scope()); |
5989 CHECK(module_scope->is_module_scope()); | 5989 CHECK(module_scope->is_module_scope()); |
5990 i::ZoneList<i::Declaration*>* declarations = module_scope->declarations(); | 5990 i::ZoneList<i::Declaration*>* declarations = module_scope->declarations(); |
5991 CHECK_EQ(13, declarations->length()); | 5991 CHECK_EQ(13, declarations->length()); |
5992 | 5992 |
5993 CHECK(declarations->at(0)->proxy()->raw_name()->IsOneByteEqualTo("x")); | 5993 CHECK(declarations->at(0)->proxy()->raw_name()->IsOneByteEqualTo("x")); |
5994 CHECK(declarations->at(0)->proxy()->var()->mode() == i::LET); | 5994 CHECK(declarations->at(0)->proxy()->var()->mode() == i::LET); |
5995 CHECK(declarations->at(0)->proxy()->var()->binding_needs_init()); | 5995 CHECK(declarations->at(0)->proxy()->var()->binding_needs_init()); |
(...skipping 2145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8141 "(a,);", | 8141 "(a,);", |
8142 "(a,b,c,);", | 8142 "(a,b,c,);", |
8143 NULL | 8143 NULL |
8144 }; | 8144 }; |
8145 // clang-format on | 8145 // clang-format on |
8146 | 8146 |
8147 static const ParserFlag always_flags[] = {kAllowHarmonyTrailingCommas}; | 8147 static const ParserFlag always_flags[] = {kAllowHarmonyTrailingCommas}; |
8148 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, | 8148 RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, |
8149 arraysize(always_flags)); | 8149 arraysize(always_flags)); |
8150 } | 8150 } |
OLD | NEW |