| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 #ifndef VM_CLASS_FINALIZER_H_ | 5 #ifndef VM_CLASS_FINALIZER_H_ |
| 6 #define VM_CLASS_FINALIZER_H_ | 6 #define VM_CLASS_FINALIZER_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/growable_array.h" | 9 #include "vm/growable_array.h" |
| 10 | 10 |
| 11 namespace dart { | 11 namespace dart { |
| 12 | 12 |
| 13 class Class; | 13 class Class; |
| 14 class Function; | 14 class Function; |
| 15 class RawClass; |
| 15 class RawType; | 16 class RawType; |
| 16 class Script; | 17 class Script; |
| 17 class String; | 18 class String; |
| 18 class Type; | 19 class Type; |
| 19 class TypeArguments; | 20 class TypeArguments; |
| 21 class UnresolvedClass; |
| 20 | 22 |
| 21 // Traverses all pending, unfinalized classes, validates and marks them as | 23 // Traverses all pending, unfinalized classes, validates and marks them as |
| 22 // finalized. | 24 // finalized. |
| 23 class ClassFinalizer : public AllStatic { | 25 class ClassFinalizer : public AllStatic { |
| 24 public: | 26 public: |
| 25 // Add 'interface' to 'interface_list' if it is not already in the list and | 27 // Add 'interface' to 'interface_list' if it is not already in the list and |
| 26 // return true. Also return true if 'interface' is not added, because it is | 28 // return true. Also return true if 'interface' is not added, because it is |
| 27 // not unique, i.e. it is already in the list. | 29 // not unique, i.e. it is already in the list. |
| 28 // Return false if 'interface' conflicts with an interface already in the list | 30 // Return false if 'interface' conflicts with an interface already in the list |
| 29 // with the same class, but different type arguments. | 31 // with the same class, but different type arguments. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 49 static bool FinalizePendingClasses(); | 51 static bool FinalizePendingClasses(); |
| 50 | 52 |
| 51 // Verify that the pending classes have been properly prefinalized. This is | 53 // Verify that the pending classes have been properly prefinalized. This is |
| 52 // needed during bootstrapping where the classes have been preloaded. | 54 // needed during bootstrapping where the classes have been preloaded. |
| 53 static void VerifyBootstrapClasses(); | 55 static void VerifyBootstrapClasses(); |
| 54 | 56 |
| 55 private: | 57 private: |
| 56 static void FinalizeClass(const Class& cls); | 58 static void FinalizeClass(const Class& cls); |
| 57 static bool IsSuperCycleFree(const Class& cls); | 59 static bool IsSuperCycleFree(const Class& cls); |
| 58 static void CheckForLegalConstClass(const Class& cls); | 60 static void CheckForLegalConstClass(const Class& cls); |
| 61 static RawClass* ResolveClass(const Class& cls, |
| 62 const UnresolvedClass& unresolved_class); |
| 59 static void ResolveSuperClass(const Class& cls); | 63 static void ResolveSuperClass(const Class& cls); |
| 60 static void ResolveDefaultClass(const Class& cls); | 64 static void ResolveDefaultClass(const Class& cls); |
| 61 static void ResolveInterfaces(const Class& cls, | 65 static void ResolveInterfaces(const Class& cls, |
| 62 GrowableArray<const Class*>* visited); | 66 GrowableArray<const Class*>* visited); |
| 63 static void FinalizeTypeArguments(const Class& cls, | 67 static void FinalizeTypeArguments(const Class& cls, |
| 64 const TypeArguments& arguments); | 68 const TypeArguments& arguments); |
| 65 static RawType* ResolveType(const Class& cls, const Type& type); | 69 static RawType* ResolveType(const Class& cls, const Type& type); |
| 66 static RawType* FinalizeType(const Type& type); | 70 static RawType* FinalizeType(const Type& type); |
| 71 static void ResolveAndFinalizeUpperBounds(const Class& cls); |
| 72 static void VerifyUpperBounds(const Class& cls, |
| 73 const TypeArguments& arguments); |
| 67 static void ResolveAndFinalizeSignature(const Class& cls, | 74 static void ResolveAndFinalizeSignature(const Class& cls, |
| 68 const Function& function); | 75 const Function& function); |
| 69 static void ResolveAndFinalizeMemberTypes(const Class& cls); | 76 static void ResolveAndFinalizeMemberTypes(const Class& cls); |
| 70 static void PrintClassInformation(const Class& cls); | 77 static void PrintClassInformation(const Class& cls); |
| 71 static void VerifyClassImplements(const Class& cls); | 78 static void VerifyClassImplements(const Class& cls); |
| 72 static void CollectInterfaces(const Class& cls, | 79 static void CollectInterfaces(const Class& cls, |
| 73 GrowableArray<const Class*>* interfaces); | 80 GrowableArray<const Class*>* interfaces); |
| 74 static void ReportError(const Script& script, | 81 static void ReportError(const Script& script, |
| 75 intptr_t token_index, | 82 intptr_t token_index, |
| 76 const char* format, ...); | 83 const char* format, ...); |
| 77 static void ReportError(const char* format, ...); | 84 static void ReportError(const char* format, ...); |
| 78 }; | 85 }; |
| 79 | 86 |
| 80 } // namespace dart | 87 } // namespace dart |
| 81 | 88 |
| 82 #endif // VM_CLASS_FINALIZER_H_ | 89 #endif // VM_CLASS_FINALIZER_H_ |
| OLD | NEW |