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/parsing/parser.h" | 5 #include "src/parsing/parser.h" |
6 | 6 |
7 #include "src/api.h" | 7 #include "src/api.h" |
8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
9 #include "src/ast/ast-expression-rewriter.h" | 9 #include "src/ast/ast-expression-rewriter.h" |
10 #include "src/ast/ast-expression-visitor.h" | 10 #include "src/ast/ast-expression-visitor.h" |
(...skipping 4660 matching lines...) Loading... |
4671 Expect(Token::LBRACE, CHECK_OK); | 4671 Expect(Token::LBRACE, CHECK_OK); |
4672 | 4672 |
4673 const bool has_extends = extends != nullptr; | 4673 const bool has_extends = extends != nullptr; |
4674 while (peek() != Token::RBRACE) { | 4674 while (peek() != Token::RBRACE) { |
4675 if (Check(Token::SEMICOLON)) continue; | 4675 if (Check(Token::SEMICOLON)) continue; |
4676 FuncNameInferrer::State fni_state(fni_); | 4676 FuncNameInferrer::State fni_state(fni_); |
4677 const bool in_class = true; | 4677 const bool in_class = true; |
4678 const bool is_static = false; | 4678 const bool is_static = false; |
4679 bool is_computed_name = false; // Classes do not care about computed | 4679 bool is_computed_name = false; // Classes do not care about computed |
4680 // property names here. | 4680 // property names here. |
4681 ExpressionClassifier classifier(this); | 4681 ExpressionClassifier property_classifier(this); |
4682 const AstRawString* property_name = nullptr; | 4682 const AstRawString* property_name = nullptr; |
4683 ObjectLiteral::Property* property = ParsePropertyDefinition( | 4683 ObjectLiteral::Property* property = ParsePropertyDefinition( |
4684 &checker, in_class, has_extends, is_static, &is_computed_name, | 4684 &checker, in_class, has_extends, is_static, &is_computed_name, |
4685 &has_seen_constructor, &classifier, &property_name, CHECK_OK); | 4685 &has_seen_constructor, &property_classifier, &property_name, CHECK_OK); |
4686 RewriteNonPattern(&classifier, CHECK_OK); | 4686 RewriteNonPattern(&property_classifier, CHECK_OK); |
| 4687 if (classifier != nullptr) { |
| 4688 classifier->Accumulate(&property_classifier, |
| 4689 ExpressionClassifier::ExpressionProductions); |
| 4690 } |
4687 | 4691 |
4688 if (has_seen_constructor && constructor == NULL) { | 4692 if (has_seen_constructor && constructor == NULL) { |
4689 constructor = GetPropertyValue(property)->AsFunctionLiteral(); | 4693 constructor = GetPropertyValue(property)->AsFunctionLiteral(); |
4690 DCHECK_NOT_NULL(constructor); | 4694 DCHECK_NOT_NULL(constructor); |
4691 constructor->set_raw_name( | 4695 constructor->set_raw_name( |
4692 name != nullptr ? name : ast_value_factory()->empty_string()); | 4696 name != nullptr ? name : ast_value_factory()->empty_string()); |
4693 } else { | 4697 } else { |
4694 properties->Add(property, zone()); | 4698 properties->Add(property, zone()); |
4695 } | 4699 } |
4696 | 4700 |
(...skipping 2116 matching lines...) Loading... |
6813 try_block, target); | 6817 try_block, target); |
6814 final_loop = target; | 6818 final_loop = target; |
6815 } | 6819 } |
6816 | 6820 |
6817 return final_loop; | 6821 return final_loop; |
6818 } | 6822 } |
6819 | 6823 |
6820 | 6824 |
6821 } // namespace internal | 6825 } // namespace internal |
6822 } // namespace v8 | 6826 } // namespace v8 |
OLD | NEW |