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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/api.h" | 7 #include "src/api.h" |
8 #include "src/ast.h" | 8 #include "src/ast.h" |
9 #include "src/bailout-reason.h" | 9 #include "src/bailout-reason.h" |
10 #include "src/base/platform/platform.h" | 10 #include "src/base/platform/platform.h" |
(...skipping 3790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3801 } | 3801 } |
3802 | 3802 |
3803 Expression* extends = NULL; | 3803 Expression* extends = NULL; |
3804 if (Check(Token::EXTENDS)) { | 3804 if (Check(Token::EXTENDS)) { |
3805 block_scope->set_start_position(scanner()->location().end_pos); | 3805 block_scope->set_start_position(scanner()->location().end_pos); |
3806 extends = ParseLeftHandSideExpression(CHECK_OK); | 3806 extends = ParseLeftHandSideExpression(CHECK_OK); |
3807 } else { | 3807 } else { |
3808 block_scope->set_start_position(scanner()->location().end_pos); | 3808 block_scope->set_start_position(scanner()->location().end_pos); |
3809 } | 3809 } |
3810 | 3810 |
| 3811 |
| 3812 ClassLiteralChecker checker(this); |
3811 ZoneList<ObjectLiteral::Property*>* properties = NewPropertyList(4, zone()); | 3813 ZoneList<ObjectLiteral::Property*>* properties = NewPropertyList(4, zone()); |
3812 FunctionLiteral* constructor = NULL; | 3814 FunctionLiteral* constructor = NULL; |
3813 bool has_seen_constructor = false; | 3815 bool has_seen_constructor = false; |
3814 | 3816 |
3815 Expect(Token::LBRACE, CHECK_OK); | 3817 Expect(Token::LBRACE, CHECK_OK); |
3816 while (peek() != Token::RBRACE) { | 3818 while (peek() != Token::RBRACE) { |
3817 if (Check(Token::SEMICOLON)) continue; | 3819 if (Check(Token::SEMICOLON)) continue; |
3818 if (fni_ != NULL) fni_->Enter(); | 3820 if (fni_ != NULL) fni_->Enter(); |
3819 const bool in_class = true; | 3821 const bool in_class = true; |
3820 const bool is_static = false; | 3822 const bool is_static = false; |
3821 bool is_computed_name = false; // Classes do not care about computed | 3823 bool is_computed_name = false; // Classes do not care about computed |
3822 // property names here. | 3824 // property names here. |
3823 ObjectLiteral::Property* property = | 3825 ObjectLiteral::Property* property = ParsePropertyDefinition( |
3824 ParsePropertyDefinition(NULL, in_class, is_static, &is_computed_name, | 3826 &checker, in_class, is_static, &is_computed_name, &has_seen_constructor, |
3825 &has_seen_constructor, CHECK_OK); | 3827 CHECK_OK); |
3826 | 3828 |
3827 if (has_seen_constructor && constructor == NULL) { | 3829 if (has_seen_constructor && constructor == NULL) { |
3828 constructor = GetPropertyValue(property)->AsFunctionLiteral(); | 3830 constructor = GetPropertyValue(property)->AsFunctionLiteral(); |
3829 DCHECK_NOT_NULL(constructor); | 3831 DCHECK_NOT_NULL(constructor); |
3830 } else { | 3832 } else { |
3831 properties->Add(property, zone()); | 3833 properties->Add(property, zone()); |
3832 } | 3834 } |
3833 | 3835 |
3834 if (fni_ != NULL) { | 3836 if (fni_ != NULL) { |
3835 fni_->Infer(); | 3837 fni_->Infer(); |
(...skipping 1307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5143 } else { | 5145 } else { |
5144 const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data()); | 5146 const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data()); |
5145 running_hash = StringHasher::ComputeRunningHash(running_hash, data, | 5147 running_hash = StringHasher::ComputeRunningHash(running_hash, data, |
5146 raw_string->length()); | 5148 raw_string->length()); |
5147 } | 5149 } |
5148 } | 5150 } |
5149 | 5151 |
5150 return running_hash; | 5152 return running_hash; |
5151 } | 5153 } |
5152 } } // namespace v8::internal | 5154 } } // namespace v8::internal |
OLD | NEW |