| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/parser.h" | 5 #include "vm/parser.h" |
| 6 | 6 |
| 7 #include "lib/invocation_mirror.h" | 7 #include "lib/invocation_mirror.h" |
| 8 #include "platform/utils.h" | 8 #include "platform/utils.h" |
| 9 #include "vm/ast_transformer.h" | 9 #include "vm/ast_transformer.h" |
| 10 #include "vm/bootstrap.h" | 10 #include "vm/bootstrap.h" |
| (...skipping 4140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4151 current_member_ = NULL; | 4151 current_member_ = NULL; |
| 4152 CheckMemberNameConflict(members, &member); | 4152 CheckMemberNameConflict(members, &member); |
| 4153 members->AddMember(member); | 4153 members->AddMember(member); |
| 4154 } | 4154 } |
| 4155 | 4155 |
| 4156 | 4156 |
| 4157 void Parser::ParseEnumDeclaration(const GrowableObjectArray& pending_classes, | 4157 void Parser::ParseEnumDeclaration(const GrowableObjectArray& pending_classes, |
| 4158 const Class& toplevel_class, | 4158 const Class& toplevel_class, |
| 4159 intptr_t metadata_pos) { | 4159 intptr_t metadata_pos) { |
| 4160 TRACE_PARSER("ParseEnumDeclaration"); | 4160 TRACE_PARSER("ParseEnumDeclaration"); |
| 4161 const intptr_t declaration_pos = (metadata_pos > 0) ? metadata_pos |
| 4162 : TokenPos(); |
| 4161 ConsumeToken(); | 4163 ConsumeToken(); |
| 4162 const intptr_t enum_pos = TokenPos(); | 4164 const intptr_t name_pos = TokenPos(); |
| 4163 String* enum_name = | 4165 String* enum_name = |
| 4164 ExpectUserDefinedTypeIdentifier("enum type name expected"); | 4166 ExpectUserDefinedTypeIdentifier("enum type name expected"); |
| 4165 if (FLAG_trace_parser) { | 4167 if (FLAG_trace_parser) { |
| 4166 OS::Print("TopLevel parsing enum '%s'\n", enum_name->ToCString()); | 4168 OS::Print("TopLevel parsing enum '%s'\n", enum_name->ToCString()); |
| 4167 } | 4169 } |
| 4168 ExpectToken(Token::kLBRACE); | 4170 ExpectToken(Token::kLBRACE); |
| 4169 if (!IsIdentifier()) { | 4171 if (!IsIdentifier()) { |
| 4170 ReportError("Enumeration must have at least one name"); | 4172 ReportError("Enumeration must have at least one name"); |
| 4171 } | 4173 } |
| 4172 while (IsIdentifier()) { | 4174 while (IsIdentifier()) { |
| 4173 ConsumeToken(); | 4175 ConsumeToken(); |
| 4174 if (CurrentToken() == Token::kCOMMA) { | 4176 if (CurrentToken() == Token::kCOMMA) { |
| 4175 ConsumeToken(); | 4177 ConsumeToken(); |
| 4176 if (CurrentToken() == Token::kRBRACE) { | 4178 if (CurrentToken() == Token::kRBRACE) { |
| 4177 break; | 4179 break; |
| 4178 } | 4180 } |
| 4179 } else if (CurrentToken() == Token::kRBRACE) { | 4181 } else if (CurrentToken() == Token::kRBRACE) { |
| 4180 break; | 4182 break; |
| 4181 } else { | 4183 } else { |
| 4182 ReportError(", or } expected"); | 4184 ReportError(", or } expected"); |
| 4183 } | 4185 } |
| 4184 } | 4186 } |
| 4185 ExpectToken(Token::kRBRACE); | 4187 ExpectToken(Token::kRBRACE); |
| 4186 | 4188 |
| 4187 Object& obj = Object::Handle(Z, library_.LookupLocalObject(*enum_name)); | 4189 Object& obj = Object::Handle(Z, library_.LookupLocalObject(*enum_name)); |
| 4188 if (!obj.IsNull()) { | 4190 if (!obj.IsNull()) { |
| 4189 ReportError(enum_pos, "'%s' is already defined", enum_name->ToCString()); | 4191 ReportError(name_pos, "'%s' is already defined", enum_name->ToCString()); |
| 4190 } | 4192 } |
| 4191 Class& cls = Class::Handle(Z); | 4193 Class& cls = Class::Handle(Z); |
| 4192 cls = Class::New(*enum_name, script_, enum_pos); | 4194 cls = Class::New(*enum_name, script_, declaration_pos); |
| 4193 cls.set_library(library_); | 4195 cls.set_library(library_); |
| 4194 library_.AddClass(cls); | 4196 library_.AddClass(cls); |
| 4195 cls.set_is_synthesized_class(); | 4197 cls.set_is_synthesized_class(); |
| 4196 cls.set_is_enum_class(); | 4198 cls.set_is_enum_class(); |
| 4197 if (metadata_pos >= 0) { | 4199 if (metadata_pos >= 0) { |
| 4198 library_.AddClassMetadata(cls, toplevel_class, metadata_pos); | 4200 library_.AddClassMetadata(cls, toplevel_class, metadata_pos); |
| 4199 } | 4201 } |
| 4200 cls.set_super_type(Type::Handle(Z, Type::ObjectType())); | 4202 cls.set_super_type(Type::Handle(Z, Type::ObjectType())); |
| 4201 pending_classes.Add(cls, Heap::kOld); | 4203 pending_classes.Add(cls, Heap::kOld); |
| 4202 } | 4204 } |
| 4203 | 4205 |
| 4204 | 4206 |
| 4205 void Parser::ParseClassDeclaration(const GrowableObjectArray& pending_classes, | 4207 void Parser::ParseClassDeclaration(const GrowableObjectArray& pending_classes, |
| 4206 const Class& toplevel_class, | 4208 const Class& toplevel_class, |
| 4207 intptr_t metadata_pos) { | 4209 intptr_t metadata_pos) { |
| 4208 TRACE_PARSER("ParseClassDeclaration"); | 4210 TRACE_PARSER("ParseClassDeclaration"); |
| 4209 bool is_patch = false; | 4211 bool is_patch = false; |
| 4210 bool is_abstract = false; | 4212 bool is_abstract = false; |
| 4213 intptr_t declaration_pos = (metadata_pos > 0) ? metadata_pos : TokenPos(); |
| 4211 if (is_patch_source() && | 4214 if (is_patch_source() && |
| 4212 (CurrentToken() == Token::kIDENT) && | 4215 (CurrentToken() == Token::kIDENT) && |
| 4213 CurrentLiteral()->Equals("patch")) { | 4216 CurrentLiteral()->Equals("patch")) { |
| 4214 ConsumeToken(); | 4217 ConsumeToken(); |
| 4215 is_patch = true; | 4218 is_patch = true; |
| 4216 } else if (CurrentToken() == Token::kABSTRACT) { | 4219 } else if (CurrentToken() == Token::kABSTRACT) { |
| 4217 is_abstract = true; | 4220 is_abstract = true; |
| 4218 ConsumeToken(); | 4221 ConsumeToken(); |
| 4219 } | 4222 } |
| 4220 ExpectToken(Token::kCLASS); | 4223 ExpectToken(Token::kCLASS); |
| 4221 const intptr_t classname_pos = TokenPos(); | 4224 const intptr_t classname_pos = TokenPos(); |
| 4222 String& class_name = *ExpectUserDefinedTypeIdentifier("class name expected"); | 4225 String& class_name = *ExpectUserDefinedTypeIdentifier("class name expected"); |
| 4223 if (FLAG_trace_parser) { | 4226 if (FLAG_trace_parser) { |
| 4224 OS::Print("TopLevel parsing class '%s'\n", class_name.ToCString()); | 4227 OS::Print("TopLevel parsing class '%s'\n", class_name.ToCString()); |
| 4225 } | 4228 } |
| 4226 Class& cls = Class::Handle(Z); | 4229 Class& cls = Class::Handle(Z); |
| 4227 TypeArguments& orig_type_parameters = TypeArguments::Handle(Z); | 4230 TypeArguments& orig_type_parameters = TypeArguments::Handle(Z); |
| 4228 Object& obj = Object::Handle(Z, library_.LookupLocalObject(class_name)); | 4231 Object& obj = Object::Handle(Z, library_.LookupLocalObject(class_name)); |
| 4229 if (obj.IsNull()) { | 4232 if (obj.IsNull()) { |
| 4230 if (is_patch) { | 4233 if (is_patch) { |
| 4231 ReportError(classname_pos, "missing class '%s' cannot be patched", | 4234 ReportError(classname_pos, "missing class '%s' cannot be patched", |
| 4232 class_name.ToCString()); | 4235 class_name.ToCString()); |
| 4233 } | 4236 } |
| 4234 cls = Class::New(class_name, script_, classname_pos); | 4237 cls = Class::New(class_name, script_, declaration_pos); |
| 4235 library_.AddClass(cls); | 4238 library_.AddClass(cls); |
| 4236 } else { | 4239 } else { |
| 4237 if (!obj.IsClass()) { | 4240 if (!obj.IsClass()) { |
| 4238 ReportError(classname_pos, "'%s' is already defined", | 4241 ReportError(classname_pos, "'%s' is already defined", |
| 4239 class_name.ToCString()); | 4242 class_name.ToCString()); |
| 4240 } | 4243 } |
| 4241 cls ^= obj.raw(); | 4244 cls ^= obj.raw(); |
| 4242 if (is_patch) { | 4245 if (is_patch) { |
| 4243 // Preserve and reuse the original type parameters and bounds since the | 4246 // Preserve and reuse the original type parameters and bounds since the |
| 4244 // ones defined in the patch class will not be finalized. | 4247 // ones defined in the patch class will not be finalized. |
| 4245 orig_type_parameters = cls.type_parameters(); | 4248 orig_type_parameters = cls.type_parameters(); |
| 4246 // A patch class must be given the same name as the class it is patching, | 4249 // A patch class must be given the same name as the class it is patching, |
| 4247 // otherwise the generic signature classes it defines will not match the | 4250 // otherwise the generic signature classes it defines will not match the |
| 4248 // patched generic signature classes. Therefore, new signature classes | 4251 // patched generic signature classes. Therefore, new signature classes |
| 4249 // will be introduced and the original ones will not get finalized. | 4252 // will be introduced and the original ones will not get finalized. |
| 4250 cls = Class::New(class_name, script_, classname_pos); | 4253 cls = Class::New(class_name, script_, declaration_pos); |
| 4251 cls.set_library(library_); | 4254 cls.set_library(library_); |
| 4252 } else { | 4255 } else { |
| 4253 // Not patching a class, but it has been found. This must be one of the | 4256 // Not patching a class, but it has been found. This must be one of the |
| 4254 // pre-registered classes from object.cc or a duplicate definition. | 4257 // pre-registered classes from object.cc or a duplicate definition. |
| 4255 if (!(cls.is_prefinalized() || | 4258 if (!(cls.is_prefinalized() || |
| 4256 RawObject::IsImplicitFieldClassId(cls.id()))) { | 4259 RawObject::IsImplicitFieldClassId(cls.id()))) { |
| 4257 ReportError(classname_pos, "class '%s' is already defined", | 4260 ReportError(classname_pos, "class '%s' is already defined", |
| 4258 class_name.ToCString()); | 4261 class_name.ToCString()); |
| 4259 } | 4262 } |
| 4260 // Pre-registered classes need their scripts connected at this time. | 4263 // Pre-registered classes need their scripts connected at this time. |
| 4261 cls.set_script(script_); | 4264 cls.set_script(script_); |
| 4262 cls.set_token_pos(classname_pos); | 4265 cls.set_token_pos(declaration_pos); |
| 4263 } | 4266 } |
| 4264 } | 4267 } |
| 4265 ASSERT(!cls.IsNull()); | 4268 ASSERT(!cls.IsNull()); |
| 4266 ASSERT(cls.functions() == Object::empty_array().raw()); | 4269 ASSERT(cls.functions() == Object::empty_array().raw()); |
| 4267 set_current_class(cls); | 4270 set_current_class(cls); |
| 4268 ParseTypeParameters(cls); | 4271 ParseTypeParameters(cls); |
| 4269 if (is_patch) { | 4272 if (is_patch) { |
| 4270 // Check that the new type parameters are identical to the original ones. | 4273 // Check that the new type parameters are identical to the original ones. |
| 4271 const TypeArguments& new_type_parameters = | 4274 const TypeArguments& new_type_parameters = |
| 4272 TypeArguments::Handle(Z, cls.type_parameters()); | 4275 TypeArguments::Handle(Z, cls.type_parameters()); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4392 } | 4395 } |
| 4393 } | 4396 } |
| 4394 | 4397 |
| 4395 | 4398 |
| 4396 void Parser::ParseClassDefinition(const Class& cls) { | 4399 void Parser::ParseClassDefinition(const Class& cls) { |
| 4397 TRACE_PARSER("ParseClassDefinition"); | 4400 TRACE_PARSER("ParseClassDefinition"); |
| 4398 CompilerStats::num_classes_compiled++; | 4401 CompilerStats::num_classes_compiled++; |
| 4399 set_current_class(cls); | 4402 set_current_class(cls); |
| 4400 is_top_level_ = true; | 4403 is_top_level_ = true; |
| 4401 String& class_name = String::Handle(Z, cls.Name()); | 4404 String& class_name = String::Handle(Z, cls.Name()); |
| 4405 SkipMetadata(); |
| 4406 if (is_patch_source() && |
| 4407 (CurrentToken() == Token::kIDENT) && |
| 4408 CurrentLiteral()->Equals("patch")) { |
| 4409 ConsumeToken(); |
| 4410 } else if (CurrentToken() == Token::kABSTRACT) { |
| 4411 ConsumeToken(); |
| 4412 } |
| 4413 ExpectToken(Token::kCLASS); |
| 4402 const intptr_t class_pos = TokenPos(); | 4414 const intptr_t class_pos = TokenPos(); |
| 4403 ClassDesc members(cls, class_name, false, class_pos); | 4415 ClassDesc members(cls, class_name, false, class_pos); |
| 4404 while (CurrentToken() != Token::kLBRACE) { | 4416 while (CurrentToken() != Token::kLBRACE) { |
| 4405 ConsumeToken(); | 4417 ConsumeToken(); |
| 4406 } | 4418 } |
| 4407 ExpectToken(Token::kLBRACE); | 4419 ExpectToken(Token::kLBRACE); |
| 4408 while (CurrentToken() != Token::kRBRACE) { | 4420 while (CurrentToken() != Token::kRBRACE) { |
| 4409 intptr_t metadata_pos = SkipMetadata(); | 4421 intptr_t metadata_pos = SkipMetadata(); |
| 4410 ParseClassMemberDefinition(&members, metadata_pos); | 4422 ParseClassMemberDefinition(&members, metadata_pos); |
| 4411 } | 4423 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 4441 Report::LongJumpF(error, script_, class_pos, "applying patch failed"); | 4453 Report::LongJumpF(error, script_, class_pos, "applying patch failed"); |
| 4442 } | 4454 } |
| 4443 } | 4455 } |
| 4444 } | 4456 } |
| 4445 | 4457 |
| 4446 | 4458 |
| 4447 void Parser::ParseEnumDefinition(const Class& cls) { | 4459 void Parser::ParseEnumDefinition(const Class& cls) { |
| 4448 TRACE_PARSER("ParseEnumDefinition"); | 4460 TRACE_PARSER("ParseEnumDefinition"); |
| 4449 CompilerStats::num_classes_compiled++; | 4461 CompilerStats::num_classes_compiled++; |
| 4450 | 4462 |
| 4463 SkipMetadata(); |
| 4464 ExpectToken(Token::kENUM); |
| 4465 |
| 4451 const String& enum_name = String::Handle(Z, cls.Name()); | 4466 const String& enum_name = String::Handle(Z, cls.Name()); |
| 4452 ClassDesc enum_members(cls, enum_name, false, cls.token_pos()); | 4467 ClassDesc enum_members(cls, enum_name, false, cls.token_pos()); |
| 4453 | 4468 |
| 4454 // Add instance field 'final int index'. | 4469 // Add instance field 'final int index'. |
| 4455 Field& index_field = Field::ZoneHandle(Z); | 4470 Field& index_field = Field::ZoneHandle(Z); |
| 4456 const Type& int_type = Type::Handle(Z, Type::IntType()); | 4471 const Type& int_type = Type::Handle(Z, Type::IntType()); |
| 4457 const Type& dynamic_type = Type::Handle(Type::DynamicType()); | 4472 const Type& dynamic_type = Type::Handle(Type::DynamicType()); |
| 4458 index_field = Field::New(Symbols::Index(), | 4473 index_field = Field::New(Symbols::Index(), |
| 4459 false, // Not static. | 4474 false, // Not static. |
| 4460 true, // Field is final. | 4475 true, // Field is final. |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4777 } | 4792 } |
| 4778 SetPosition(saved_pos); | 4793 SetPosition(saved_pos); |
| 4779 return is_mixin_def; | 4794 return is_mixin_def; |
| 4780 } | 4795 } |
| 4781 | 4796 |
| 4782 | 4797 |
| 4783 void Parser::ParseTypedef(const GrowableObjectArray& pending_classes, | 4798 void Parser::ParseTypedef(const GrowableObjectArray& pending_classes, |
| 4784 const Class& toplevel_class, | 4799 const Class& toplevel_class, |
| 4785 intptr_t metadata_pos) { | 4800 intptr_t metadata_pos) { |
| 4786 TRACE_PARSER("ParseTypedef"); | 4801 TRACE_PARSER("ParseTypedef"); |
| 4802 intptr_t declaration_pos = (metadata_pos > 0) ? metadata_pos : TokenPos(); |
| 4787 ExpectToken(Token::kTYPEDEF); | 4803 ExpectToken(Token::kTYPEDEF); |
| 4788 | 4804 |
| 4789 if (IsMixinAppAlias()) { | 4805 if (IsMixinAppAlias()) { |
| 4790 if (FLAG_warn_mixin_typedef) { | 4806 if (FLAG_warn_mixin_typedef) { |
| 4791 ReportWarning(TokenPos(), "deprecated mixin application typedef"); | 4807 ReportWarning(TokenPos(), "deprecated mixin application typedef"); |
| 4792 } | 4808 } |
| 4793 ParseMixinAppAlias(pending_classes, toplevel_class, metadata_pos); | 4809 ParseMixinAppAlias(pending_classes, toplevel_class, metadata_pos); |
| 4794 return; | 4810 return; |
| 4795 } | 4811 } |
| 4796 | 4812 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 4819 } | 4835 } |
| 4820 | 4836 |
| 4821 // Create the function type alias signature class. It will be linked to its | 4837 // Create the function type alias signature class. It will be linked to its |
| 4822 // signature function after it has been parsed. The type parameters, in order | 4838 // signature function after it has been parsed. The type parameters, in order |
| 4823 // to be properly finalized, need to be associated to this signature class as | 4839 // to be properly finalized, need to be associated to this signature class as |
| 4824 // they are parsed. | 4840 // they are parsed. |
| 4825 const Class& function_type_alias = Class::Handle(Z, | 4841 const Class& function_type_alias = Class::Handle(Z, |
| 4826 Class::NewSignatureClass(*alias_name, | 4842 Class::NewSignatureClass(*alias_name, |
| 4827 Function::Handle(Z), | 4843 Function::Handle(Z), |
| 4828 script_, | 4844 script_, |
| 4829 alias_name_pos)); | 4845 declaration_pos)); |
| 4830 library_.AddClass(function_type_alias); | 4846 library_.AddClass(function_type_alias); |
| 4831 set_current_class(function_type_alias); | 4847 set_current_class(function_type_alias); |
| 4832 // Parse the type parameters of the function type. | 4848 // Parse the type parameters of the function type. |
| 4833 ParseTypeParameters(function_type_alias); | 4849 ParseTypeParameters(function_type_alias); |
| 4834 // At this point, the type parameters have been parsed, so we can resolve the | 4850 // At this point, the type parameters have been parsed, so we can resolve the |
| 4835 // result type. | 4851 // result type. |
| 4836 if (!result_type.IsNull()) { | 4852 if (!result_type.IsNull()) { |
| 4837 ResolveTypeFromClass(function_type_alias, | 4853 ResolveTypeFromClass(function_type_alias, |
| 4838 ClassFinalizer::kResolveTypeParameters, | 4854 ClassFinalizer::kResolveTypeParameters, |
| 4839 &result_type); | 4855 &result_type); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4986 GrowableObjectArray::Handle(Z, GrowableObjectArray::New()); | 5002 GrowableObjectArray::Handle(Z, GrowableObjectArray::New()); |
| 4987 intptr_t index = 0; | 5003 intptr_t index = 0; |
| 4988 TypeParameter& type_parameter = TypeParameter::Handle(Z); | 5004 TypeParameter& type_parameter = TypeParameter::Handle(Z); |
| 4989 TypeParameter& existing_type_parameter = TypeParameter::Handle(Z); | 5005 TypeParameter& existing_type_parameter = TypeParameter::Handle(Z); |
| 4990 String& existing_type_parameter_name = String::Handle(Z); | 5006 String& existing_type_parameter_name = String::Handle(Z); |
| 4991 AbstractType& type_parameter_bound = Type::Handle(Z); | 5007 AbstractType& type_parameter_bound = Type::Handle(Z); |
| 4992 do { | 5008 do { |
| 4993 ConsumeToken(); | 5009 ConsumeToken(); |
| 4994 const intptr_t metadata_pos = SkipMetadata(); | 5010 const intptr_t metadata_pos = SkipMetadata(); |
| 4995 const intptr_t type_parameter_pos = TokenPos(); | 5011 const intptr_t type_parameter_pos = TokenPos(); |
| 5012 const intptr_t declaration_pos = (metadata_pos > 0) ? metadata_pos |
| 5013 : type_parameter_pos; |
| 4996 String& type_parameter_name = | 5014 String& type_parameter_name = |
| 4997 *ExpectUserDefinedTypeIdentifier("type parameter expected"); | 5015 *ExpectUserDefinedTypeIdentifier("type parameter expected"); |
| 4998 // Check for duplicate type parameters. | 5016 // Check for duplicate type parameters. |
| 4999 for (intptr_t i = 0; i < index; i++) { | 5017 for (intptr_t i = 0; i < index; i++) { |
| 5000 existing_type_parameter ^= type_parameters_array.At(i); | 5018 existing_type_parameter ^= type_parameters_array.At(i); |
| 5001 existing_type_parameter_name = existing_type_parameter.name(); | 5019 existing_type_parameter_name = existing_type_parameter.name(); |
| 5002 if (existing_type_parameter_name.Equals(type_parameter_name)) { | 5020 if (existing_type_parameter_name.Equals(type_parameter_name)) { |
| 5003 ReportError(type_parameter_pos, "duplicate type parameter '%s'", | 5021 ReportError(type_parameter_pos, "duplicate type parameter '%s'", |
| 5004 type_parameter_name.ToCString()); | 5022 type_parameter_name.ToCString()); |
| 5005 } | 5023 } |
| 5006 } | 5024 } |
| 5007 if (CurrentToken() == Token::kEXTENDS) { | 5025 if (CurrentToken() == Token::kEXTENDS) { |
| 5008 ConsumeToken(); | 5026 ConsumeToken(); |
| 5009 // A bound may refer to the owner of the type parameter it applies to, | 5027 // A bound may refer to the owner of the type parameter it applies to, |
| 5010 // i.e. to the class or interface currently being parsed. | 5028 // i.e. to the class or interface currently being parsed. |
| 5011 // Postpone resolution in order to avoid resolving the class and its | 5029 // Postpone resolution in order to avoid resolving the class and its |
| 5012 // type parameters, as they are not fully parsed yet. | 5030 // type parameters, as they are not fully parsed yet. |
| 5013 type_parameter_bound = ParseType(ClassFinalizer::kDoNotResolve); | 5031 type_parameter_bound = ParseType(ClassFinalizer::kDoNotResolve); |
| 5014 } else { | 5032 } else { |
| 5015 type_parameter_bound = I->object_store()->object_type(); | 5033 type_parameter_bound = I->object_store()->object_type(); |
| 5016 } | 5034 } |
| 5017 type_parameter = TypeParameter::New(cls, | 5035 type_parameter = TypeParameter::New(cls, |
| 5018 index, | 5036 index, |
| 5019 type_parameter_name, | 5037 type_parameter_name, |
| 5020 type_parameter_bound, | 5038 type_parameter_bound, |
| 5021 type_parameter_pos); | 5039 declaration_pos); |
| 5022 type_parameters_array.Add(type_parameter); | 5040 type_parameters_array.Add(type_parameter); |
| 5023 if (metadata_pos >= 0) { | 5041 if (metadata_pos >= 0) { |
| 5024 library_.AddTypeParameterMetadata(type_parameter, metadata_pos); | 5042 library_.AddTypeParameterMetadata(type_parameter, metadata_pos); |
| 5025 } | 5043 } |
| 5026 index++; | 5044 index++; |
| 5027 } while (CurrentToken() == Token::kCOMMA); | 5045 } while (CurrentToken() == Token::kCOMMA); |
| 5028 Token::Kind token = CurrentToken(); | 5046 Token::Kind token = CurrentToken(); |
| 5029 if ((token == Token::kGT) || (token == Token::kSHR)) { | 5047 if ((token == Token::kGT) || (token == Token::kSHR)) { |
| 5030 ConsumeRightAngleBracket(); | 5048 ConsumeRightAngleBracket(); |
| 5031 } else { | 5049 } else { |
| (...skipping 7515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12547 void Parser::SkipQualIdent() { | 12565 void Parser::SkipQualIdent() { |
| 12548 ASSERT(IsIdentifier()); | 12566 ASSERT(IsIdentifier()); |
| 12549 ConsumeToken(); | 12567 ConsumeToken(); |
| 12550 if (CurrentToken() == Token::kPERIOD) { | 12568 if (CurrentToken() == Token::kPERIOD) { |
| 12551 ConsumeToken(); // Consume the kPERIOD token. | 12569 ConsumeToken(); // Consume the kPERIOD token. |
| 12552 ExpectIdentifier("identifier expected after '.'"); | 12570 ExpectIdentifier("identifier expected after '.'"); |
| 12553 } | 12571 } |
| 12554 } | 12572 } |
| 12555 | 12573 |
| 12556 } // namespace dart | 12574 } // namespace dart |
| OLD | NEW |