| 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 "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
| 8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/compiler_stats.h" | 10 #include "vm/compiler_stats.h" |
| (...skipping 2891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2902 unresolved_factory_class.set_factory_signature_class(factory_class); | 2902 unresolved_factory_class.set_factory_signature_class(factory_class); |
| 2903 interface.set_factory_class(unresolved_factory_class); | 2903 interface.set_factory_class(unresolved_factory_class); |
| 2904 // If a type parameter list is included in the default factory clause (it | 2904 // If a type parameter list is included in the default factory clause (it |
| 2905 // can be omitted), verify that it matches the list of type parameters of | 2905 // can be omitted), verify that it matches the list of type parameters of |
| 2906 // the interface in number and names. | 2906 // the interface in number and names. |
| 2907 if (factory_class.NumTypeParameters() > 0) { | 2907 if (factory_class.NumTypeParameters() > 0) { |
| 2908 const TypeArguments& interface_type_parameters = | 2908 const TypeArguments& interface_type_parameters = |
| 2909 TypeArguments::Handle(interface.type_parameters()); | 2909 TypeArguments::Handle(interface.type_parameters()); |
| 2910 const TypeArguments& factory_type_parameters = | 2910 const TypeArguments& factory_type_parameters = |
| 2911 TypeArguments::Handle(factory_class.type_parameters()); | 2911 TypeArguments::Handle(factory_class.type_parameters()); |
| 2912 if (!AbstractTypeArguments::AreEqual(interface_type_parameters, | 2912 if (!TypeArguments::AreIdenticalTypeParameters(interface_type_parameters, |
| 2913 factory_type_parameters)) { | 2913 factory_type_parameters)) { |
| 2914 const String& interface_name = String::Handle(interface.Name()); | 2914 const String& interface_name = String::Handle(interface.Name()); |
| 2915 ErrorMsg(factory_name.ident_pos, | 2915 ErrorMsg(factory_name.ident_pos, |
| 2916 "mismatch in number or names of type parameters between " | 2916 "mismatch in number or names of type parameters between " |
| 2917 "interface '%s' and default factory class '%s'.\n", | 2917 "interface '%s' and default factory class '%s'.\n", |
| 2918 interface_name.ToCString(), | 2918 interface_name.ToCString(), |
| 2919 factory_name.ident->ToCString()); | 2919 factory_name.ident->ToCString()); |
| 2920 } | 2920 } |
| 2921 } | 2921 } |
| 2922 } | 2922 } |
| 2923 | 2923 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3004 GrowableObjectArray::Handle(GrowableObjectArray::New()); | 3004 GrowableObjectArray::Handle(GrowableObjectArray::New()); |
| 3005 intptr_t index = 0; | 3005 intptr_t index = 0; |
| 3006 AbstractType& type_parameter = TypeParameter::Handle(); | 3006 AbstractType& type_parameter = TypeParameter::Handle(); |
| 3007 AbstractType& bound = Type::Handle(); | 3007 AbstractType& bound = Type::Handle(); |
| 3008 do { | 3008 do { |
| 3009 ConsumeToken(); | 3009 ConsumeToken(); |
| 3010 if (CurrentToken() != Token::kIDENT) { | 3010 if (CurrentToken() != Token::kIDENT) { |
| 3011 ErrorMsg("type parameter name expected"); | 3011 ErrorMsg("type parameter name expected"); |
| 3012 } | 3012 } |
| 3013 String& type_parameter_name = *CurrentLiteral(); | 3013 String& type_parameter_name = *CurrentLiteral(); |
| 3014 type_parameter = TypeParameter::New(index, | 3014 type_parameter = TypeParameter::New(cls, |
| 3015 index, |
| 3015 type_parameter_name, | 3016 type_parameter_name, |
| 3016 token_index_); | 3017 token_index_); |
| 3017 ConsumeToken(); | 3018 ConsumeToken(); |
| 3018 bound = Type::DynamicType(); | 3019 bound = Type::DynamicType(); |
| 3019 if (CurrentToken() == Token::kEXTENDS) { | 3020 if (CurrentToken() == Token::kEXTENDS) { |
| 3020 ConsumeToken(); | 3021 ConsumeToken(); |
| 3021 // A bound may refer to the owner of the type parameter it applies to, | 3022 // A bound may refer to the owner of the type parameter it applies to, |
| 3022 // i.e. to the class or interface currently being parsed. | 3023 // i.e. to the class or interface currently being parsed. |
| 3023 // Postpone resolution in order to avoid resolving the class and its | 3024 // Postpone resolution in order to avoid resolving the class and its |
| 3024 // type parameters, as they are not fully parsed yet. | 3025 // type parameters, as they are not fully parsed yet. |
| (...skipping 5233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8258 void Parser::SkipQualIdent() { | 8259 void Parser::SkipQualIdent() { |
| 8259 ASSERT(IsIdentifier()); | 8260 ASSERT(IsIdentifier()); |
| 8260 ConsumeToken(); | 8261 ConsumeToken(); |
| 8261 if (CurrentToken() == Token::kPERIOD) { | 8262 if (CurrentToken() == Token::kPERIOD) { |
| 8262 ConsumeToken(); // Consume the kPERIOD token. | 8263 ConsumeToken(); // Consume the kPERIOD token. |
| 8263 ExpectIdentifier("identifier expected after '.'"); | 8264 ExpectIdentifier("identifier expected after '.'"); |
| 8264 } | 8265 } |
| 8265 } | 8266 } |
| 8266 | 8267 |
| 8267 } // namespace dart | 8268 } // namespace dart |
| OLD | NEW |