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/parsing/parser.h" | 5 #include "src/parsing/parser.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/ast/ast.h" | 10 #include "src/ast/ast.h" |
(...skipping 2256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2267 EmptyStatement* empty = factory()->NewEmptyStatement(kNoSourcePosition); | 2267 EmptyStatement* empty = factory()->NewEmptyStatement(kNoSourcePosition); |
2268 // Async functions don't undergo sloppy mode block scoped hoisting, and don't | 2268 // Async functions don't undergo sloppy mode block scoped hoisting, and don't |
2269 // allow duplicates in a block. Both are represented by the | 2269 // allow duplicates in a block. Both are represented by the |
2270 // sloppy_block_function_map. Don't add them to the map for async functions. | 2270 // sloppy_block_function_map. Don't add them to the map for async functions. |
2271 // Generators are also supposed to be prohibited; currently doing this behind | 2271 // Generators are also supposed to be prohibited; currently doing this behind |
2272 // a flag and UseCounting violations to assess web compatibility. | 2272 // a flag and UseCounting violations to assess web compatibility. |
2273 if (is_sloppy(language_mode()) && !scope()->is_declaration_scope() && | 2273 if (is_sloppy(language_mode()) && !scope()->is_declaration_scope() && |
2274 !is_async && !(allow_harmony_restrictive_generators() && is_generator)) { | 2274 !is_async && !(allow_harmony_restrictive_generators() && is_generator)) { |
2275 SloppyBlockFunctionStatement* delegate = | 2275 SloppyBlockFunctionStatement* delegate = |
2276 factory()->NewSloppyBlockFunctionStatement(empty, scope()); | 2276 factory()->NewSloppyBlockFunctionStatement(empty, scope()); |
2277 scope()->GetDeclarationScope()->sloppy_block_function_map()->Declare( | 2277 DeclarationScope* target_scope = scope()->GetDeclarationScope(); |
2278 variable_name, delegate); | 2278 target_scope->DeclareSloppyBlockFunction(variable_name, delegate); |
2279 return delegate; | 2279 return delegate; |
2280 } | 2280 } |
2281 return empty; | 2281 return empty; |
2282 } | 2282 } |
2283 | 2283 |
2284 Statement* Parser::ParseClassDeclaration(ZoneList<const AstRawString*>* names, | 2284 Statement* Parser::ParseClassDeclaration(ZoneList<const AstRawString*>* names, |
2285 bool default_export, bool* ok) { | 2285 bool default_export, bool* ok) { |
2286 // ClassDeclaration :: | 2286 // ClassDeclaration :: |
2287 // 'class' Identifier ('extends' LeftHandExpression)? '{' ClassBody '}' | 2287 // 'class' Identifier ('extends' LeftHandExpression)? '{' ClassBody '}' |
2288 // 'class' ('extends' LeftHandExpression)? '{' ClassBody '}' | 2288 // 'class' ('extends' LeftHandExpression)? '{' ClassBody '}' |
(...skipping 4875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7164 node->Print(Isolate::Current()); | 7164 node->Print(Isolate::Current()); |
7165 } | 7165 } |
7166 #endif // DEBUG | 7166 #endif // DEBUG |
7167 | 7167 |
7168 #undef CHECK_OK | 7168 #undef CHECK_OK |
7169 #undef CHECK_OK_VOID | 7169 #undef CHECK_OK_VOID |
7170 #undef CHECK_FAILED | 7170 #undef CHECK_FAILED |
7171 | 7171 |
7172 } // namespace internal | 7172 } // namespace internal |
7173 } // namespace v8 | 7173 } // namespace v8 |
OLD | NEW |