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_H_ | 5 #ifndef V8_PARSING_PARSER_H_ |
6 #define V8_PARSING_PARSER_H_ | 6 #define V8_PARSING_PARSER_H_ |
7 | 7 |
8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
10 #include "src/parsing/parser-base.h" | 10 #include "src/parsing/parser-base.h" |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 current_value_ = value; | 351 current_value_ = value; |
352 recursion_level_++; | 352 recursion_level_++; |
353 Visit(pattern); | 353 Visit(pattern); |
354 recursion_level_--; | 354 recursion_level_--; |
355 current_value_ = old_value; | 355 current_value_ = old_value; |
356 } | 356 } |
357 | 357 |
358 void VisitObjectLiteral(ObjectLiteral* node, Variable** temp_var); | 358 void VisitObjectLiteral(ObjectLiteral* node, Variable** temp_var); |
359 void VisitArrayLiteral(ArrayLiteral* node, Variable** temp_var); | 359 void VisitArrayLiteral(ArrayLiteral* node, Variable** temp_var); |
360 | 360 |
361 bool IsBindingContext() const { return IsBindingContext(context_); } | 361 bool IsBindingContext() const { |
| 362 return context_ == BINDING || context_ == INITIALIZER; |
| 363 } |
362 bool IsInitializerContext() const { return context_ != ASSIGNMENT; } | 364 bool IsInitializerContext() const { return context_ != ASSIGNMENT; } |
363 bool IsAssignmentContext() const { return IsAssignmentContext(context_); } | 365 bool IsAssignmentContext() const { |
364 bool IsAssignmentContext(PatternContext c) const; | 366 return context_ == ASSIGNMENT || context_ == ASSIGNMENT_INITIALIZER; |
365 bool IsBindingContext(PatternContext c) const; | 367 } |
366 bool IsSubPattern() const { return recursion_level_ > 1; } | 368 bool IsSubPattern() const { return recursion_level_ > 1; } |
367 PatternContext SetAssignmentContextIfNeeded(Expression* node); | 369 PatternContext SetAssignmentContextIfNeeded(Expression* node); |
368 PatternContext SetInitializerContextIfNeeded(Expression* node); | 370 PatternContext SetInitializerContextIfNeeded(Expression* node); |
369 | 371 |
370 void RewriteParameterScopes(Expression* expr); | 372 void RewriteParameterScopes(Expression* expr); |
371 | 373 |
372 Variable* CreateTempVar(Expression* value = nullptr); | 374 Variable* CreateTempVar(Expression* value = nullptr); |
373 | 375 |
374 AstNodeFactory* factory() const { return parser_->factory(); } | 376 AstNodeFactory* factory() const { return parser_->factory(); } |
375 AstValueFactory* ast_value_factory() const { | 377 AstValueFactory* ast_value_factory() const { |
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1090 int total_preparse_skipped_; | 1092 int total_preparse_skipped_; |
1091 HistogramTimer* pre_parse_timer_; | 1093 HistogramTimer* pre_parse_timer_; |
1092 | 1094 |
1093 bool parsing_on_main_thread_; | 1095 bool parsing_on_main_thread_; |
1094 }; | 1096 }; |
1095 | 1097 |
1096 } // namespace internal | 1098 } // namespace internal |
1097 } // namespace v8 | 1099 } // namespace v8 |
1098 | 1100 |
1099 #endif // V8_PARSING_PARSER_H_ | 1101 #endif // V8_PARSING_PARSER_H_ |
OLD | NEW |