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/ast.h" | 8 #include "src/ast/ast.h" |
9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
(...skipping 3134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3145 // The calls that need special treatment are the | 3145 // The calls that need special treatment are the |
3146 // direct eval calls. These calls are all of the form eval(...), with | 3146 // direct eval calls. These calls are all of the form eval(...), with |
3147 // no explicit receiver. | 3147 // no explicit receiver. |
3148 // These calls are marked as potentially direct eval calls. Whether | 3148 // These calls are marked as potentially direct eval calls. Whether |
3149 // they are actually direct calls to eval is determined at run time. | 3149 // they are actually direct calls to eval is determined at run time. |
3150 Call::PossiblyEval is_possibly_eval = | 3150 Call::PossiblyEval is_possibly_eval = |
3151 CheckPossibleEvalCall(result, scope()); | 3151 CheckPossibleEvalCall(result, scope()); |
3152 | 3152 |
3153 bool is_super_call = result->IsSuperCallReference(); | 3153 bool is_super_call = result->IsSuperCallReference(); |
3154 if (spread_pos.IsValid()) { | 3154 if (spread_pos.IsValid()) { |
3155 args = impl()->PrepareSpreadArguments(args); | |
3156 result = impl()->SpreadCall(result, args, pos); | 3155 result = impl()->SpreadCall(result, args, pos); |
3157 } else { | 3156 } else { |
3158 result = factory()->NewCall(result, args, pos, is_possibly_eval); | 3157 result = factory()->NewCall(result, args, pos, is_possibly_eval); |
3159 } | 3158 } |
3160 | 3159 |
3161 // Explicit calls to the super constructor using super() perform an | 3160 // Explicit calls to the super constructor using super() perform an |
3162 // implicit binding assignment to the 'this' variable. | 3161 // implicit binding assignment to the 'this' variable. |
3163 if (is_super_call) { | 3162 if (is_super_call) { |
3164 result = impl()->RewriteSuperCall(result); | 3163 result = impl()->RewriteSuperCall(result); |
3165 ExpressionT this_expr = impl()->ThisExpression(pos); | 3164 ExpressionT this_expr = impl()->ThisExpression(pos); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3237 } else { | 3236 } else { |
3238 result = ParseMemberWithNewPrefixesExpression(is_async, CHECK_OK); | 3237 result = ParseMemberWithNewPrefixesExpression(is_async, CHECK_OK); |
3239 } | 3238 } |
3240 impl()->RewriteNonPattern(CHECK_OK); | 3239 impl()->RewriteNonPattern(CHECK_OK); |
3241 if (peek() == Token::LPAREN) { | 3240 if (peek() == Token::LPAREN) { |
3242 // NewExpression with arguments. | 3241 // NewExpression with arguments. |
3243 Scanner::Location spread_pos; | 3242 Scanner::Location spread_pos; |
3244 ExpressionListT args = ParseArguments(&spread_pos, CHECK_OK); | 3243 ExpressionListT args = ParseArguments(&spread_pos, CHECK_OK); |
3245 | 3244 |
3246 if (spread_pos.IsValid()) { | 3245 if (spread_pos.IsValid()) { |
3247 args = impl()->PrepareSpreadArguments(args); | |
3248 result = impl()->SpreadCallNew(result, args, new_pos); | 3246 result = impl()->SpreadCallNew(result, args, new_pos); |
3249 } else { | 3247 } else { |
3250 result = factory()->NewCallNew(result, args, new_pos); | 3248 result = factory()->NewCallNew(result, args, new_pos); |
3251 } | 3249 } |
3252 // The expression can still continue with . or [ after the arguments. | 3250 // The expression can still continue with . or [ after the arguments. |
3253 result = ParseMemberExpressionContinuation(result, is_async, CHECK_OK); | 3251 result = ParseMemberExpressionContinuation(result, is_async, CHECK_OK); |
3254 return result; | 3252 return result; |
3255 } | 3253 } |
3256 // NewExpression without arguments. | 3254 // NewExpression without arguments. |
3257 return factory()->NewCallNew(result, impl()->NewExpressionList(0), new_pos); | 3255 return factory()->NewCallNew(result, impl()->NewExpressionList(0), new_pos); |
(...skipping 2239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5497 has_seen_constructor_ = true; | 5495 has_seen_constructor_ = true; |
5498 return; | 5496 return; |
5499 } | 5497 } |
5500 } | 5498 } |
5501 | 5499 |
5502 | 5500 |
5503 } // namespace internal | 5501 } // namespace internal |
5504 } // namespace v8 | 5502 } // namespace v8 |
5505 | 5503 |
5506 #endif // V8_PARSING_PARSER_BASE_H | 5504 #endif // V8_PARSING_PARSER_BASE_H |
OLD | NEW |