| 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 AbstractType; | 13 class AbstractType; | 
| 14 class AbstractTypeArguments; | 14 class AbstractTypeArguments; | 
| 15 class Class; | 15 class Class; | 
|  | 16 class Error; | 
| 16 class Function; | 17 class Function; | 
| 17 class RawAbstractType; | 18 class RawAbstractType; | 
| 18 class RawClass; | 19 class RawClass; | 
| 19 class RawType; | 20 class RawType; | 
| 20 class Script; | 21 class Script; | 
| 21 class String; |  | 
| 22 class Type; | 22 class Type; | 
| 23 class UnresolvedClass; | 23 class UnresolvedClass; | 
| 24 | 24 | 
| 25 // Traverses all pending, unfinalized classes, validates and marks them as | 25 // Traverses all pending, unfinalized classes, validates and marks them as | 
| 26 // finalized. | 26 // finalized. | 
| 27 class ClassFinalizer : public AllStatic { | 27 class ClassFinalizer : public AllStatic { | 
| 28  public: | 28  public: | 
| 29   enum { | 29   enum { | 
| 30     kGeneratingSnapshot = true, | 30     kGeneratingSnapshot = true, | 
| 31     kNotGeneratingSnapshot = false | 31     kNotGeneratingSnapshot = false | 
| 32   }; | 32   }; | 
| 33 | 33 | 
| 34   // Add 'interface' to 'interface_list' if it is not already in the list and | 34   // Add 'interface' to 'interface_list' if it is not already in the list and | 
| 35   // return true. Also return true if 'interface' is not added, because it is | 35   // return true. Also return true if 'interface' is not added, because it is | 
| 36   // not unique, i.e. it is already in the list. | 36   // not unique, i.e. it is already in the list. | 
| 37   // Return false if 'interface' conflicts with an interface already in the list | 37   // Return false if 'interface' conflicts with an interface already in the list | 
| 38   // with the same class, but different type arguments. | 38   // with the same class, but different type arguments. | 
| 39   // In the case of a conflict, set 'conflicting' to the existing interface. | 39   // In the case of a conflict, set 'conflicting' to the existing interface. | 
| 40   static bool AddInterfaceIfUnique(GrowableArray<AbstractType*>* interface_list, | 40   static bool AddInterfaceIfUnique(GrowableArray<AbstractType*>* interface_list, | 
| 41                                    AbstractType* interface, | 41                                    AbstractType* interface, | 
| 42                                    AbstractType* conflicting); | 42                                    AbstractType* conflicting); | 
| 43 | 43 | 
| 44   // Finalize and canonicalize type while parsing class cls. | 44   // Finalize and canonicalize type while parsing class cls. | 
| 45   // Set the error message on failure (to String::null() if no error). | 45   // Set the error message on failure (to Error::null() if no error). | 
| 46   static RawAbstractType* FinalizeAndCanonicalizeType(const Class& cls, | 46   static RawAbstractType* FinalizeAndCanonicalizeType(const Class& cls, | 
| 47                                                       const AbstractType& type, | 47                                                       const AbstractType& type, | 
| 48                                                       String* errmsg); | 48                                                       Error* error); | 
| 49 | 49 | 
| 50   // Pending classes are classes that need to be finalized. | 50   // Pending classes are classes that need to be finalized. | 
| 51   static void AddPendingClasses(const GrowableArray<const Class*>& classes); | 51   static void AddPendingClasses(const GrowableArray<const Class*>& classes); | 
| 52 | 52 | 
| 53   // Return false if we still have classes pending to be finalized. | 53   // Return false if we still have classes pending to be finalized. | 
| 54   static bool AllClassesFinalized(); | 54   static bool AllClassesFinalized(); | 
| 55 | 55 | 
| 56   // Return whether class finalization failed. | 56   // Return whether class finalization failed. | 
| 57   // The function returns true if the finalization was successful. | 57   // The function returns true if the finalization was successful. | 
| 58   // If finalization fails, an error message is set in the sticky error field | 58   // If finalization fails, an error message is set in the sticky error field | 
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 99                           const char* format, ...); | 99                           const char* format, ...); | 
| 100   static void ReportError(const char* format, ...); | 100   static void ReportError(const char* format, ...); | 
| 101   static void ReportWarning(const Script& script, | 101   static void ReportWarning(const Script& script, | 
| 102                             intptr_t token_index, | 102                             intptr_t token_index, | 
| 103                             const char* format, ...); | 103                             const char* format, ...); | 
| 104 }; | 104 }; | 
| 105 | 105 | 
| 106 }  // namespace dart | 106 }  // namespace dart | 
| 107 | 107 | 
| 108 #endif  // VM_CLASS_FINALIZER_H_ | 108 #endif  // VM_CLASS_FINALIZER_H_ | 
| OLD | NEW | 
|---|