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 4100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4111 block_scope->set_start_position(scanner()->location().end_pos); | 4111 block_scope->set_start_position(scanner()->location().end_pos); |
4112 } | 4112 } |
4113 | 4113 |
4114 | 4114 |
4115 ClassLiteralChecker checker(this); | 4115 ClassLiteralChecker checker(this); |
4116 ZoneList<ObjectLiteral::Property*>* properties = NewPropertyList(4, zone()); | 4116 ZoneList<ObjectLiteral::Property*>* properties = NewPropertyList(4, zone()); |
4117 FunctionLiteral* constructor = NULL; | 4117 FunctionLiteral* constructor = NULL; |
4118 bool has_seen_constructor = false; | 4118 bool has_seen_constructor = false; |
4119 | 4119 |
4120 Expect(Token::LBRACE, CHECK_OK); | 4120 Expect(Token::LBRACE, CHECK_OK); |
4121 int body_beg_pos = scanner()->location().beg_pos; | |
4122 | 4121 |
4123 const bool has_extends = extends != nullptr; | 4122 const bool has_extends = extends != nullptr; |
4124 while (peek() != Token::RBRACE) { | 4123 while (peek() != Token::RBRACE) { |
4125 if (Check(Token::SEMICOLON)) continue; | 4124 if (Check(Token::SEMICOLON)) continue; |
4126 if (fni_ != NULL) fni_->Enter(); | 4125 if (fni_ != NULL) fni_->Enter(); |
4127 const bool in_class = true; | 4126 const bool in_class = true; |
4128 const bool is_static = false; | 4127 const bool is_static = false; |
4129 bool is_computed_name = false; // Classes do not care about computed | 4128 bool is_computed_name = false; // Classes do not care about computed |
4130 // property names here. | 4129 // property names here. |
4131 ObjectLiteral::Property* property = ParsePropertyDefinition( | 4130 ObjectLiteral::Property* property = ParsePropertyDefinition( |
(...skipping 20 matching lines...) Expand all Loading... |
4152 constructor = | 4151 constructor = |
4153 DefaultConstructor(extends != NULL, block_scope, pos, end_pos); | 4152 DefaultConstructor(extends != NULL, block_scope, pos, end_pos); |
4154 } | 4153 } |
4155 | 4154 |
4156 block_scope->set_end_position(end_pos); | 4155 block_scope->set_end_position(end_pos); |
4157 block_scope = block_scope->FinalizeBlockScope(); | 4156 block_scope = block_scope->FinalizeBlockScope(); |
4158 | 4157 |
4159 if (name != NULL) { | 4158 if (name != NULL) { |
4160 DCHECK_NOT_NULL(proxy); | 4159 DCHECK_NOT_NULL(proxy); |
4161 DCHECK_NOT_NULL(block_scope); | 4160 DCHECK_NOT_NULL(block_scope); |
4162 proxy->var()->set_initializer_position(body_beg_pos); | 4161 proxy->var()->set_initializer_position(end_pos); |
4163 } | 4162 } |
4164 | 4163 |
4165 return factory()->NewClassLiteral(name, block_scope, proxy, extends, | 4164 return factory()->NewClassLiteral(name, block_scope, proxy, extends, |
4166 constructor, properties, pos, end_pos); | 4165 constructor, properties, pos, end_pos); |
4167 } | 4166 } |
4168 | 4167 |
4169 | 4168 |
4170 Expression* Parser::ParseV8Intrinsic(bool* ok) { | 4169 Expression* Parser::ParseV8Intrinsic(bool* ok) { |
4171 // CallRuntime :: | 4170 // CallRuntime :: |
4172 // '%' Identifier Arguments | 4171 // '%' Identifier Arguments |
(...skipping 1267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5440 } else { | 5439 } else { |
5441 const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data()); | 5440 const uc16* data = reinterpret_cast<const uc16*>(raw_string->raw_data()); |
5442 running_hash = StringHasher::ComputeRunningHash(running_hash, data, | 5441 running_hash = StringHasher::ComputeRunningHash(running_hash, data, |
5443 raw_string->length()); | 5442 raw_string->length()); |
5444 } | 5443 } |
5445 } | 5444 } |
5446 | 5445 |
5447 return running_hash; | 5446 return running_hash; |
5448 } | 5447 } |
5449 } } // namespace v8::internal | 5448 } } // namespace v8::internal |
OLD | NEW |