| 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 28 matching lines...) Expand all Loading... |
| 39 // canonicalization are required; a malformed type | 39 // canonicalization are required; a malformed type |
| 40 // is not tolerated. | 40 // is not tolerated. |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 // Finalize given type while parsing class cls. | 43 // Finalize given type while parsing class cls. |
| 44 // Also canonicalize type if applicable. | 44 // Also canonicalize type if applicable. |
| 45 static RawAbstractType* FinalizeType(const Class& cls, | 45 static RawAbstractType* FinalizeType(const Class& cls, |
| 46 const AbstractType& type, | 46 const AbstractType& type, |
| 47 FinalizationKind finalization); | 47 FinalizationKind finalization); |
| 48 | 48 |
| 49 // Replace the malformed type with Dynamic and, depending on the given type | 49 // Allocate, finalize, and return a new malformed type as if it was declared |
| 50 // finalization mode and execution mode, mark the type as malformed or report | 50 // in class cls at the given token position. Build the error message from the |
| 51 // a compile time error. Prepend prev_error if not null. | 51 // format string and its arguments. |
| 52 static RawType* NewFinalizedMalformedType(const Class& cls, |
| 53 intptr_t type_pos, |
| 54 const char* format, ...) |
| 55 PRINTF_ATTRIBUTE(3, 4); |
| 56 |
| 57 // Depending on the given type, finalization mode, and execution mode, mark |
| 58 // the given type as malformed or report a compile time error. |
| 59 // If not null, prepend prev_error to the error message built from the format |
| 60 // string and its arguments. |
| 52 static void FinalizeMalformedType(const Error& prev_error, | 61 static void FinalizeMalformedType(const Error& prev_error, |
| 53 const Class& cls, | 62 const Class& cls, |
| 54 const Type& type, | 63 const Type& type, |
| 55 FinalizationKind finalization, | 64 FinalizationKind finalization, |
| 56 const char* format, ...) | 65 const char* format, ...) |
| 57 PRINTF_ATTRIBUTE(5, 6); | 66 PRINTF_ATTRIBUTE(5, 6); |
| 58 | 67 |
| 59 // Return false if we still have classes pending to be finalized. | 68 // Return false if we still have classes pending to be finalized. |
| 60 static bool AllClassesFinalized(); | 69 static bool AllClassesFinalized(); |
| 61 | 70 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 static void ResolveType(const Class& cls, | 102 static void ResolveType(const Class& cls, |
| 94 const AbstractType& type, | 103 const AbstractType& type, |
| 95 FinalizationKind finalization); | 104 FinalizationKind finalization); |
| 96 static void ResolveAndFinalizeUpperBounds(const Class& cls); | 105 static void ResolveAndFinalizeUpperBounds(const Class& cls); |
| 97 static void ResolveAndFinalizeSignature(const Class& cls, | 106 static void ResolveAndFinalizeSignature(const Class& cls, |
| 98 const Function& function); | 107 const Function& function); |
| 99 static void ResolveAndFinalizeMemberTypes(const Class& cls); | 108 static void ResolveAndFinalizeMemberTypes(const Class& cls); |
| 100 static void PrintClassInformation(const Class& cls); | 109 static void PrintClassInformation(const Class& cls); |
| 101 static void CollectInterfaces(const Class& cls, | 110 static void CollectInterfaces(const Class& cls, |
| 102 const GrowableObjectArray& interfaces); | 111 const GrowableObjectArray& interfaces); |
| 112 static void ReportMalformedType(const Error& prev_error, |
| 113 const Class& cls, |
| 114 const Type& type, |
| 115 FinalizationKind finalization, |
| 116 const char* format, |
| 117 va_list args); |
| 103 static void ReportError(const Error& error); | 118 static void ReportError(const Error& error); |
| 104 static void ReportError(const Script& script, | 119 static void ReportError(const Script& script, |
| 105 intptr_t token_index, | 120 intptr_t token_index, |
| 106 const char* format, ...) PRINTF_ATTRIBUTE(3, 4); | 121 const char* format, ...) PRINTF_ATTRIBUTE(3, 4); |
| 107 static void ReportError(const char* format, ...) PRINTF_ATTRIBUTE(1, 2); | 122 static void ReportError(const char* format, ...) PRINTF_ATTRIBUTE(1, 2); |
| 108 }; | 123 }; |
| 109 | 124 |
| 110 } // namespace dart | 125 } // namespace dart |
| 111 | 126 |
| 112 #endif // VM_CLASS_FINALIZER_H_ | 127 #endif // VM_CLASS_FINALIZER_H_ |
| OLD | NEW |