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 2094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2105 | 2105 |
2106 // TODO(1231235): We try to estimate the set of properties set by | 2106 // TODO(1231235): We try to estimate the set of properties set by |
2107 // constructors. We define a new property whenever there is an | 2107 // constructors. We define a new property whenever there is an |
2108 // assignment to a property of 'this'. We should probably only add | 2108 // assignment to a property of 'this'. We should probably only add |
2109 // properties if we haven't seen them before. Otherwise we'll | 2109 // properties if we haven't seen them before. Otherwise we'll |
2110 // probably overestimate the number of properties. | 2110 // probably overestimate the number of properties. |
2111 if (op == Token::ASSIGN && this->IsThisProperty(expression)) { | 2111 if (op == Token::ASSIGN && this->IsThisProperty(expression)) { |
2112 function_state_->AddProperty(); | 2112 function_state_->AddProperty(); |
2113 } | 2113 } |
2114 | 2114 |
| 2115 if (op != Token::ASSIGN && is_pattern_element) { |
| 2116 classifier->RecordAssignmentPatternError( |
| 2117 Scanner::Location(lhs_beg_pos, scanner()->location().end_pos), |
| 2118 MessageTemplate::kInvalidDestructuringTarget); |
| 2119 } |
| 2120 |
2115 this->CheckAssigningFunctionLiteralToProperty(expression, right); | 2121 this->CheckAssigningFunctionLiteralToProperty(expression, right); |
2116 | 2122 |
2117 if (fni_ != NULL) { | 2123 if (fni_ != NULL) { |
2118 // Check if the right hand side is a call to avoid inferring a | 2124 // Check if the right hand side is a call to avoid inferring a |
2119 // name if we're dealing with "a = function(){...}();"-like | 2125 // name if we're dealing with "a = function(){...}();"-like |
2120 // expression. | 2126 // expression. |
2121 if ((op == Token::INIT || op == Token::ASSIGN) && | 2127 if ((op == Token::INIT || op == Token::ASSIGN) && |
2122 (!right->IsCall() && !right->IsCallNew())) { | 2128 (!right->IsCall() && !right->IsCallNew())) { |
2123 fni_->Infer(); | 2129 fni_->Infer(); |
2124 } else { | 2130 } else { |
(...skipping 1225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3350 return; | 3356 return; |
3351 } | 3357 } |
3352 has_seen_constructor_ = true; | 3358 has_seen_constructor_ = true; |
3353 return; | 3359 return; |
3354 } | 3360 } |
3355 } | 3361 } |
3356 } // namespace internal | 3362 } // namespace internal |
3357 } // namespace v8 | 3363 } // namespace v8 |
3358 | 3364 |
3359 #endif // V8_PARSING_PARSER_BASE_H | 3365 #endif // V8_PARSING_PARSER_BASE_H |
OLD | NEW |