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/object.h" | 5 #include "vm/object.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
10 #include "vm/bigint_operations.h" | 10 #include "vm/bigint_operations.h" |
(...skipping 3903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3914 | 3914 |
3915 RawString* Function::BuildSignature( | 3915 RawString* Function::BuildSignature( |
3916 bool instantiate, | 3916 bool instantiate, |
3917 NameVisibility name_visibility, | 3917 NameVisibility name_visibility, |
3918 const AbstractTypeArguments& instantiator) const { | 3918 const AbstractTypeArguments& instantiator) const { |
3919 const GrowableObjectArray& pieces = | 3919 const GrowableObjectArray& pieces = |
3920 GrowableObjectArray::Handle(GrowableObjectArray::New()); | 3920 GrowableObjectArray::Handle(GrowableObjectArray::New()); |
3921 const String& kCommaSpace = String::Handle(Symbols::New(", ")); | 3921 const String& kCommaSpace = String::Handle(Symbols::New(", ")); |
3922 const String& kColonSpace = String::Handle(Symbols::New(": ")); | 3922 const String& kColonSpace = String::Handle(Symbols::New(": ")); |
3923 const String& kLParen = String::Handle(Symbols::New("(")); | 3923 const String& kLParen = String::Handle(Symbols::New("(")); |
3924 const String& kRParen = String::Handle(Symbols::New(") => ")); | 3924 const String& kRParenArrow = String::Handle(Symbols::New(") => ")); |
3925 const String& kLBracket = String::Handle(Symbols::New("[")); | 3925 const String& kLBracket = String::Handle(Symbols::New("[")); |
3926 const String& kRBracket = String::Handle(Symbols::New("]")); | 3926 const String& kRBracket = String::Handle(Symbols::New("]")); |
3927 const String& kLBrace = String::Handle(Symbols::New("{")); | 3927 const String& kLBrace = String::Handle(Symbols::New("{")); |
3928 const String& kRBrace = String::Handle(Symbols::New("}")); | 3928 const String& kRBrace = String::Handle(Symbols::New("}")); |
3929 String& name = String::Handle(); | 3929 String& name = String::Handle(); |
3930 if (!instantiate && !is_static()) { | 3930 if (!instantiate && !is_static() && (name_visibility == kInternalName)) { |
3931 // Prefix the signature with its type parameters, if any (e.g. "<K, V>"). | 3931 // Prefix the signature with its class and type parameters, if any (e.g. |
| 3932 // "Map<K, V>(K) => bool"). |
3932 // The signature of static functions cannot be type parameterized. | 3933 // The signature of static functions cannot be type parameterized. |
3933 const String& kSpaceExtendsSpace = | 3934 const String& kSpaceExtendsSpace = |
3934 String::Handle(Symbols::New(" extends ")); | 3935 String::Handle(Symbols::New(" extends ")); |
3935 const String& kLAngleBracket = String::Handle(Symbols::New("<")); | 3936 const String& kLAngleBracket = String::Handle(Symbols::New("<")); |
3936 const String& kRAngleBracket = String::Handle(Symbols::New(">")); | 3937 const String& kRAngleBracket = String::Handle(Symbols::New(">")); |
3937 const Class& function_class = Class::Handle(Owner()); | 3938 const Class& function_class = Class::Handle(Owner()); |
3938 ASSERT(!function_class.IsNull()); | 3939 ASSERT(!function_class.IsNull()); |
3939 const TypeArguments& type_parameters = TypeArguments::Handle( | 3940 const TypeArguments& type_parameters = TypeArguments::Handle( |
3940 function_class.type_parameters()); | 3941 function_class.type_parameters()); |
3941 if (!type_parameters.IsNull()) { | 3942 if (!type_parameters.IsNull()) { |
| 3943 const String& function_class_name = String::Handle(function_class.Name()); |
| 3944 pieces.Add(function_class_name); |
3942 intptr_t num_type_parameters = type_parameters.Length(); | 3945 intptr_t num_type_parameters = type_parameters.Length(); |
3943 pieces.Add(kLAngleBracket); | 3946 pieces.Add(kLAngleBracket); |
3944 TypeParameter& type_parameter = TypeParameter::Handle(); | 3947 TypeParameter& type_parameter = TypeParameter::Handle(); |
3945 AbstractType& bound = AbstractType::Handle(); | 3948 AbstractType& bound = AbstractType::Handle(); |
3946 for (intptr_t i = 0; i < num_type_parameters; i++) { | 3949 for (intptr_t i = 0; i < num_type_parameters; i++) { |
3947 type_parameter ^= type_parameters.TypeAt(i); | 3950 type_parameter ^= type_parameters.TypeAt(i); |
3948 name = type_parameter.name(); | 3951 name = type_parameter.name(); |
3949 pieces.Add(name); | 3952 pieces.Add(name); |
3950 bound = type_parameter.bound(); | 3953 bound = type_parameter.bound(); |
3951 if (!bound.IsNull() && !bound.IsDynamicType()) { | 3954 if (!bound.IsNull() && !bound.IsObjectType()) { |
3952 pieces.Add(kSpaceExtendsSpace); | 3955 pieces.Add(kSpaceExtendsSpace); |
3953 name = bound.BuildName(name_visibility); | 3956 name = bound.BuildName(name_visibility); |
3954 pieces.Add(name); | 3957 pieces.Add(name); |
3955 } | 3958 } |
3956 if (i < num_type_parameters - 1) { | 3959 if (i < num_type_parameters - 1) { |
3957 pieces.Add(kCommaSpace); | 3960 pieces.Add(kCommaSpace); |
3958 } | 3961 } |
3959 } | 3962 } |
3960 pieces.Add(kRAngleBracket); | 3963 pieces.Add(kRAngleBracket); |
3961 } | 3964 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4004 if (i != (num_params - 1)) { | 4007 if (i != (num_params - 1)) { |
4005 pieces.Add(kCommaSpace); | 4008 pieces.Add(kCommaSpace); |
4006 } | 4009 } |
4007 } | 4010 } |
4008 if (num_opt_pos_params > 0) { | 4011 if (num_opt_pos_params > 0) { |
4009 pieces.Add(kRBracket); | 4012 pieces.Add(kRBracket); |
4010 } else { | 4013 } else { |
4011 pieces.Add(kRBrace); | 4014 pieces.Add(kRBrace); |
4012 } | 4015 } |
4013 } | 4016 } |
4014 pieces.Add(kRParen); | 4017 pieces.Add(kRParenArrow); |
4015 AbstractType& res_type = AbstractType::Handle(result_type()); | 4018 AbstractType& res_type = AbstractType::Handle(result_type()); |
4016 if (instantiate && !res_type.IsInstantiated()) { | 4019 if (instantiate && !res_type.IsInstantiated()) { |
4017 res_type = res_type.InstantiateFrom(instantiator); | 4020 res_type = res_type.InstantiateFrom(instantiator); |
4018 } | 4021 } |
4019 name = res_type.BuildName(name_visibility); | 4022 name = res_type.BuildName(name_visibility); |
4020 pieces.Add(name); | 4023 pieces.Add(name); |
4021 const Array& strings = Array::Handle(Array::MakeArray(pieces)); | 4024 const Array& strings = Array::Handle(Array::MakeArray(pieces)); |
4022 return Symbols::New(String::Handle(String::ConcatAll(strings))); | 4025 return Symbols::New(String::Handle(String::ConcatAll(strings))); |
4023 } | 4026 } |
4024 | 4027 |
(...skipping 8130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12155 } | 12158 } |
12156 return result.raw(); | 12159 return result.raw(); |
12157 } | 12160 } |
12158 | 12161 |
12159 | 12162 |
12160 const char* WeakProperty::ToCString() const { | 12163 const char* WeakProperty::ToCString() const { |
12161 return "_WeakProperty"; | 12164 return "_WeakProperty"; |
12162 } | 12165 } |
12163 | 12166 |
12164 } // namespace dart | 12167 } // namespace dart |
OLD | NEW |