| 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 2516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2527 Error* malformed_error) const { | 2527 Error* malformed_error) const { |
| 2528 ASSERT(IsFinalized()); | 2528 ASSERT(IsFinalized()); |
| 2529 ASSERT(other.IsFinalized()); | 2529 ASSERT(other.IsFinalized()); |
| 2530 // In case the type checked in a type test is malformed, the code generator | 2530 // In case the type checked in a type test is malformed, the code generator |
| 2531 // may compile a throw instead of a run time call performing the type check. | 2531 // may compile a throw instead of a run time call performing the type check. |
| 2532 // However, in checked mode, a function type may include malformed result type | 2532 // However, in checked mode, a function type may include malformed result type |
| 2533 // and/or malformed parameter types, which will then be encountered here at | 2533 // and/or malformed parameter types, which will then be encountered here at |
| 2534 // run time. | 2534 // run time. |
| 2535 if (IsMalformed()) { | 2535 if (IsMalformed()) { |
| 2536 ASSERT(FLAG_enable_type_checks); | 2536 ASSERT(FLAG_enable_type_checks); |
| 2537 if (malformed_error->IsNull()) { | 2537 if ((malformed_error != NULL) && malformed_error->IsNull()) { |
| 2538 *malformed_error = this->malformed_error(); | 2538 *malformed_error = this->malformed_error(); |
| 2539 } | 2539 } |
| 2540 return false; | 2540 return false; |
| 2541 } | 2541 } |
| 2542 if (other.IsMalformed()) { | 2542 if (other.IsMalformed()) { |
| 2543 ASSERT(FLAG_enable_type_checks); | 2543 ASSERT(FLAG_enable_type_checks); |
| 2544 if (malformed_error->IsNull()) { | 2544 if ((malformed_error != NULL) && malformed_error->IsNull()) { |
| 2545 *malformed_error = other.malformed_error(); | 2545 *malformed_error = other.malformed_error(); |
| 2546 } | 2546 } |
| 2547 return false; | 2547 return false; |
| 2548 } | 2548 } |
| 2549 // AbstractType parameters cannot be handled by Class::TypeTest(). | 2549 // AbstractType parameters cannot be handled by Class::TypeTest(). |
| 2550 // When comparing two uninstantiated function types, one returning type | 2550 // When comparing two uninstantiated function types, one returning type |
| 2551 // parameter K, the other returning type parameter V, we cannot assume that K | 2551 // parameter K, the other returning type parameter V, we cannot assume that K |
| 2552 // is a subtype of V, or vice versa. We only return true if K == V, i.e. if | 2552 // is a subtype of V, or vice versa. We only return true if K == V, i.e. if |
| 2553 // they have the same index (both are finalized, so their indices are | 2553 // they have the same index (both are finalized, so their indices are |
| 2554 // comparable). | 2554 // comparable). |
| (...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3303 Error& malformed_bound_error = Error::Handle(); | 3303 Error& malformed_bound_error = Error::Handle(); |
| 3304 if (bound.IsMalformed()) { | 3304 if (bound.IsMalformed()) { |
| 3305 malformed_bound_error = bound.malformed_error(); | 3305 malformed_bound_error = bound.malformed_error(); |
| 3306 } else if (!bound.IsInstantiated()) { | 3306 } else if (!bound.IsInstantiated()) { |
| 3307 bound = bound.InstantiateFrom(bounds_instantiator); | 3307 bound = bound.InstantiateFrom(bounds_instantiator); |
| 3308 } | 3308 } |
| 3309 if (!malformed_bound_error.IsNull() || | 3309 if (!malformed_bound_error.IsNull() || |
| 3310 !this_type_arg.IsSubtypeOf(bound, malformed_error)) { | 3310 !this_type_arg.IsSubtypeOf(bound, malformed_error)) { |
| 3311 // Ignore this bound error if another malformed error was already | 3311 // Ignore this bound error if another malformed error was already |
| 3312 // reported for this type test. | 3312 // reported for this type test. |
| 3313 if (malformed_error->IsNull()) { | 3313 if ((malformed_error != NULL) && malformed_error->IsNull()) { |
| 3314 const String& type_arg_name = | 3314 const String& type_arg_name = |
| 3315 String::Handle(this_type_arg.UserVisibleName()); | 3315 String::Handle(this_type_arg.UserVisibleName()); |
| 3316 const String& class_name = String::Handle(cls.Name()); | 3316 const String& class_name = String::Handle(cls.Name()); |
| 3317 const String& bound_name = String::Handle(bound.UserVisibleName()); | 3317 const String& bound_name = String::Handle(bound.UserVisibleName()); |
| 3318 const Script& script = Script::Handle(cls.script()); | 3318 const Script& script = Script::Handle(cls.script()); |
| 3319 // Since the bound was canonicalized, its token index was lost, | 3319 // Since the bound was canonicalized, its token index was lost, |
| 3320 // therefore, use the token index of the corresponding type parameter. | 3320 // therefore, use the token index of the corresponding type parameter. |
| 3321 *malformed_error ^= FormatError(malformed_bound_error, | 3321 *malformed_error ^= FormatError(malformed_bound_error, |
| 3322 script, cls_type_param.token_pos(), | 3322 script, cls_type_param.token_pos(), |
| 3323 "type argument '%s' does not " | 3323 "type argument '%s' does not " |
| (...skipping 7460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10784 const String& str = String::Handle(pattern()); | 10784 const String& str = String::Handle(pattern()); |
| 10785 const char* format = "JSRegExp: pattern=%s flags=%s"; | 10785 const char* format = "JSRegExp: pattern=%s flags=%s"; |
| 10786 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); | 10786 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); |
| 10787 char* chars = reinterpret_cast<char*>( | 10787 char* chars = reinterpret_cast<char*>( |
| 10788 Isolate::Current()->current_zone()->Allocate(len + 1)); | 10788 Isolate::Current()->current_zone()->Allocate(len + 1)); |
| 10789 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); | 10789 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); |
| 10790 return chars; | 10790 return chars; |
| 10791 } | 10791 } |
| 10792 | 10792 |
| 10793 } // namespace dart | 10793 } // namespace dart |
| OLD | NEW |