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 3992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4003 } | 4003 } |
4004 | 4004 |
4005 Expression* extends = NULL; | 4005 Expression* extends = NULL; |
4006 if (Check(Token::EXTENDS)) { | 4006 if (Check(Token::EXTENDS)) { |
4007 block_scope->set_start_position(scanner()->location().end_pos); | 4007 block_scope->set_start_position(scanner()->location().end_pos); |
4008 extends = ParseLeftHandSideExpression(CHECK_OK); | 4008 extends = ParseLeftHandSideExpression(CHECK_OK); |
4009 } else { | 4009 } else { |
4010 block_scope->set_start_position(scanner()->location().end_pos); | 4010 block_scope->set_start_position(scanner()->location().end_pos); |
4011 } | 4011 } |
4012 | 4012 |
| 4013 |
| 4014 ClassLiteralChecker checker(this); |
4013 ZoneList<ObjectLiteral::Property*>* properties = NewPropertyList(4, zone()); | 4015 ZoneList<ObjectLiteral::Property*>* properties = NewPropertyList(4, zone()); |
4014 FunctionLiteral* constructor = NULL; | 4016 FunctionLiteral* constructor = NULL; |
4015 bool has_seen_constructor = false; | 4017 bool has_seen_constructor = false; |
4016 | 4018 |
4017 Expect(Token::LBRACE, CHECK_OK); | 4019 Expect(Token::LBRACE, CHECK_OK); |
4018 while (peek() != Token::RBRACE) { | 4020 while (peek() != Token::RBRACE) { |
4019 if (Check(Token::SEMICOLON)) continue; | 4021 if (Check(Token::SEMICOLON)) continue; |
4020 if (fni_ != NULL) fni_->Enter(); | 4022 if (fni_ != NULL) fni_->Enter(); |
4021 const bool in_class = true; | 4023 const bool in_class = true; |
4022 const bool is_static = false; | 4024 const bool is_static = false; |
4023 bool is_computed_name = false; // Classes do not care about computed | 4025 bool is_computed_name = false; // Classes do not care about computed |
4024 // property names here. | 4026 // property names here. |
4025 ObjectLiteral::Property* property = | 4027 ObjectLiteral::Property* property = ParsePropertyDefinition( |
4026 ParsePropertyDefinition(NULL, in_class, is_static, &is_computed_name, | 4028 &checker, in_class, is_static, &is_computed_name, &has_seen_constructor, |
4027 &has_seen_constructor, CHECK_OK); | 4029 CHECK_OK); |
4028 | 4030 |
4029 if (has_seen_constructor && constructor == NULL) { | 4031 if (has_seen_constructor && constructor == NULL) { |
4030 constructor = GetPropertyValue(property)->AsFunctionLiteral(); | 4032 constructor = GetPropertyValue(property)->AsFunctionLiteral(); |
4031 DCHECK_NOT_NULL(constructor); | 4033 DCHECK_NOT_NULL(constructor); |
4032 } else { | 4034 } else { |
4033 properties->Add(property, zone()); | 4035 properties->Add(property, zone()); |
4034 } | 4036 } |
4035 | 4037 |
4036 if (fni_ != NULL) { | 4038 if (fni_ != NULL) { |
4037 fni_->Infer(); | 4039 fni_->Infer(); |
(...skipping 1307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5345 } else { | 5347 } else { |
5346 const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data()); | 5348 const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data()); |
5347 running_hash = StringHasher::ComputeRunningHash(running_hash, data, | 5349 running_hash = StringHasher::ComputeRunningHash(running_hash, data, |
5348 raw_string->length()); | 5350 raw_string->length()); |
5349 } | 5351 } |
5350 } | 5352 } |
5351 | 5353 |
5352 return running_hash; | 5354 return running_hash; |
5353 } | 5355 } |
5354 } } // namespace v8::internal | 5356 } } // namespace v8::internal |
OLD | NEW |