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 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1143 if (Check(Token::LPAREN)) { | 1143 if (Check(Token::LPAREN)) { |
1144 // '(' StrictFormalParameters ')' | 1144 // '(' StrictFormalParameters ')' |
1145 ParseFormalParameterList(scope, &error_locs, &has_rest, &ok); | 1145 ParseFormalParameterList(scope, &error_locs, &has_rest, &ok); |
1146 if (ok) ok = Check(Token::RPAREN); | 1146 if (ok) ok = Check(Token::RPAREN); |
1147 } else { | 1147 } else { |
1148 // BindingIdentifier | 1148 // BindingIdentifier |
1149 ParseFormalParameter(scope, &error_locs, has_rest, &ok); | 1149 ParseFormalParameter(scope, &error_locs, has_rest, &ok); |
1150 } | 1150 } |
1151 | 1151 |
1152 if (ok) { | 1152 if (ok) { |
1153 ExpressionClassifier classifier; | 1153 Expression* expression = |
1154 Expression* expression = ParseArrowFunctionLiteral( | 1154 ParseArrowFunctionLiteral(scope, error_locs, has_rest, &ok); |
1155 scope, error_locs, has_rest, &classifier, &ok); | |
1156 ValidateExpression(&classifier, &ok); | |
1157 if (ok) { | 1155 if (ok) { |
1158 // Scanning must end at the same position that was recorded | 1156 // Scanning must end at the same position that was recorded |
1159 // previously. If not, parsing has been interrupted due to a stack | 1157 // previously. If not, parsing has been interrupted due to a stack |
1160 // overflow, at which point the partially parsed arrow function | 1158 // overflow, at which point the partially parsed arrow function |
1161 // concise body happens to be a valid expression. This is a problem | 1159 // concise body happens to be a valid expression. This is a problem |
1162 // only for arrow functions with single expression bodies, since there | 1160 // only for arrow functions with single expression bodies, since there |
1163 // is no end token such as "}" for normal functions. | 1161 // is no end token such as "}" for normal functions. |
1164 if (scanner()->location().end_pos == shared_info->end_position()) { | 1162 if (scanner()->location().end_pos == shared_info->end_position()) { |
1165 // The pre-parser saw an arrow function here, so the full parser | 1163 // The pre-parser saw an arrow function here, so the full parser |
1166 // must produce a FunctionLiteral. | 1164 // must produce a FunctionLiteral. |
(...skipping 4608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5775 | 5773 |
5776 Expression* Parser::SpreadCallNew(Expression* function, | 5774 Expression* Parser::SpreadCallNew(Expression* function, |
5777 ZoneList<v8::internal::Expression*>* args, | 5775 ZoneList<v8::internal::Expression*>* args, |
5778 int pos) { | 5776 int pos) { |
5779 args->InsertAt(0, function, zone()); | 5777 args->InsertAt(0, function, zone()); |
5780 | 5778 |
5781 return factory()->NewCallRuntime( | 5779 return factory()->NewCallRuntime( |
5782 ast_value_factory()->reflect_construct_string(), NULL, args, pos); | 5780 ast_value_factory()->reflect_construct_string(), NULL, args, pos); |
5783 } | 5781 } |
5784 } } // namespace v8::internal | 5782 } } // namespace v8::internal |
OLD | NEW |