| 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 "platform/assert.h" | 7 #include "platform/assert.h" |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/bigint_operations.h" | 9 #include "vm/bigint_operations.h" |
| 10 #include "vm/bootstrap.h" | 10 #include "vm/bootstrap.h" |
| (...skipping 2249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2260 const intptr_t num_args = args.IsNull() ? 0 : args.Length(); | 2260 const intptr_t num_args = args.IsNull() ? 0 : args.Length(); |
| 2261 String& class_name = String::Handle(); | 2261 String& class_name = String::Handle(); |
| 2262 intptr_t first_type_param_index; | 2262 intptr_t first_type_param_index; |
| 2263 intptr_t num_type_params; // Number of type parameters to print. | 2263 intptr_t num_type_params; // Number of type parameters to print. |
| 2264 if (HasResolvedTypeClass()) { | 2264 if (HasResolvedTypeClass()) { |
| 2265 const Class& cls = Class::Handle(type_class()); | 2265 const Class& cls = Class::Handle(type_class()); |
| 2266 class_name = cls.Name(); | 2266 class_name = cls.Name(); |
| 2267 num_type_params = cls.NumTypeParameters(); // Do not print the full vector. | 2267 num_type_params = cls.NumTypeParameters(); // Do not print the full vector. |
| 2268 if (num_type_params > num_args) { | 2268 if (num_type_params > num_args) { |
| 2269 first_type_param_index = 0; | 2269 first_type_param_index = 0; |
| 2270 if (!IsFinalized() || IsBeingFinalized()) { | 2270 if (!IsFinalized() || IsBeingFinalized() || IsMalformed()) { |
| 2271 // Most probably an illformed type. Do not fill up with "Dynamic", | 2271 // Most probably an illformed type. Do not fill up with "Dynamic", |
| 2272 // but use actual vector. | 2272 // but use actual vector. |
| 2273 num_type_params = num_args; | 2273 num_type_params = num_args; |
| 2274 } else { | 2274 } else { |
| 2275 ASSERT(num_args == 0); // Type is raw. | 2275 ASSERT(num_args == 0); // Type is raw. |
| 2276 // No need to fill up with "Dynamic". | 2276 // No need to fill up with "Dynamic". |
| 2277 num_type_params = 0; | 2277 num_type_params = 0; |
| 2278 } | 2278 } |
| 2279 } else { | 2279 } else { |
| 2280 first_type_param_index = num_args - num_type_params; | 2280 first_type_param_index = num_args - num_type_params; |
| 2281 } | 2281 } |
| 2282 if (cls.IsSignatureClass()) { | 2282 if (cls.IsSignatureClass()) { |
| 2283 // We may be reporting an error about an illformed function type. In that | 2283 // We may be reporting an error about an illformed function type. In that |
| 2284 // case, avoid instantiating the signature, since it may lead to cycles. | 2284 // case, avoid instantiating the signature, since it may lead to cycles. |
| 2285 if (!IsFinalized() || IsBeingFinalized()) { | 2285 if (!IsFinalized() || IsBeingFinalized() || IsMalformed()) { |
| 2286 return class_name.raw(); | 2286 return class_name.raw(); |
| 2287 } | 2287 } |
| 2288 const Function& signature_function = Function::Handle( | 2288 if (num_type_params > 0) { |
| 2289 cls.signature_function()); | 2289 const Function& signature_function = Function::Handle( |
| 2290 // Signature classes have no super type. | 2290 cls.signature_function()); |
| 2291 ASSERT(first_type_param_index == 0); | 2291 // Signature classes have no super type. |
| 2292 return signature_function.InstantiatedSignatureFrom(args); | 2292 ASSERT(first_type_param_index == 0); |
| 2293 return signature_function.InstantiatedSignatureFrom(args); |
| 2294 } |
| 2293 } | 2295 } |
| 2294 } else { | 2296 } else { |
| 2295 const UnresolvedClass& cls = UnresolvedClass::Handle(unresolved_class()); | 2297 const UnresolvedClass& cls = UnresolvedClass::Handle(unresolved_class()); |
| 2296 class_name = cls.Name(); | 2298 class_name = cls.Name(); |
| 2297 num_type_params = num_args; | 2299 num_type_params = num_args; |
| 2298 first_type_param_index = 0; | 2300 first_type_param_index = 0; |
| 2299 } | 2301 } |
| 2300 String& type_name = String::Handle(); | 2302 String& type_name = String::Handle(); |
| 2301 if (num_type_params == 0) { | 2303 if (num_type_params == 0) { |
| 2302 type_name = class_name.raw(); | 2304 type_name = class_name.raw(); |
| (...skipping 7581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9884 const String& str = String::Handle(pattern()); | 9886 const String& str = String::Handle(pattern()); |
| 9885 const char* format = "JSRegExp: pattern=%s flags=%s"; | 9887 const char* format = "JSRegExp: pattern=%s flags=%s"; |
| 9886 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); | 9888 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); |
| 9887 char* chars = reinterpret_cast<char*>( | 9889 char* chars = reinterpret_cast<char*>( |
| 9888 Isolate::Current()->current_zone()->Allocate(len + 1)); | 9890 Isolate::Current()->current_zone()->Allocate(len + 1)); |
| 9889 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); | 9891 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); |
| 9890 return chars; | 9892 return chars; |
| 9891 } | 9893 } |
| 9892 | 9894 |
| 9893 } // namespace dart | 9895 } // namespace dart |
| OLD | NEW |