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 2845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2856 int pos = position(); | 2856 int pos = position(); |
2857 ExpressionClassifier classifier(this); | 2857 ExpressionClassifier classifier(this); |
2858 ExpressionT expression = | 2858 ExpressionT expression = |
2859 ParseAssignmentExpression(accept_IN, &classifier, CHECK_OK); | 2859 ParseAssignmentExpression(accept_IN, &classifier, CHECK_OK); |
2860 Traits::RewriteNonPattern(&classifier, CHECK_OK); | 2860 Traits::RewriteNonPattern(&classifier, CHECK_OK); |
2861 body = this->NewStatementList(1, zone()); | 2861 body = this->NewStatementList(1, zone()); |
2862 this->AddParameterInitializationBlock(formal_parameters, body, CHECK_OK); | 2862 this->AddParameterInitializationBlock(formal_parameters, body, CHECK_OK); |
2863 body->Add(factory()->NewReturnStatement(expression, pos), zone()); | 2863 body->Add(factory()->NewReturnStatement(expression, pos), zone()); |
2864 materialized_literal_count = function_state.materialized_literal_count(); | 2864 materialized_literal_count = function_state.materialized_literal_count(); |
2865 expected_property_count = function_state.expected_property_count(); | 2865 expected_property_count = function_state.expected_property_count(); |
| 2866 // ES6 14.6.1 Static Semantics: IsInTailPosition |
| 2867 if (allow_tailcalls() && !is_sloppy(language_mode())) { |
| 2868 this->MarkExpressionInTailPosition(expression); |
| 2869 } |
2866 } | 2870 } |
2867 super_loc = function_state.super_location(); | 2871 super_loc = function_state.super_location(); |
2868 | 2872 |
2869 formal_parameters.scope->set_end_position(scanner()->location().end_pos); | 2873 formal_parameters.scope->set_end_position(scanner()->location().end_pos); |
2870 | 2874 |
2871 // Arrow function formal parameters are parsed as StrictFormalParameterList, | 2875 // Arrow function formal parameters are parsed as StrictFormalParameterList, |
2872 // which is not the same as "parameters of a strict function"; it only means | 2876 // which is not the same as "parameters of a strict function"; it only means |
2873 // that duplicates are not allowed. Of course, the arrow function may | 2877 // that duplicates are not allowed. Of course, the arrow function may |
2874 // itself be strict as well. | 2878 // itself be strict as well. |
2875 const bool allow_duplicate_parameters = false; | 2879 const bool allow_duplicate_parameters = false; |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3112 has_seen_constructor_ = true; | 3116 has_seen_constructor_ = true; |
3113 return; | 3117 return; |
3114 } | 3118 } |
3115 } | 3119 } |
3116 | 3120 |
3117 | 3121 |
3118 } // namespace internal | 3122 } // namespace internal |
3119 } // namespace v8 | 3123 } // namespace v8 |
3120 | 3124 |
3121 #endif // V8_PARSING_PARSER_BASE_H | 3125 #endif // V8_PARSING_PARSER_BASE_H |
OLD | NEW |