| 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 #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 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 // not unique, i.e. it is already in the list. | 37 // not unique, i.e. it is already in the list. |
| 38 // Return false if 'interface' conflicts with an interface already in the list | 38 // Return false if 'interface' conflicts with an interface already in the list |
| 39 // with the same class, but different type arguments. | 39 // with the same class, but different type arguments. |
| 40 // In the case of a conflict, set 'conflicting' to the existing interface. | 40 // In the case of a conflict, set 'conflicting' to the existing interface. |
| 41 static bool AddInterfaceIfUnique(const GrowableObjectArray& interface_list, | 41 static bool AddInterfaceIfUnique(const GrowableObjectArray& interface_list, |
| 42 const AbstractType& interface, | 42 const AbstractType& interface, |
| 43 AbstractType* conflicting); | 43 AbstractType* conflicting); |
| 44 | 44 |
| 45 // Modes for type resolution and finalization. The ordering is relevant. | 45 // Modes for type resolution and finalization. The ordering is relevant. |
| 46 enum FinalizationKind { | 46 enum FinalizationKind { |
| 47 kIgnore, // Parsed type is ignored and replaced by Dynamic. | 47 kIgnore, // Parsed type is ignored and replaced by Dynamic. |
| 48 kDoNotResolve, // Type resolution is postponed. | 48 kDoNotResolve, // Type resolution is postponed. |
| 49 kTryResolve, // Type resolution is attempted, but not required. | 49 kTryResolve, // Type resolution is attempted, but not required. |
| 50 kFinalize, // Type resolution and type finalization are required. | 50 kFinalize, // Type resolution and type finalization are |
| 51 // A malformed type is tolerated. | 51 // required; a malformed type is tolerated. |
| 52 kFinalizeWellFormed // Error-free resolution and finalization are required. | 52 kCanonicalize, // Same as kFinalize, but with canonicalization. |
| 53 // A malformed type is not tolerated. | 53 kCanonicalizeWellFormed // Error-free resolution, finalization, and |
| 54 // canonicalization are required; a malformed type |
| 55 // is not tolerated. |
| 54 }; | 56 }; |
| 55 | 57 |
| 56 // Finalize given type while parsing class cls. | 58 // Finalize given type while parsing class cls. |
| 57 // Also canonicalize type if applicable. | 59 // Also canonicalize type if applicable. |
| 58 static RawAbstractType* FinalizeType(const Class& cls, | 60 static RawAbstractType* FinalizeType(const Class& cls, |
| 59 const AbstractType& type, | 61 const AbstractType& type, |
| 60 FinalizationKind finalization); | 62 FinalizationKind finalization); |
| 61 | 63 |
| 62 // Replace the malformed type with Dynamic and, depending on the given type | 64 // Replace the malformed type with Dynamic and, depending on the given type |
| 63 // finalization mode and execution mode, mark the type as malformed or report | 65 // finalization mode and execution mode, mark the type as malformed or report |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 static void ReportError(const Error& error); | 119 static void ReportError(const Error& error); |
| 118 static void ReportError(const Script& script, | 120 static void ReportError(const Script& script, |
| 119 intptr_t token_index, | 121 intptr_t token_index, |
| 120 const char* format, ...); | 122 const char* format, ...); |
| 121 static void ReportError(const char* format, ...); | 123 static void ReportError(const char* format, ...); |
| 122 }; | 124 }; |
| 123 | 125 |
| 124 } // namespace dart | 126 } // namespace dart |
| 125 | 127 |
| 126 #endif // VM_CLASS_FINALIZER_H_ | 128 #endif // VM_CLASS_FINALIZER_H_ |
| OLD | NEW |