Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: runtime/vm/class_finalizer.h

Issue 9515011: Add support for malformed types and postpone some related errors from compile (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/bootstrap_natives.h ('k') | runtime/vm/class_finalizer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, 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
11 namespace dart { 11 namespace dart {
(...skipping 22 matching lines...) Expand all
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 // Modes for type resolution and finalization. The ordering is relevant.
45 enum FinalizationKind {
46 kIgnore, // Parsed type is ignored and replaced by Dynamic.
47 kDoNotResolve, // Type resolution is postponed.
48 kTryResolve, // Type resolution is attempted, but not required.
49 kFinalize, // Type resolution and type finalization are required.
50 // A malformed type is tolerated.
51 kFinalizeWellFormed // Error-free resolution and finalization are required.
52 // A malformed type is not tolerated.
53 };
54
44 // Finalize given type while parsing class cls. 55 // Finalize given type while parsing class cls.
45 // Also canonicalize type if applicable. 56 // Also canonicalize type if applicable.
46 static RawAbstractType* FinalizeType(const Class& cls, 57 static RawAbstractType* FinalizeType(const Class& cls,
47 const AbstractType& type); 58 const AbstractType& type,
59 FinalizationKind finalization);
60
61 // Replace the malformed type with Dynamic and, depending on the given type
62 // finalization mode and execution mode, mark the type as malformed or report
63 // a compile time error.
64 static void FinalizeMalformedType(const Class& cls,
65 const Type& type,
66 FinalizationKind finalization,
67 const char* format, ...);
48 68
49 // Pending classes are classes that need to be finalized. 69 // Pending classes are classes that need to be finalized.
50 static void AddPendingClasses(const GrowableArray<const Class*>& classes); 70 static void AddPendingClasses(const GrowableArray<const Class*>& classes);
51 71
52 // Return false if we still have classes pending to be finalized. 72 // Return false if we still have classes pending to be finalized.
53 static bool AllClassesFinalized(); 73 static bool AllClassesFinalized();
54 74
55 // Return whether class finalization failed. 75 // Return whether class finalization failed.
56 // The function returns true if the finalization was successful. 76 // The function returns true if the finalization was successful.
57 // If finalization fails, an error message is set in the sticky error field 77 // If finalization fails, an error message is set in the sticky error field
(...skipping 14 matching lines...) Expand all
72 static void FinalizeClass(const Class& cls, bool generating_snapshot); 92 static void FinalizeClass(const Class& cls, bool generating_snapshot);
73 static bool IsSuperCycleFree(const Class& cls); 93 static bool IsSuperCycleFree(const Class& cls);
74 static void CheckForLegalConstClass(const Class& cls); 94 static void CheckForLegalConstClass(const Class& cls);
75 static RawClass* ResolveClass(const Class& cls, 95 static RawClass* ResolveClass(const Class& cls,
76 const UnresolvedClass& unresolved_class); 96 const UnresolvedClass& unresolved_class);
77 static void ResolveSuperType(const Class& cls); 97 static void ResolveSuperType(const Class& cls);
78 static void ResolveDefaultClass(const Class& cls); 98 static void ResolveDefaultClass(const Class& cls);
79 static void ResolveInterfaces(const Class& cls, 99 static void ResolveInterfaces(const Class& cls,
80 GrowableArray<const Class*>* visited); 100 GrowableArray<const Class*>* visited);
81 static void FinalizeTypeArguments(const Class& cls, 101 static void FinalizeTypeArguments(const Class& cls,
82 const AbstractTypeArguments& arguments); 102 const AbstractTypeArguments& arguments,
83 static void ResolveType(const Class& cls, const AbstractType& type); 103 FinalizationKind finalization);
104 static void ResolveType(const Class& cls,
105 const AbstractType& type,
106 FinalizationKind finalization);
84 static void ResolveAndFinalizeUpperBounds(const Class& cls); 107 static void ResolveAndFinalizeUpperBounds(const Class& cls);
85 static void ResolveAndFinalizeSignature(const Class& cls, 108 static void ResolveAndFinalizeSignature(const Class& cls,
86 const Function& function); 109 const Function& function);
87 static void ResolveAndFinalizeMemberTypes(const Class& cls); 110 static void ResolveAndFinalizeMemberTypes(const Class& cls);
88 static void PrintClassInformation(const Class& cls); 111 static void PrintClassInformation(const Class& cls);
89 static void VerifyClassImplements(const Class& cls); 112 static void VerifyClassImplements(const Class& cls);
90 static void CollectInterfaces(const Class& cls, 113 static void CollectInterfaces(const Class& cls,
91 GrowableArray<const Class*>* interfaces); 114 GrowableArray<const Class*>* interfaces);
115 static void ReportError(const Error& error);
92 static void ReportError(const Script& script, 116 static void ReportError(const Script& script,
93 intptr_t token_index, 117 intptr_t token_index,
94 const char* format, ...); 118 const char* format, ...);
95 static void ReportError(const char* format, ...); 119 static void ReportError(const char* format, ...);
96 static void ReportWarning(const Script& script,
97 intptr_t token_index,
98 const char* format, ...);
99 }; 120 };
100 121
101 } // namespace dart 122 } // namespace dart
102 123
103 #endif // VM_CLASS_FINALIZER_H_ 124 #endif // VM_CLASS_FINALIZER_H_
OLDNEW
« no previous file with comments | « runtime/vm/bootstrap_natives.h ('k') | runtime/vm/class_finalizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698