OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/api.h" | 7 #include "src/api.h" |
8 #include "src/ast.h" | 8 #include "src/ast.h" |
9 #include "src/bailout-reason.h" | 9 #include "src/bailout-reason.h" |
10 #include "src/base/platform/platform.h" | 10 #include "src/base/platform/platform.h" |
(...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
935 AstNodeFactory function_factory(ast_value_factory()); | 935 AstNodeFactory function_factory(ast_value_factory()); |
936 FunctionState function_state(&function_state_, &scope_, *scope, | 936 FunctionState function_state(&function_state_, &scope_, *scope, |
937 kNormalFunction, &function_factory); | 937 kNormalFunction, &function_factory); |
938 | 938 |
939 scope_->SetLanguageMode(info->language_mode()); | 939 scope_->SetLanguageMode(info->language_mode()); |
940 ZoneList<Statement*>* body = new(zone()) ZoneList<Statement*>(16, zone()); | 940 ZoneList<Statement*>* body = new(zone()) ZoneList<Statement*>(16, zone()); |
941 bool ok = true; | 941 bool ok = true; |
942 int beg_pos = scanner()->location().beg_pos; | 942 int beg_pos = scanner()->location().beg_pos; |
943 if (info->is_module()) { | 943 if (info->is_module()) { |
944 DCHECK(allow_harmony_modules()); | 944 DCHECK(allow_harmony_modules()); |
945 ParseModule(body, &ok); | 945 ParseModuleItemList(body, &ok); |
946 } else { | 946 } else { |
947 ParseStatementList(body, Token::EOS, info->is_eval(), eval_scope, &ok); | 947 ParseStatementList(body, Token::EOS, info->is_eval(), eval_scope, &ok); |
948 } | 948 } |
949 | 949 |
950 if (ok && is_strict(language_mode())) { | 950 if (ok && is_strict(language_mode())) { |
951 CheckStrictOctalLiteral(beg_pos, scanner()->location().end_pos, &ok); | 951 CheckStrictOctalLiteral(beg_pos, scanner()->location().end_pos, &ok); |
952 } | 952 } |
953 | 953 |
954 if (ok && allow_harmony_scoping() && is_strict(language_mode())) { | 954 if (ok && allow_harmony_scoping() && is_strict(language_mode())) { |
955 CheckConflictingVarDeclarations(scope_, &ok); | 955 CheckConflictingVarDeclarations(scope_, &ok); |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1235 case Token::IMPORT: | 1235 case Token::IMPORT: |
1236 return ParseImportDeclaration(ok); | 1236 return ParseImportDeclaration(ok); |
1237 case Token::EXPORT: | 1237 case Token::EXPORT: |
1238 return ParseExportDeclaration(ok); | 1238 return ParseExportDeclaration(ok); |
1239 default: | 1239 default: |
1240 return ParseStatementListItem(ok); | 1240 return ParseStatementListItem(ok); |
1241 } | 1241 } |
1242 } | 1242 } |
1243 | 1243 |
1244 | 1244 |
1245 void* Parser::ParseModule(ZoneList<Statement*>* body, bool* ok) { | 1245 void* Parser::ParseModuleItemList(ZoneList<Statement*>* body, bool* ok) { |
1246 // (Ecma 262 6th Edition, 15.2): | 1246 // (Ecma 262 6th Edition, 15.2): |
1247 // Module : | 1247 // Module : |
1248 // ModuleBody? | 1248 // ModuleBody? |
1249 // | 1249 // |
1250 // ModuleBody : | 1250 // ModuleBody : |
1251 // ModuleItem* | 1251 // ModuleItem* |
1252 | 1252 |
1253 DCHECK(scope_->is_module_scope()); | 1253 DCHECK(scope_->is_module_scope()); |
1254 scope_->SetLanguageMode( | 1254 scope_->SetLanguageMode( |
1255 static_cast<LanguageMode>(scope_->language_mode() | STRICT_BIT)); | 1255 static_cast<LanguageMode>(scope_->language_mode() | STRICT_BIT)); |
(...skipping 4163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5419 } else { | 5419 } else { |
5420 const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data()); | 5420 const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data()); |
5421 running_hash = StringHasher::ComputeRunningHash(running_hash, data, | 5421 running_hash = StringHasher::ComputeRunningHash(running_hash, data, |
5422 raw_string->length()); | 5422 raw_string->length()); |
5423 } | 5423 } |
5424 } | 5424 } |
5425 | 5425 |
5426 return running_hash; | 5426 return running_hash; |
5427 } | 5427 } |
5428 } } // namespace v8::internal | 5428 } } // namespace v8::internal |
OLD | NEW |