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 #ifndef V8_PARSING_PARSER_BASE_H | 5 #ifndef V8_PARSING_PARSER_BASE_H |
6 #define V8_PARSING_PARSER_BASE_H | 6 #define V8_PARSING_PARSER_BASE_H |
7 | 7 |
8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
9 #include "src/bailout-reason.h" | 9 #include "src/bailout-reason.h" |
10 #include "src/hashmap.h" | 10 #include "src/hashmap.h" |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 }; | 355 }; |
356 | 356 |
357 Scope* NewScope(Scope* parent, ScopeType scope_type) { | 357 Scope* NewScope(Scope* parent, ScopeType scope_type) { |
358 // Must always pass the function kind for FUNCTION_SCOPE. | 358 // Must always pass the function kind for FUNCTION_SCOPE. |
359 DCHECK(scope_type != FUNCTION_SCOPE); | 359 DCHECK(scope_type != FUNCTION_SCOPE); |
360 return NewScope(parent, scope_type, kNormalFunction); | 360 return NewScope(parent, scope_type, kNormalFunction); |
361 } | 361 } |
362 | 362 |
363 Scope* NewScope(Scope* parent, ScopeType scope_type, FunctionKind kind) { | 363 Scope* NewScope(Scope* parent, ScopeType scope_type, FunctionKind kind) { |
364 DCHECK(ast_value_factory()); | 364 DCHECK(ast_value_factory()); |
365 DCHECK(scope_type != MODULE_SCOPE || FLAG_harmony_modules); | |
366 Scope* result = new (zone()) | 365 Scope* result = new (zone()) |
367 Scope(zone(), parent, scope_type, ast_value_factory(), kind); | 366 Scope(zone(), parent, scope_type, ast_value_factory(), kind); |
368 result->Initialize(); | 367 result->Initialize(); |
369 return result; | 368 return result; |
370 } | 369 } |
371 | 370 |
372 Scanner* scanner() const { return scanner_; } | 371 Scanner* scanner() const { return scanner_; } |
373 AstValueFactory* ast_value_factory() const { return ast_value_factory_; } | 372 AstValueFactory* ast_value_factory() const { return ast_value_factory_; } |
374 int position() { return scanner_->location().beg_pos; } | 373 int position() { return scanner_->location().beg_pos; } |
375 int peek_position() { return scanner_->peek_location().beg_pos; } | 374 int peek_position() { return scanner_->peek_location().beg_pos; } |
(...skipping 2707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3083 has_seen_constructor_ = true; | 3082 has_seen_constructor_ = true; |
3084 return; | 3083 return; |
3085 } | 3084 } |
3086 } | 3085 } |
3087 | 3086 |
3088 | 3087 |
3089 } // namespace internal | 3088 } // namespace internal |
3090 } // namespace v8 | 3089 } // namespace v8 |
3091 | 3090 |
3092 #endif // V8_PARSING_PARSER_BASE_H | 3091 #endif // V8_PARSING_PARSER_BASE_H |
OLD | NEW |