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_PREPARSER_H | 5 #ifndef V8_PREPARSER_H |
6 #define V8_PREPARSER_H | 6 #define V8_PREPARSER_H |
7 | 7 |
8 #include "src/bailout-reason.h" | 8 #include "src/bailout-reason.h" |
9 #include "src/expression-classifier.h" | 9 #include "src/expression-classifier.h" |
10 #include "src/func-name-inferrer.h" | 10 #include "src/func-name-inferrer.h" |
(...skipping 2970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2981 bool* ok) { | 2981 bool* ok) { |
2982 // ConditionalExpression :: | 2982 // ConditionalExpression :: |
2983 // LogicalOrExpression | 2983 // LogicalOrExpression |
2984 // LogicalOrExpression '?' AssignmentExpression ':' AssignmentExpression | 2984 // LogicalOrExpression '?' AssignmentExpression ':' AssignmentExpression |
2985 | 2985 |
2986 int pos = peek_position(); | 2986 int pos = peek_position(); |
2987 // We start using the binary expression parser for prec >= 4 only! | 2987 // We start using the binary expression parser for prec >= 4 only! |
2988 ExpressionT expression = | 2988 ExpressionT expression = |
2989 this->ParseBinaryExpression(4, accept_IN, classifier, CHECK_OK); | 2989 this->ParseBinaryExpression(4, accept_IN, classifier, CHECK_OK); |
2990 if (peek() != Token::CONDITIONAL) return expression; | 2990 if (peek() != Token::CONDITIONAL) return expression; |
2991 ArrowFormalParametersUnexpectedToken(classifier); | |
2991 BindingPatternUnexpectedToken(classifier); | 2992 BindingPatternUnexpectedToken(classifier); |
2992 Consume(Token::CONDITIONAL); | 2993 Consume(Token::CONDITIONAL); |
2993 // In parsing the first assignment expression in conditional | 2994 // In parsing the first assignment expression in conditional |
2994 // expressions we always accept the 'in' keyword; see ECMA-262, | 2995 // expressions we always accept the 'in' keyword; see ECMA-262, |
2995 // section 11.12, page 58. | 2996 // section 11.12, page 58. |
2996 ExpressionT left = ParseAssignmentExpression(true, classifier, CHECK_OK); | 2997 ExpressionT left = ParseAssignmentExpression(true, classifier, CHECK_OK); |
2997 Expect(Token::COLON, CHECK_OK); | 2998 Expect(Token::COLON, CHECK_OK); |
2998 ExpressionT right = | 2999 ExpressionT right = |
2999 ParseAssignmentExpression(accept_IN, classifier, CHECK_OK); | 3000 ParseAssignmentExpression(accept_IN, classifier, CHECK_OK); |
3000 return factory()->NewConditional(expression, left, right, pos); | 3001 return factory()->NewConditional(expression, left, right, pos); |
3001 } | 3002 } |
3002 | 3003 |
3003 | 3004 |
3004 // Precedence >= 4 | 3005 // Precedence >= 4 |
3005 template <class Traits> | 3006 template <class Traits> |
3006 typename ParserBase<Traits>::ExpressionT | 3007 typename ParserBase<Traits>::ExpressionT |
3007 ParserBase<Traits>::ParseBinaryExpression(int prec, bool accept_IN, | 3008 ParserBase<Traits>::ParseBinaryExpression(int prec, bool accept_IN, |
3008 ExpressionClassifier* classifier, | 3009 ExpressionClassifier* classifier, |
3009 bool* ok) { | 3010 bool* ok) { |
3010 DCHECK(prec >= 4); | 3011 DCHECK(prec >= 4); |
3011 ExpressionT x = this->ParseUnaryExpression(classifier, CHECK_OK); | 3012 ExpressionT x = this->ParseUnaryExpression(classifier, CHECK_OK); |
3012 for (int prec1 = Precedence(peek(), accept_IN); prec1 >= prec; prec1--) { | 3013 for (int prec1 = Precedence(peek(), accept_IN); prec1 >= prec; prec1--) { |
3013 // prec1 >= 4 | 3014 // prec1 >= 4 |
3014 while (Precedence(peek(), accept_IN) == prec1) { | 3015 while (Precedence(peek(), accept_IN) == prec1) { |
3015 BindingPatternUnexpectedToken(classifier); | 3016 BindingPatternUnexpectedToken(classifier); |
3017 ArrowFormalParametersUnexpectedToken(classifier); | |
3016 Token::Value op = Next(); | 3018 Token::Value op = Next(); |
3017 Scanner::Location op_location = scanner()->location(); | 3019 Scanner::Location op_location = scanner()->location(); |
3018 int pos = position(); | 3020 int pos = position(); |
3019 ExpressionT y = | 3021 ExpressionT y = |
3020 ParseBinaryExpression(prec1 + 1, accept_IN, classifier, CHECK_OK); | 3022 ParseBinaryExpression(prec1 + 1, accept_IN, classifier, CHECK_OK); |
3021 | 3023 |
3022 if (this->ShortcutNumericLiteralBinaryExpression(&x, y, op, pos, | 3024 if (this->ShortcutNumericLiteralBinaryExpression(&x, y, op, pos, |
3023 factory())) { | 3025 factory())) { |
3024 continue; | 3026 continue; |
3025 } | 3027 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3068 // '++' UnaryExpression | 3070 // '++' UnaryExpression |
3069 // '--' UnaryExpression | 3071 // '--' UnaryExpression |
3070 // '+' UnaryExpression | 3072 // '+' UnaryExpression |
3071 // '-' UnaryExpression | 3073 // '-' UnaryExpression |
3072 // '~' UnaryExpression | 3074 // '~' UnaryExpression |
3073 // '!' UnaryExpression | 3075 // '!' UnaryExpression |
3074 | 3076 |
3075 Token::Value op = peek(); | 3077 Token::Value op = peek(); |
3076 if (Token::IsUnaryOp(op)) { | 3078 if (Token::IsUnaryOp(op)) { |
3077 BindingPatternUnexpectedToken(classifier); | 3079 BindingPatternUnexpectedToken(classifier); |
3080 ArrowFormalParametersUnexpectedToken(classifier); | |
3078 | 3081 |
3079 op = Next(); | 3082 op = Next(); |
3080 int pos = position(); | 3083 int pos = position(); |
3081 ExpressionT expression = ParseUnaryExpression(classifier, CHECK_OK); | 3084 ExpressionT expression = ParseUnaryExpression(classifier, CHECK_OK); |
3082 | 3085 |
3083 if (op == Token::DELETE && is_strict(language_mode())) { | 3086 if (op == Token::DELETE && is_strict(language_mode())) { |
3084 if (is_strong(language_mode())) { | 3087 if (is_strong(language_mode())) { |
3085 ReportMessage(MessageTemplate::kStrongDelete); | 3088 ReportMessage(MessageTemplate::kStrongDelete); |
3086 *ok = false; | 3089 *ok = false; |
3087 return this->EmptyExpression(); | 3090 return this->EmptyExpression(); |
3088 } else if (this->IsIdentifier(expression)) { | 3091 } else if (this->IsIdentifier(expression)) { |
3089 // "delete identifier" is a syntax error in strict mode. | 3092 // "delete identifier" is a syntax error in strict mode. |
3090 ReportMessage(MessageTemplate::kStrictDelete); | 3093 ReportMessage(MessageTemplate::kStrictDelete); |
3091 *ok = false; | 3094 *ok = false; |
3092 return this->EmptyExpression(); | 3095 return this->EmptyExpression(); |
3093 } | 3096 } |
3094 } | 3097 } |
3095 | 3098 |
3096 // Allow Traits do rewrite the expression. | 3099 // Allow Traits do rewrite the expression. |
3097 return this->BuildUnaryExpression(expression, op, pos, factory()); | 3100 return this->BuildUnaryExpression(expression, op, pos, factory()); |
3098 } else if (Token::IsCountOp(op)) { | 3101 } else if (Token::IsCountOp(op)) { |
3099 BindingPatternUnexpectedToken(classifier); | 3102 BindingPatternUnexpectedToken(classifier); |
3103 ArrowFormalParametersUnexpectedToken(classifier); | |
3100 op = Next(); | 3104 op = Next(); |
3101 int beg_pos = peek_position(); | 3105 int beg_pos = peek_position(); |
3102 ExpressionT expression = this->ParseUnaryExpression(classifier, CHECK_OK); | 3106 ExpressionT expression = this->ParseUnaryExpression(classifier, CHECK_OK); |
3103 expression = this->CheckAndRewriteReferenceExpression( | 3107 expression = this->CheckAndRewriteReferenceExpression( |
3104 expression, beg_pos, scanner()->location().end_pos, | 3108 expression, beg_pos, scanner()->location().end_pos, |
3105 MessageTemplate::kInvalidLhsInPrefixOp, CHECK_OK); | 3109 MessageTemplate::kInvalidLhsInPrefixOp, CHECK_OK); |
3106 this->MarkExpressionAsAssigned(expression); | 3110 this->MarkExpressionAsAssigned(expression); |
3107 | 3111 |
3108 return factory()->NewCountOperation(op, | 3112 return factory()->NewCountOperation(op, |
3109 true /* prefix */, | 3113 true /* prefix */, |
(...skipping 12 matching lines...) Expand all Loading... | |
3122 bool* ok) { | 3126 bool* ok) { |
3123 // PostfixExpression :: | 3127 // PostfixExpression :: |
3124 // LeftHandSideExpression ('++' | '--')? | 3128 // LeftHandSideExpression ('++' | '--')? |
3125 | 3129 |
3126 int lhs_beg_pos = peek_position(); | 3130 int lhs_beg_pos = peek_position(); |
3127 ExpressionT expression = | 3131 ExpressionT expression = |
3128 this->ParseLeftHandSideExpression(classifier, CHECK_OK); | 3132 this->ParseLeftHandSideExpression(classifier, CHECK_OK); |
3129 if (!scanner()->HasAnyLineTerminatorBeforeNext() && | 3133 if (!scanner()->HasAnyLineTerminatorBeforeNext() && |
3130 Token::IsCountOp(peek())) { | 3134 Token::IsCountOp(peek())) { |
3131 BindingPatternUnexpectedToken(classifier); | 3135 BindingPatternUnexpectedToken(classifier); |
3136 ArrowFormalParametersUnexpectedToken(classifier); | |
3132 | 3137 |
3133 expression = this->CheckAndRewriteReferenceExpression( | 3138 expression = this->CheckAndRewriteReferenceExpression( |
3134 expression, lhs_beg_pos, scanner()->location().end_pos, | 3139 expression, lhs_beg_pos, scanner()->location().end_pos, |
3135 MessageTemplate::kInvalidLhsInPostfixOp, CHECK_OK); | 3140 MessageTemplate::kInvalidLhsInPostfixOp, CHECK_OK); |
3136 expression = this->MarkExpressionAsAssigned(expression); | 3141 expression = this->MarkExpressionAsAssigned(expression); |
3137 | 3142 |
3138 Token::Value next = Next(); | 3143 Token::Value next = Next(); |
3139 expression = | 3144 expression = |
3140 factory()->NewCountOperation(next, | 3145 factory()->NewCountOperation(next, |
3141 false /* postfix */, | 3146 false /* postfix */, |
(...skipping 11 matching lines...) Expand all Loading... | |
3153 // LeftHandSideExpression :: | 3158 // LeftHandSideExpression :: |
3154 // (NewExpression | MemberExpression) ... | 3159 // (NewExpression | MemberExpression) ... |
3155 | 3160 |
3156 ExpressionT result = | 3161 ExpressionT result = |
3157 this->ParseMemberWithNewPrefixesExpression(classifier, CHECK_OK); | 3162 this->ParseMemberWithNewPrefixesExpression(classifier, CHECK_OK); |
3158 | 3163 |
3159 while (true) { | 3164 while (true) { |
3160 switch (peek()) { | 3165 switch (peek()) { |
3161 case Token::LBRACK: { | 3166 case Token::LBRACK: { |
3162 BindingPatternUnexpectedToken(classifier); | 3167 BindingPatternUnexpectedToken(classifier); |
3168 ArrowFormalParametersUnexpectedToken(classifier); | |
3163 Consume(Token::LBRACK); | 3169 Consume(Token::LBRACK); |
3164 int pos = position(); | 3170 int pos = position(); |
3165 ExpressionT index = ParseExpression(true, classifier, CHECK_OK); | 3171 ExpressionT index = ParseExpression(true, classifier, CHECK_OK); |
3166 result = factory()->NewProperty(result, index, pos); | 3172 result = factory()->NewProperty(result, index, pos); |
3167 Expect(Token::RBRACK, CHECK_OK); | 3173 Expect(Token::RBRACK, CHECK_OK); |
3168 break; | 3174 break; |
3169 } | 3175 } |
3170 | 3176 |
3171 case Token::LPAREN: { | 3177 case Token::LPAREN: { |
3172 BindingPatternUnexpectedToken(classifier); | 3178 BindingPatternUnexpectedToken(classifier); |
3179 ArrowFormalParametersUnexpectedToken(classifier); | |
3173 | 3180 |
3174 if (is_strong(language_mode()) && this->IsIdentifier(result) && | 3181 if (is_strong(language_mode()) && this->IsIdentifier(result) && |
3175 this->IsEval(this->AsIdentifier(result))) { | 3182 this->IsEval(this->AsIdentifier(result))) { |
3176 ReportMessage(MessageTemplate::kStrongDirectEval); | 3183 ReportMessage(MessageTemplate::kStrongDirectEval); |
3177 *ok = false; | 3184 *ok = false; |
3178 return this->EmptyExpression(); | 3185 return this->EmptyExpression(); |
3179 } | 3186 } |
3180 int pos; | 3187 int pos; |
3181 if (scanner()->current_token() == Token::IDENTIFIER) { | 3188 if (scanner()->current_token() == Token::IDENTIFIER) { |
3182 // For call of an identifier we want to report position of | 3189 // For call of an identifier we want to report position of |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3224 result = factory()->NewAssignment(Token::INIT_CONST, this_expr, | 3231 result = factory()->NewAssignment(Token::INIT_CONST, this_expr, |
3225 result, pos); | 3232 result, pos); |
3226 } | 3233 } |
3227 | 3234 |
3228 if (fni_ != NULL) fni_->RemoveLastFunction(); | 3235 if (fni_ != NULL) fni_->RemoveLastFunction(); |
3229 break; | 3236 break; |
3230 } | 3237 } |
3231 | 3238 |
3232 case Token::PERIOD: { | 3239 case Token::PERIOD: { |
3233 BindingPatternUnexpectedToken(classifier); | 3240 BindingPatternUnexpectedToken(classifier); |
3241 ArrowFormalParametersUnexpectedToken(classifier); | |
3234 Consume(Token::PERIOD); | 3242 Consume(Token::PERIOD); |
3235 int pos = position(); | 3243 int pos = position(); |
3236 IdentifierT name = ParseIdentifierName(CHECK_OK); | 3244 IdentifierT name = ParseIdentifierName(CHECK_OK); |
3237 result = factory()->NewProperty( | 3245 result = factory()->NewProperty( |
3238 result, factory()->NewStringLiteral(name, pos), pos); | 3246 result, factory()->NewStringLiteral(name, pos), pos); |
3239 if (fni_ != NULL) this->PushLiteralName(fni_, name); | 3247 if (fni_ != NULL) this->PushLiteralName(fni_, name); |
3240 break; | 3248 break; |
3241 } | 3249 } |
3242 | 3250 |
3243 case Token::TEMPLATE_SPAN: | 3251 case Token::TEMPLATE_SPAN: |
3244 case Token::TEMPLATE_TAIL: { | 3252 case Token::TEMPLATE_TAIL: { |
3245 BindingPatternUnexpectedToken(classifier); | 3253 BindingPatternUnexpectedToken(classifier); |
3254 ArrowFormalParametersUnexpectedToken(classifier); | |
3246 result = ParseTemplateLiteral(result, position(), classifier, CHECK_OK); | 3255 result = ParseTemplateLiteral(result, position(), classifier, CHECK_OK); |
3247 break; | 3256 break; |
3248 } | 3257 } |
3249 | 3258 |
3250 default: | 3259 default: |
3251 return result; | 3260 return result; |
3252 } | 3261 } |
3253 } | 3262 } |
3254 } | 3263 } |
3255 | 3264 |
(...skipping 17 matching lines...) Expand all Loading... | |
3273 // Examples of new expression: | 3282 // Examples of new expression: |
3274 // new foo.bar().baz means (new (foo.bar)()).baz | 3283 // new foo.bar().baz means (new (foo.bar)()).baz |
3275 // new foo()() means (new foo())() | 3284 // new foo()() means (new foo())() |
3276 // new new foo()() means (new (new foo())()) | 3285 // new new foo()() means (new (new foo())()) |
3277 // new new foo means new (new foo) | 3286 // new new foo means new (new foo) |
3278 // new new foo() means new (new foo()) | 3287 // new new foo() means new (new foo()) |
3279 // new new foo().bar().baz means (new (new foo()).bar()).baz | 3288 // new new foo().bar().baz means (new (new foo()).bar()).baz |
3280 | 3289 |
3281 if (peek() == Token::NEW) { | 3290 if (peek() == Token::NEW) { |
3282 BindingPatternUnexpectedToken(classifier); | 3291 BindingPatternUnexpectedToken(classifier); |
3292 ArrowFormalParametersUnexpectedToken(classifier); | |
3283 Consume(Token::NEW); | 3293 Consume(Token::NEW); |
3284 int new_pos = position(); | 3294 int new_pos = position(); |
3285 ExpressionT result = this->EmptyExpression(); | 3295 ExpressionT result = this->EmptyExpression(); |
3286 if (peek() == Token::SUPER) { | 3296 if (peek() == Token::SUPER) { |
3287 const bool is_new = true; | 3297 const bool is_new = true; |
3288 result = ParseSuperExpression(is_new, classifier, CHECK_OK); | 3298 result = ParseSuperExpression(is_new, classifier, CHECK_OK); |
3289 } else if (allow_harmony_new_target() && peek() == Token::PERIOD) { | 3299 } else if (allow_harmony_new_target() && peek() == Token::PERIOD) { |
3290 return ParseNewTargetExpression(CHECK_OK); | 3300 return ParseNewTargetExpression(CHECK_OK); |
3291 } else { | 3301 } else { |
3292 result = this->ParseMemberWithNewPrefixesExpression(classifier, CHECK_OK); | 3302 result = this->ParseMemberWithNewPrefixesExpression(classifier, CHECK_OK); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3326 // ('[' Expression ']' | '.' Identifier | Arguments | TemplateLiteral)* | 3336 // ('[' Expression ']' | '.' Identifier | Arguments | TemplateLiteral)* |
3327 | 3337 |
3328 // The '[' Expression ']' and '.' Identifier parts are parsed by | 3338 // The '[' Expression ']' and '.' Identifier parts are parsed by |
3329 // ParseMemberExpressionContinuation, and the Arguments part is parsed by the | 3339 // ParseMemberExpressionContinuation, and the Arguments part is parsed by the |
3330 // caller. | 3340 // caller. |
3331 | 3341 |
3332 // Parse the initial primary or function expression. | 3342 // Parse the initial primary or function expression. |
3333 ExpressionT result = this->EmptyExpression(); | 3343 ExpressionT result = this->EmptyExpression(); |
3334 if (peek() == Token::FUNCTION) { | 3344 if (peek() == Token::FUNCTION) { |
3335 BindingPatternUnexpectedToken(classifier); | 3345 BindingPatternUnexpectedToken(classifier); |
3346 ArrowFormalParametersUnexpectedToken(classifier); | |
3336 | 3347 |
3337 Consume(Token::FUNCTION); | 3348 Consume(Token::FUNCTION); |
3338 int function_token_position = position(); | 3349 int function_token_position = position(); |
3339 bool is_generator = Check(Token::MUL); | 3350 bool is_generator = Check(Token::MUL); |
3340 IdentifierT name = this->EmptyIdentifier(); | 3351 IdentifierT name = this->EmptyIdentifier(); |
3341 bool is_strict_reserved_name = false; | 3352 bool is_strict_reserved_name = false; |
3342 Scanner::Location function_name_location = Scanner::Location::invalid(); | 3353 Scanner::Location function_name_location = Scanner::Location::invalid(); |
3343 FunctionLiteral::FunctionType function_type = | 3354 FunctionLiteral::FunctionType function_type = |
3344 FunctionLiteral::ANONYMOUS_EXPRESSION; | 3355 FunctionLiteral::ANONYMOUS_EXPRESSION; |
3345 if (peek_any_identifier()) { | 3356 if (peek_any_identifier()) { |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3569 template <class Traits> | 3580 template <class Traits> |
3570 typename ParserBase<Traits>::ExpressionT | 3581 typename ParserBase<Traits>::ExpressionT |
3571 ParserBase<Traits>::ParseMemberExpressionContinuation( | 3582 ParserBase<Traits>::ParseMemberExpressionContinuation( |
3572 ExpressionT expression, ExpressionClassifier* classifier, bool* ok) { | 3583 ExpressionT expression, ExpressionClassifier* classifier, bool* ok) { |
3573 // Parses this part of MemberExpression: | 3584 // Parses this part of MemberExpression: |
3574 // ('[' Expression ']' | '.' Identifier | TemplateLiteral)* | 3585 // ('[' Expression ']' | '.' Identifier | TemplateLiteral)* |
3575 while (true) { | 3586 while (true) { |
3576 switch (peek()) { | 3587 switch (peek()) { |
3577 case Token::LBRACK: { | 3588 case Token::LBRACK: { |
3578 BindingPatternUnexpectedToken(classifier); | 3589 BindingPatternUnexpectedToken(classifier); |
3590 ArrowFormalParametersUnexpectedToken(classifier); | |
3579 | 3591 |
3580 Consume(Token::LBRACK); | 3592 Consume(Token::LBRACK); |
3581 int pos = position(); | 3593 int pos = position(); |
3582 ExpressionT index = this->ParseExpression(true, classifier, CHECK_OK); | 3594 ExpressionT index = this->ParseExpression(true, classifier, CHECK_OK); |
3583 expression = factory()->NewProperty(expression, index, pos); | 3595 expression = factory()->NewProperty(expression, index, pos); |
3584 if (fni_ != NULL) { | 3596 if (fni_ != NULL) { |
3585 this->PushPropertyName(fni_, index); | 3597 this->PushPropertyName(fni_, index); |
3586 } | 3598 } |
3587 Expect(Token::RBRACK, CHECK_OK); | 3599 Expect(Token::RBRACK, CHECK_OK); |
3588 break; | 3600 break; |
3589 } | 3601 } |
3590 case Token::PERIOD: { | 3602 case Token::PERIOD: { |
3591 BindingPatternUnexpectedToken(classifier); | 3603 BindingPatternUnexpectedToken(classifier); |
3604 ArrowFormalParametersUnexpectedToken(classifier); | |
caitp (gmail)
2015/08/20 15:22:57
probably want to make sure destructuring still wor
wingo
2015/08/20 15:47:57
Thanks for having a look!
I'm pretty sure that de
| |
3592 | 3605 |
3593 Consume(Token::PERIOD); | 3606 Consume(Token::PERIOD); |
3594 int pos = position(); | 3607 int pos = position(); |
3595 IdentifierT name = ParseIdentifierName(CHECK_OK); | 3608 IdentifierT name = ParseIdentifierName(CHECK_OK); |
3596 expression = factory()->NewProperty( | 3609 expression = factory()->NewProperty( |
3597 expression, factory()->NewStringLiteral(name, pos), pos); | 3610 expression, factory()->NewStringLiteral(name, pos), pos); |
3598 if (fni_ != NULL) { | 3611 if (fni_ != NULL) { |
3599 this->PushLiteralName(fni_, name); | 3612 this->PushLiteralName(fni_, name); |
3600 } | 3613 } |
3601 break; | 3614 break; |
3602 } | 3615 } |
3603 case Token::TEMPLATE_SPAN: | 3616 case Token::TEMPLATE_SPAN: |
3604 case Token::TEMPLATE_TAIL: { | 3617 case Token::TEMPLATE_TAIL: { |
3605 BindingPatternUnexpectedToken(classifier); | 3618 BindingPatternUnexpectedToken(classifier); |
3619 ArrowFormalParametersUnexpectedToken(classifier); | |
3606 int pos; | 3620 int pos; |
3607 if (scanner()->current_token() == Token::IDENTIFIER) { | 3621 if (scanner()->current_token() == Token::IDENTIFIER) { |
3608 pos = position(); | 3622 pos = position(); |
3609 } else { | 3623 } else { |
3610 pos = peek_position(); | 3624 pos = peek_position(); |
3611 if (expression->IsFunctionLiteral() && mode() == PARSE_EAGERLY) { | 3625 if (expression->IsFunctionLiteral() && mode() == PARSE_EAGERLY) { |
3612 // If the tag function looks like an IIFE, set_parenthesized() to | 3626 // If the tag function looks like an IIFE, set_parenthesized() to |
3613 // force eager compilation. | 3627 // force eager compilation. |
3614 expression->AsFunctionLiteral()->set_should_eager_compile(); | 3628 expression->AsFunctionLiteral()->set_should_eager_compile(); |
3615 } | 3629 } |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4046 *ok = false; | 4060 *ok = false; |
4047 return; | 4061 return; |
4048 } | 4062 } |
4049 has_seen_constructor_ = true; | 4063 has_seen_constructor_ = true; |
4050 return; | 4064 return; |
4051 } | 4065 } |
4052 } | 4066 } |
4053 } } // v8::internal | 4067 } } // v8::internal |
4054 | 4068 |
4055 #endif // V8_PREPARSER_H | 4069 #endif // V8_PREPARSER_H |
OLD | NEW |