Chromium Code Reviews| 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 2721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2732 const AbstractType& uninstantiated_type, | 2732 const AbstractType& uninstantiated_type, |
| 2733 const AbstractTypeArguments& instantiator_type_arguments) { | 2733 const AbstractTypeArguments& instantiator_type_arguments) { |
| 2734 const InstantiatedType& result = | 2734 const InstantiatedType& result = |
| 2735 InstantiatedType::Handle(InstantiatedType::New()); | 2735 InstantiatedType::Handle(InstantiatedType::New()); |
| 2736 result.set_uninstantiated_type(uninstantiated_type); | 2736 result.set_uninstantiated_type(uninstantiated_type); |
| 2737 result.set_instantiator_type_arguments(instantiator_type_arguments); | 2737 result.set_instantiator_type_arguments(instantiator_type_arguments); |
| 2738 return result.raw(); | 2738 return result.raw(); |
| 2739 } | 2739 } |
| 2740 | 2740 |
| 2741 | 2741 |
| 2742 bool InstantiatedType::Equals(const AbstractType& other) const { | |
| 2743 if (raw() == other.raw()) { | |
| 2744 return true; | |
| 2745 } | |
| 2746 if (!other.IsInstantiatedType()) { | |
| 2747 return false; | |
| 2748 } | |
| 2749 InstantiatedType& other_instantiated = InstantiatedType::Handle(); | |
| 2750 other_instantiated ^= other.raw(); | |
| 2751 if (IsFinalized() != other_instantiated.IsFinalized()) { | |
|
regis
2012/04/25 01:53:53
I do not think this is necessary. An InstantiatedT
srdjan
2012/04/25 16:38:01
Is is used for canonicalization. Will try to do it
| |
| 2752 return false; | |
| 2753 } | |
| 2754 const AbstractType& this_type = AbstractType::Handle(uninstantiated_type()); | |
| 2755 const AbstractType& other_type = | |
| 2756 AbstractType::Handle(other_instantiated.uninstantiated_type()); | |
| 2757 if (!this_type.Equals(other_type)) { | |
| 2758 return false; | |
| 2759 } | |
| 2760 if (instantiator_type_arguments() != | |
|
regis
2012/04/25 01:53:53
Using != is not correct. You should be using Equal
srdjan
2012/04/25 16:38:01
Using AreEqual.
| |
| 2761 other_instantiated.instantiator_type_arguments()) { | |
| 2762 return false; | |
| 2763 } | |
| 2764 return true; | |
| 2765 } | |
| 2766 | |
| 2767 | |
| 2742 const char* InstantiatedType::ToCString() const { | 2768 const char* InstantiatedType::ToCString() const { |
| 2743 return "InstantiatedType"; | 2769 return "InstantiatedType"; |
| 2744 } | 2770 } |
| 2745 | 2771 |
| 2746 | 2772 |
| 2747 intptr_t AbstractTypeArguments::Length() const { | 2773 intptr_t AbstractTypeArguments::Length() const { |
| 2748 // AbstractTypeArguments is an abstract class. | 2774 // AbstractTypeArguments is an abstract class. |
| 2749 UNREACHABLE(); | 2775 UNREACHABLE(); |
| 2750 return -1; | 2776 return -1; |
| 2751 } | 2777 } |
| (...skipping 6481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9233 const String& str = String::Handle(pattern()); | 9259 const String& str = String::Handle(pattern()); |
| 9234 const char* format = "JSRegExp: pattern=%s flags=%s"; | 9260 const char* format = "JSRegExp: pattern=%s flags=%s"; |
| 9235 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); | 9261 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); |
| 9236 char* chars = reinterpret_cast<char*>( | 9262 char* chars = reinterpret_cast<char*>( |
| 9237 Isolate::Current()->current_zone()->Allocate(len + 1)); | 9263 Isolate::Current()->current_zone()->Allocate(len + 1)); |
| 9238 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); | 9264 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); |
| 9239 return chars; | 9265 return chars; |
| 9240 } | 9266 } |
| 9241 | 9267 |
| 9242 } // namespace dart | 9268 } // namespace dart |
| OLD | NEW |