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 3913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3924 const bool in_class = true; | 3924 const bool in_class = true; |
3925 const bool is_static = false; | 3925 const bool is_static = false; |
3926 bool is_computed_name = false; // Classes do not care about computed | 3926 bool is_computed_name = false; // Classes do not care about computed |
3927 // property names here. | 3927 // property names here. |
3928 ObjectLiteral::Property* property = | 3928 ObjectLiteral::Property* property = |
3929 ParsePropertyDefinition(NULL, in_class, is_static, &is_computed_name, | 3929 ParsePropertyDefinition(NULL, in_class, is_static, &is_computed_name, |
3930 &has_seen_constructor, CHECK_OK); | 3930 &has_seen_constructor, CHECK_OK); |
3931 | 3931 |
3932 if (has_seen_constructor && constructor == NULL) { | 3932 if (has_seen_constructor && constructor == NULL) { |
3933 constructor = GetPropertyValue(property)->AsFunctionLiteral(); | 3933 constructor = GetPropertyValue(property)->AsFunctionLiteral(); |
3934 DCHECK_NOT_NULL(constructor); | 3934 DCHECK(constructor); |
3935 } else { | 3935 } else { |
3936 properties->Add(property, zone()); | 3936 properties->Add(property, zone()); |
3937 } | 3937 } |
3938 | 3938 |
3939 if (fni_ != NULL) { | 3939 if (fni_ != NULL) { |
3940 fni_->Infer(); | 3940 fni_->Infer(); |
3941 fni_->Leave(); | 3941 fni_->Leave(); |
3942 } | 3942 } |
3943 } | 3943 } |
3944 | 3944 |
3945 Expect(Token::RBRACE, CHECK_OK); | 3945 Expect(Token::RBRACE, CHECK_OK); |
3946 int end_pos = scanner()->location().end_pos; | 3946 int end_pos = scanner()->location().end_pos; |
3947 | 3947 |
3948 if (constructor == NULL) { | 3948 if (constructor == NULL) { |
3949 constructor = | 3949 constructor = |
3950 DefaultConstructor(extends != NULL, block_scope, pos, end_pos); | 3950 DefaultConstructor(extends != NULL, block_scope, pos, end_pos); |
3951 } | 3951 } |
3952 | 3952 |
3953 block_scope->set_end_position(end_pos); | 3953 block_scope->set_end_position(end_pos); |
3954 block_scope = block_scope->FinalizeBlockScope(); | 3954 block_scope = block_scope->FinalizeBlockScope(); |
3955 | 3955 |
3956 if (name != NULL) { | 3956 if (name != NULL) { |
3957 DCHECK_NOT_NULL(proxy); | 3957 DCHECK(proxy); |
3958 DCHECK_NOT_NULL(block_scope); | 3958 DCHECK(block_scope); |
3959 proxy->var()->set_initializer_position(end_pos); | 3959 proxy->var()->set_initializer_position(end_pos); |
3960 } | 3960 } |
3961 | 3961 |
3962 return factory()->NewClassLiteral(name, block_scope, proxy, extends, | 3962 return factory()->NewClassLiteral(name, block_scope, proxy, extends, |
3963 constructor, properties, pos, end_pos); | 3963 constructor, properties, pos, end_pos); |
3964 } | 3964 } |
3965 | 3965 |
3966 | 3966 |
3967 Expression* Parser::ParseV8Intrinsic(bool* ok) { | 3967 Expression* Parser::ParseV8Intrinsic(bool* ok) { |
3968 // CallRuntime :: | 3968 // CallRuntime :: |
(...skipping 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5248 } else { | 5248 } else { |
5249 const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data()); | 5249 const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data()); |
5250 running_hash = StringHasher::ComputeRunningHash(running_hash, data, | 5250 running_hash = StringHasher::ComputeRunningHash(running_hash, data, |
5251 raw_string->length()); | 5251 raw_string->length()); |
5252 } | 5252 } |
5253 } | 5253 } |
5254 | 5254 |
5255 return running_hash; | 5255 return running_hash; |
5256 } | 5256 } |
5257 } } // namespace v8::internal | 5257 } } // namespace v8::internal |
OLD | NEW |