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/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
(...skipping 2921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2932 bool* ok) { | 2932 bool* ok) { |
2933 // ConditionalExpression :: | 2933 // ConditionalExpression :: |
2934 // LogicalOrExpression | 2934 // LogicalOrExpression |
2935 // LogicalOrExpression '?' AssignmentExpression ':' AssignmentExpression | 2935 // LogicalOrExpression '?' AssignmentExpression ':' AssignmentExpression |
2936 | 2936 |
2937 int pos = peek_position(); | 2937 int pos = peek_position(); |
2938 // We start using the binary expression parser for prec >= 4 only! | 2938 // We start using the binary expression parser for prec >= 4 only! |
2939 ExpressionT expression = | 2939 ExpressionT expression = |
2940 this->ParseBinaryExpression(4, accept_IN, classifier, CHECK_OK); | 2940 this->ParseBinaryExpression(4, accept_IN, classifier, CHECK_OK); |
2941 if (peek() != Token::CONDITIONAL) return expression; | 2941 if (peek() != Token::CONDITIONAL) return expression; |
| 2942 ArrowFormalParametersUnexpectedToken(classifier); |
2942 BindingPatternUnexpectedToken(classifier); | 2943 BindingPatternUnexpectedToken(classifier); |
2943 Consume(Token::CONDITIONAL); | 2944 Consume(Token::CONDITIONAL); |
2944 // In parsing the first assignment expression in conditional | 2945 // In parsing the first assignment expression in conditional |
2945 // expressions we always accept the 'in' keyword; see ECMA-262, | 2946 // expressions we always accept the 'in' keyword; see ECMA-262, |
2946 // section 11.12, page 58. | 2947 // section 11.12, page 58. |
2947 ExpressionT left = ParseAssignmentExpression(true, classifier, CHECK_OK); | 2948 ExpressionT left = ParseAssignmentExpression(true, classifier, CHECK_OK); |
2948 Expect(Token::COLON, CHECK_OK); | 2949 Expect(Token::COLON, CHECK_OK); |
2949 ExpressionT right = | 2950 ExpressionT right = |
2950 ParseAssignmentExpression(accept_IN, classifier, CHECK_OK); | 2951 ParseAssignmentExpression(accept_IN, classifier, CHECK_OK); |
2951 return factory()->NewConditional(expression, left, right, pos); | 2952 return factory()->NewConditional(expression, left, right, pos); |
2952 } | 2953 } |
2953 | 2954 |
2954 | 2955 |
2955 // Precedence >= 4 | 2956 // Precedence >= 4 |
2956 template <class Traits> | 2957 template <class Traits> |
2957 typename ParserBase<Traits>::ExpressionT | 2958 typename ParserBase<Traits>::ExpressionT |
2958 ParserBase<Traits>::ParseBinaryExpression(int prec, bool accept_IN, | 2959 ParserBase<Traits>::ParseBinaryExpression(int prec, bool accept_IN, |
2959 ExpressionClassifier* classifier, | 2960 ExpressionClassifier* classifier, |
2960 bool* ok) { | 2961 bool* ok) { |
2961 DCHECK(prec >= 4); | 2962 DCHECK(prec >= 4); |
2962 ExpressionT x = this->ParseUnaryExpression(classifier, CHECK_OK); | 2963 ExpressionT x = this->ParseUnaryExpression(classifier, CHECK_OK); |
2963 for (int prec1 = Precedence(peek(), accept_IN); prec1 >= prec; prec1--) { | 2964 for (int prec1 = Precedence(peek(), accept_IN); prec1 >= prec; prec1--) { |
2964 // prec1 >= 4 | 2965 // prec1 >= 4 |
2965 while (Precedence(peek(), accept_IN) == prec1) { | 2966 while (Precedence(peek(), accept_IN) == prec1) { |
2966 BindingPatternUnexpectedToken(classifier); | 2967 BindingPatternUnexpectedToken(classifier); |
| 2968 ArrowFormalParametersUnexpectedToken(classifier); |
2967 Token::Value op = Next(); | 2969 Token::Value op = Next(); |
2968 Scanner::Location op_location = scanner()->location(); | 2970 Scanner::Location op_location = scanner()->location(); |
2969 int pos = position(); | 2971 int pos = position(); |
2970 ExpressionT y = | 2972 ExpressionT y = |
2971 ParseBinaryExpression(prec1 + 1, accept_IN, classifier, CHECK_OK); | 2973 ParseBinaryExpression(prec1 + 1, accept_IN, classifier, CHECK_OK); |
2972 | 2974 |
2973 if (this->ShortcutNumericLiteralBinaryExpression(&x, y, op, pos, | 2975 if (this->ShortcutNumericLiteralBinaryExpression(&x, y, op, pos, |
2974 factory())) { | 2976 factory())) { |
2975 continue; | 2977 continue; |
2976 } | 2978 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3019 // '++' UnaryExpression | 3021 // '++' UnaryExpression |
3020 // '--' UnaryExpression | 3022 // '--' UnaryExpression |
3021 // '+' UnaryExpression | 3023 // '+' UnaryExpression |
3022 // '-' UnaryExpression | 3024 // '-' UnaryExpression |
3023 // '~' UnaryExpression | 3025 // '~' UnaryExpression |
3024 // '!' UnaryExpression | 3026 // '!' UnaryExpression |
3025 | 3027 |
3026 Token::Value op = peek(); | 3028 Token::Value op = peek(); |
3027 if (Token::IsUnaryOp(op)) { | 3029 if (Token::IsUnaryOp(op)) { |
3028 BindingPatternUnexpectedToken(classifier); | 3030 BindingPatternUnexpectedToken(classifier); |
| 3031 ArrowFormalParametersUnexpectedToken(classifier); |
3029 | 3032 |
3030 op = Next(); | 3033 op = Next(); |
3031 int pos = position(); | 3034 int pos = position(); |
3032 ExpressionT expression = ParseUnaryExpression(classifier, CHECK_OK); | 3035 ExpressionT expression = ParseUnaryExpression(classifier, CHECK_OK); |
3033 | 3036 |
3034 if (op == Token::DELETE && is_strict(language_mode())) { | 3037 if (op == Token::DELETE && is_strict(language_mode())) { |
3035 if (is_strong(language_mode())) { | 3038 if (is_strong(language_mode())) { |
3036 ReportMessage(MessageTemplate::kStrongDelete); | 3039 ReportMessage(MessageTemplate::kStrongDelete); |
3037 *ok = false; | 3040 *ok = false; |
3038 return this->EmptyExpression(); | 3041 return this->EmptyExpression(); |
3039 } else if (this->IsIdentifier(expression)) { | 3042 } else if (this->IsIdentifier(expression)) { |
3040 // "delete identifier" is a syntax error in strict mode. | 3043 // "delete identifier" is a syntax error in strict mode. |
3041 ReportMessage(MessageTemplate::kStrictDelete); | 3044 ReportMessage(MessageTemplate::kStrictDelete); |
3042 *ok = false; | 3045 *ok = false; |
3043 return this->EmptyExpression(); | 3046 return this->EmptyExpression(); |
3044 } | 3047 } |
3045 } | 3048 } |
3046 | 3049 |
3047 // Allow Traits do rewrite the expression. | 3050 // Allow Traits do rewrite the expression. |
3048 return this->BuildUnaryExpression(expression, op, pos, factory()); | 3051 return this->BuildUnaryExpression(expression, op, pos, factory()); |
3049 } else if (Token::IsCountOp(op)) { | 3052 } else if (Token::IsCountOp(op)) { |
3050 BindingPatternUnexpectedToken(classifier); | 3053 BindingPatternUnexpectedToken(classifier); |
| 3054 ArrowFormalParametersUnexpectedToken(classifier); |
3051 op = Next(); | 3055 op = Next(); |
3052 Scanner::Location lhs_location = scanner()->peek_location(); | 3056 Scanner::Location lhs_location = scanner()->peek_location(); |
3053 ExpressionT expression = this->ParseUnaryExpression(classifier, CHECK_OK); | 3057 ExpressionT expression = this->ParseUnaryExpression(classifier, CHECK_OK); |
3054 expression = this->CheckAndRewriteReferenceExpression( | 3058 expression = this->CheckAndRewriteReferenceExpression( |
3055 expression, lhs_location, MessageTemplate::kInvalidLhsInPrefixOp, | 3059 expression, lhs_location, MessageTemplate::kInvalidLhsInPrefixOp, |
3056 CHECK_OK); | 3060 CHECK_OK); |
3057 this->MarkExpressionAsAssigned(expression); | 3061 this->MarkExpressionAsAssigned(expression); |
3058 | 3062 |
3059 return factory()->NewCountOperation(op, | 3063 return factory()->NewCountOperation(op, |
3060 true /* prefix */, | 3064 true /* prefix */, |
(...skipping 12 matching lines...) Expand all Loading... |
3073 bool* ok) { | 3077 bool* ok) { |
3074 // PostfixExpression :: | 3078 // PostfixExpression :: |
3075 // LeftHandSideExpression ('++' | '--')? | 3079 // LeftHandSideExpression ('++' | '--')? |
3076 | 3080 |
3077 Scanner::Location lhs_location = scanner()->peek_location(); | 3081 Scanner::Location lhs_location = scanner()->peek_location(); |
3078 ExpressionT expression = | 3082 ExpressionT expression = |
3079 this->ParseLeftHandSideExpression(classifier, CHECK_OK); | 3083 this->ParseLeftHandSideExpression(classifier, CHECK_OK); |
3080 if (!scanner()->HasAnyLineTerminatorBeforeNext() && | 3084 if (!scanner()->HasAnyLineTerminatorBeforeNext() && |
3081 Token::IsCountOp(peek())) { | 3085 Token::IsCountOp(peek())) { |
3082 BindingPatternUnexpectedToken(classifier); | 3086 BindingPatternUnexpectedToken(classifier); |
| 3087 ArrowFormalParametersUnexpectedToken(classifier); |
3083 | 3088 |
3084 expression = this->CheckAndRewriteReferenceExpression( | 3089 expression = this->CheckAndRewriteReferenceExpression( |
3085 expression, lhs_location, MessageTemplate::kInvalidLhsInPostfixOp, | 3090 expression, lhs_location, MessageTemplate::kInvalidLhsInPostfixOp, |
3086 CHECK_OK); | 3091 CHECK_OK); |
3087 expression = this->MarkExpressionAsAssigned(expression); | 3092 expression = this->MarkExpressionAsAssigned(expression); |
3088 | 3093 |
3089 Token::Value next = Next(); | 3094 Token::Value next = Next(); |
3090 expression = | 3095 expression = |
3091 factory()->NewCountOperation(next, | 3096 factory()->NewCountOperation(next, |
3092 false /* postfix */, | 3097 false /* postfix */, |
(...skipping 11 matching lines...) Expand all Loading... |
3104 // LeftHandSideExpression :: | 3109 // LeftHandSideExpression :: |
3105 // (NewExpression | MemberExpression) ... | 3110 // (NewExpression | MemberExpression) ... |
3106 | 3111 |
3107 ExpressionT result = | 3112 ExpressionT result = |
3108 this->ParseMemberWithNewPrefixesExpression(classifier, CHECK_OK); | 3113 this->ParseMemberWithNewPrefixesExpression(classifier, CHECK_OK); |
3109 | 3114 |
3110 while (true) { | 3115 while (true) { |
3111 switch (peek()) { | 3116 switch (peek()) { |
3112 case Token::LBRACK: { | 3117 case Token::LBRACK: { |
3113 BindingPatternUnexpectedToken(classifier); | 3118 BindingPatternUnexpectedToken(classifier); |
| 3119 ArrowFormalParametersUnexpectedToken(classifier); |
3114 Consume(Token::LBRACK); | 3120 Consume(Token::LBRACK); |
3115 int pos = position(); | 3121 int pos = position(); |
3116 ExpressionT index = ParseExpression(true, classifier, CHECK_OK); | 3122 ExpressionT index = ParseExpression(true, classifier, CHECK_OK); |
3117 result = factory()->NewProperty(result, index, pos); | 3123 result = factory()->NewProperty(result, index, pos); |
3118 Expect(Token::RBRACK, CHECK_OK); | 3124 Expect(Token::RBRACK, CHECK_OK); |
3119 break; | 3125 break; |
3120 } | 3126 } |
3121 | 3127 |
3122 case Token::LPAREN: { | 3128 case Token::LPAREN: { |
3123 BindingPatternUnexpectedToken(classifier); | 3129 BindingPatternUnexpectedToken(classifier); |
| 3130 ArrowFormalParametersUnexpectedToken(classifier); |
3124 | 3131 |
3125 if (is_strong(language_mode()) && this->IsIdentifier(result) && | 3132 if (is_strong(language_mode()) && this->IsIdentifier(result) && |
3126 this->IsEval(this->AsIdentifier(result))) { | 3133 this->IsEval(this->AsIdentifier(result))) { |
3127 ReportMessage(MessageTemplate::kStrongDirectEval); | 3134 ReportMessage(MessageTemplate::kStrongDirectEval); |
3128 *ok = false; | 3135 *ok = false; |
3129 return this->EmptyExpression(); | 3136 return this->EmptyExpression(); |
3130 } | 3137 } |
3131 int pos; | 3138 int pos; |
3132 if (scanner()->current_token() == Token::IDENTIFIER) { | 3139 if (scanner()->current_token() == Token::IDENTIFIER) { |
3133 // For call of an identifier we want to report position of | 3140 // For call of an identifier we want to report position of |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3165 result = Traits::SpreadCall(result, args, pos); | 3172 result = Traits::SpreadCall(result, args, pos); |
3166 } else { | 3173 } else { |
3167 result = factory()->NewCall(result, args, pos); | 3174 result = factory()->NewCall(result, args, pos); |
3168 } | 3175 } |
3169 if (fni_ != NULL) fni_->RemoveLastFunction(); | 3176 if (fni_ != NULL) fni_->RemoveLastFunction(); |
3170 break; | 3177 break; |
3171 } | 3178 } |
3172 | 3179 |
3173 case Token::PERIOD: { | 3180 case Token::PERIOD: { |
3174 BindingPatternUnexpectedToken(classifier); | 3181 BindingPatternUnexpectedToken(classifier); |
| 3182 ArrowFormalParametersUnexpectedToken(classifier); |
3175 Consume(Token::PERIOD); | 3183 Consume(Token::PERIOD); |
3176 int pos = position(); | 3184 int pos = position(); |
3177 IdentifierT name = ParseIdentifierName(CHECK_OK); | 3185 IdentifierT name = ParseIdentifierName(CHECK_OK); |
3178 result = factory()->NewProperty( | 3186 result = factory()->NewProperty( |
3179 result, factory()->NewStringLiteral(name, pos), pos); | 3187 result, factory()->NewStringLiteral(name, pos), pos); |
3180 if (fni_ != NULL) this->PushLiteralName(fni_, name); | 3188 if (fni_ != NULL) this->PushLiteralName(fni_, name); |
3181 break; | 3189 break; |
3182 } | 3190 } |
3183 | 3191 |
3184 case Token::TEMPLATE_SPAN: | 3192 case Token::TEMPLATE_SPAN: |
3185 case Token::TEMPLATE_TAIL: { | 3193 case Token::TEMPLATE_TAIL: { |
3186 BindingPatternUnexpectedToken(classifier); | 3194 BindingPatternUnexpectedToken(classifier); |
| 3195 ArrowFormalParametersUnexpectedToken(classifier); |
3187 result = ParseTemplateLiteral(result, position(), classifier, CHECK_OK); | 3196 result = ParseTemplateLiteral(result, position(), classifier, CHECK_OK); |
3188 break; | 3197 break; |
3189 } | 3198 } |
3190 | 3199 |
3191 default: | 3200 default: |
3192 return result; | 3201 return result; |
3193 } | 3202 } |
3194 } | 3203 } |
3195 } | 3204 } |
3196 | 3205 |
(...skipping 17 matching lines...) Expand all Loading... |
3214 // Examples of new expression: | 3223 // Examples of new expression: |
3215 // new foo.bar().baz means (new (foo.bar)()).baz | 3224 // new foo.bar().baz means (new (foo.bar)()).baz |
3216 // new foo()() means (new foo())() | 3225 // new foo()() means (new foo())() |
3217 // new new foo()() means (new (new foo())()) | 3226 // new new foo()() means (new (new foo())()) |
3218 // new new foo means new (new foo) | 3227 // new new foo means new (new foo) |
3219 // new new foo() means new (new foo()) | 3228 // new new foo() means new (new foo()) |
3220 // new new foo().bar().baz means (new (new foo()).bar()).baz | 3229 // new new foo().bar().baz means (new (new foo()).bar()).baz |
3221 | 3230 |
3222 if (peek() == Token::NEW) { | 3231 if (peek() == Token::NEW) { |
3223 BindingPatternUnexpectedToken(classifier); | 3232 BindingPatternUnexpectedToken(classifier); |
| 3233 ArrowFormalParametersUnexpectedToken(classifier); |
3224 Consume(Token::NEW); | 3234 Consume(Token::NEW); |
3225 int new_pos = position(); | 3235 int new_pos = position(); |
3226 ExpressionT result = this->EmptyExpression(); | 3236 ExpressionT result = this->EmptyExpression(); |
3227 if (peek() == Token::SUPER) { | 3237 if (peek() == Token::SUPER) { |
3228 const bool is_new = true; | 3238 const bool is_new = true; |
3229 result = ParseSuperExpression(is_new, classifier, CHECK_OK); | 3239 result = ParseSuperExpression(is_new, classifier, CHECK_OK); |
3230 } else if (allow_harmony_new_target() && peek() == Token::PERIOD) { | 3240 } else if (allow_harmony_new_target() && peek() == Token::PERIOD) { |
3231 return ParseNewTargetExpression(CHECK_OK); | 3241 return ParseNewTargetExpression(CHECK_OK); |
3232 } else { | 3242 } else { |
3233 result = this->ParseMemberWithNewPrefixesExpression(classifier, CHECK_OK); | 3243 result = this->ParseMemberWithNewPrefixesExpression(classifier, CHECK_OK); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3267 // ('[' Expression ']' | '.' Identifier | Arguments | TemplateLiteral)* | 3277 // ('[' Expression ']' | '.' Identifier | Arguments | TemplateLiteral)* |
3268 | 3278 |
3269 // The '[' Expression ']' and '.' Identifier parts are parsed by | 3279 // The '[' Expression ']' and '.' Identifier parts are parsed by |
3270 // ParseMemberExpressionContinuation, and the Arguments part is parsed by the | 3280 // ParseMemberExpressionContinuation, and the Arguments part is parsed by the |
3271 // caller. | 3281 // caller. |
3272 | 3282 |
3273 // Parse the initial primary or function expression. | 3283 // Parse the initial primary or function expression. |
3274 ExpressionT result = this->EmptyExpression(); | 3284 ExpressionT result = this->EmptyExpression(); |
3275 if (peek() == Token::FUNCTION) { | 3285 if (peek() == Token::FUNCTION) { |
3276 BindingPatternUnexpectedToken(classifier); | 3286 BindingPatternUnexpectedToken(classifier); |
| 3287 ArrowFormalParametersUnexpectedToken(classifier); |
3277 | 3288 |
3278 Consume(Token::FUNCTION); | 3289 Consume(Token::FUNCTION); |
3279 int function_token_position = position(); | 3290 int function_token_position = position(); |
3280 bool is_generator = Check(Token::MUL); | 3291 bool is_generator = Check(Token::MUL); |
3281 IdentifierT name = this->EmptyIdentifier(); | 3292 IdentifierT name = this->EmptyIdentifier(); |
3282 bool is_strict_reserved_name = false; | 3293 bool is_strict_reserved_name = false; |
3283 Scanner::Location function_name_location = Scanner::Location::invalid(); | 3294 Scanner::Location function_name_location = Scanner::Location::invalid(); |
3284 FunctionLiteral::FunctionType function_type = | 3295 FunctionLiteral::FunctionType function_type = |
3285 FunctionLiteral::ANONYMOUS_EXPRESSION; | 3296 FunctionLiteral::ANONYMOUS_EXPRESSION; |
3286 if (peek_any_identifier()) { | 3297 if (peek_any_identifier()) { |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3516 template <class Traits> | 3527 template <class Traits> |
3517 typename ParserBase<Traits>::ExpressionT | 3528 typename ParserBase<Traits>::ExpressionT |
3518 ParserBase<Traits>::ParseMemberExpressionContinuation( | 3529 ParserBase<Traits>::ParseMemberExpressionContinuation( |
3519 ExpressionT expression, ExpressionClassifier* classifier, bool* ok) { | 3530 ExpressionT expression, ExpressionClassifier* classifier, bool* ok) { |
3520 // Parses this part of MemberExpression: | 3531 // Parses this part of MemberExpression: |
3521 // ('[' Expression ']' | '.' Identifier | TemplateLiteral)* | 3532 // ('[' Expression ']' | '.' Identifier | TemplateLiteral)* |
3522 while (true) { | 3533 while (true) { |
3523 switch (peek()) { | 3534 switch (peek()) { |
3524 case Token::LBRACK: { | 3535 case Token::LBRACK: { |
3525 BindingPatternUnexpectedToken(classifier); | 3536 BindingPatternUnexpectedToken(classifier); |
| 3537 ArrowFormalParametersUnexpectedToken(classifier); |
3526 | 3538 |
3527 Consume(Token::LBRACK); | 3539 Consume(Token::LBRACK); |
3528 int pos = position(); | 3540 int pos = position(); |
3529 ExpressionT index = this->ParseExpression(true, classifier, CHECK_OK); | 3541 ExpressionT index = this->ParseExpression(true, classifier, CHECK_OK); |
3530 expression = factory()->NewProperty(expression, index, pos); | 3542 expression = factory()->NewProperty(expression, index, pos); |
3531 if (fni_ != NULL) { | 3543 if (fni_ != NULL) { |
3532 this->PushPropertyName(fni_, index); | 3544 this->PushPropertyName(fni_, index); |
3533 } | 3545 } |
3534 Expect(Token::RBRACK, CHECK_OK); | 3546 Expect(Token::RBRACK, CHECK_OK); |
3535 break; | 3547 break; |
3536 } | 3548 } |
3537 case Token::PERIOD: { | 3549 case Token::PERIOD: { |
3538 BindingPatternUnexpectedToken(classifier); | 3550 BindingPatternUnexpectedToken(classifier); |
| 3551 ArrowFormalParametersUnexpectedToken(classifier); |
3539 | 3552 |
3540 Consume(Token::PERIOD); | 3553 Consume(Token::PERIOD); |
3541 int pos = position(); | 3554 int pos = position(); |
3542 IdentifierT name = ParseIdentifierName(CHECK_OK); | 3555 IdentifierT name = ParseIdentifierName(CHECK_OK); |
3543 expression = factory()->NewProperty( | 3556 expression = factory()->NewProperty( |
3544 expression, factory()->NewStringLiteral(name, pos), pos); | 3557 expression, factory()->NewStringLiteral(name, pos), pos); |
3545 if (fni_ != NULL) { | 3558 if (fni_ != NULL) { |
3546 this->PushLiteralName(fni_, name); | 3559 this->PushLiteralName(fni_, name); |
3547 } | 3560 } |
3548 break; | 3561 break; |
3549 } | 3562 } |
3550 case Token::TEMPLATE_SPAN: | 3563 case Token::TEMPLATE_SPAN: |
3551 case Token::TEMPLATE_TAIL: { | 3564 case Token::TEMPLATE_TAIL: { |
3552 BindingPatternUnexpectedToken(classifier); | 3565 BindingPatternUnexpectedToken(classifier); |
| 3566 ArrowFormalParametersUnexpectedToken(classifier); |
3553 int pos; | 3567 int pos; |
3554 if (scanner()->current_token() == Token::IDENTIFIER) { | 3568 if (scanner()->current_token() == Token::IDENTIFIER) { |
3555 pos = position(); | 3569 pos = position(); |
3556 } else { | 3570 } else { |
3557 pos = peek_position(); | 3571 pos = peek_position(); |
3558 if (expression->IsFunctionLiteral() && mode() == PARSE_EAGERLY) { | 3572 if (expression->IsFunctionLiteral() && mode() == PARSE_EAGERLY) { |
3559 // If the tag function looks like an IIFE, set_parenthesized() to | 3573 // If the tag function looks like an IIFE, set_parenthesized() to |
3560 // force eager compilation. | 3574 // force eager compilation. |
3561 expression->AsFunctionLiteral()->set_should_eager_compile(); | 3575 expression->AsFunctionLiteral()->set_should_eager_compile(); |
3562 } | 3576 } |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3970 *ok = false; | 3984 *ok = false; |
3971 return; | 3985 return; |
3972 } | 3986 } |
3973 has_seen_constructor_ = true; | 3987 has_seen_constructor_ = true; |
3974 return; | 3988 return; |
3975 } | 3989 } |
3976 } | 3990 } |
3977 } } // v8::internal | 3991 } } // v8::internal |
3978 | 3992 |
3979 #endif // V8_PREPARSER_H | 3993 #endif // V8_PREPARSER_H |
OLD | NEW |