OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 RUNTIME_VM_KERNEL_TO_IL_H_ | 5 #ifndef RUNTIME_VM_KERNEL_TO_IL_H_ |
6 #define RUNTIME_VM_KERNEL_TO_IL_H_ | 6 #define RUNTIME_VM_KERNEL_TO_IL_H_ |
7 | 7 |
8 #include "vm/growable_array.h" | 8 #include "vm/growable_array.h" |
9 #include "vm/hash_map.h" | 9 #include "vm/hash_map.h" |
10 | 10 |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 virtual ~TranslationHelper() {} | 198 virtual ~TranslationHelper() {} |
199 | 199 |
200 Thread* thread() { return thread_; } | 200 Thread* thread() { return thread_; } |
201 | 201 |
202 Zone* zone() { return zone_; } | 202 Zone* zone() { return zone_; } |
203 | 203 |
204 Isolate* isolate() { return isolate_; } | 204 Isolate* isolate() { return isolate_; } |
205 | 205 |
206 Heap::Space allocation_space() { return allocation_space_; } | 206 Heap::Space allocation_space() { return allocation_space_; } |
207 | 207 |
208 // Set whether unfinalized classes should be finalized. The base class | |
209 // implementation used at flow graph construction time looks up classes in the | |
210 // VM's heap, all of which should already be finalized. | |
211 virtual void SetFinalize(bool finalize) {} | |
212 | |
213 RawInstance* Canonicalize(const Instance& instance); | 208 RawInstance* Canonicalize(const Instance& instance); |
214 | 209 |
215 const dart::String& DartString(const char* content) { | 210 const dart::String& DartString(const char* content) { |
216 return DartString(content, allocation_space_); | 211 return DartString(content, allocation_space_); |
217 } | 212 } |
218 const dart::String& DartString(const char* content, Heap::Space space); | 213 const dart::String& DartString(const char* content, Heap::Space space); |
219 | 214 |
220 dart::String& DartString(String* content) { | 215 dart::String& DartString(String* content) { |
221 return DartString(content, allocation_space_); | 216 return DartString(content, allocation_space_); |
222 } | 217 } |
(...skipping 14 matching lines...) Expand all Loading... |
237 const dart::String& DartFactoryName(Class* klass, Name* kernel_name); | 232 const dart::String& DartFactoryName(Class* klass, Name* kernel_name); |
238 | 233 |
239 const Array& ArgumentNames(List<NamedExpression>* named); | 234 const Array& ArgumentNames(List<NamedExpression>* named); |
240 | 235 |
241 // A subclass overrides these when reading in the Kernel program in order to | 236 // A subclass overrides these when reading in the Kernel program in order to |
242 // support recursive type expressions (e.g. for "implements X" ... | 237 // support recursive type expressions (e.g. for "implements X" ... |
243 // annotations). | 238 // annotations). |
244 virtual RawLibrary* LookupLibraryByKernelLibrary(Library* library); | 239 virtual RawLibrary* LookupLibraryByKernelLibrary(Library* library); |
245 virtual RawClass* LookupClassByKernelClass(Class* klass); | 240 virtual RawClass* LookupClassByKernelClass(Class* klass); |
246 | 241 |
| 242 RawUnresolvedClass* ToUnresolvedClass(Class* klass); |
| 243 |
247 RawField* LookupFieldByKernelField(Field* field); | 244 RawField* LookupFieldByKernelField(Field* field); |
248 RawFunction* LookupStaticMethodByKernelProcedure(Procedure* procedure); | 245 RawFunction* LookupStaticMethodByKernelProcedure(Procedure* procedure); |
249 RawFunction* LookupConstructorByKernelConstructor(Constructor* constructor); | 246 RawFunction* LookupConstructorByKernelConstructor(Constructor* constructor); |
250 dart::RawFunction* LookupConstructorByKernelConstructor( | 247 dart::RawFunction* LookupConstructorByKernelConstructor( |
251 const dart::Class& owner, Constructor* constructor); | 248 const dart::Class& owner, Constructor* constructor); |
252 | 249 |
253 dart::Type& GetCanonicalType(const dart::Class& klass); | 250 dart::Type& GetCanonicalType(const dart::Class& klass); |
254 | 251 |
255 void ReportError(const char* format, ...); | 252 void ReportError(const char* format, ...); |
256 void ReportError(const Error& prev_error, const char* format, ...); | 253 void ReportError(const Error& prev_error, const char* format, ...); |
(...skipping 18 matching lines...) Expand all Loading... |
275 // * T does not denote a type in scope | 272 // * T does not denote a type in scope |
276 // * T refers to a type parameter in a static member | 273 // * T refers to a type parameter in a static member |
277 // * T is a parametrized Type G<T1, ...> and G is malformed | 274 // * T is a parametrized Type G<T1, ...> and G is malformed |
278 // * T denotes declarations from multiple imports | 275 // * T denotes declarations from multiple imports |
279 // | 276 // |
280 // Any use of a malformed type gives rise to a static warning. A malformed | 277 // Any use of a malformed type gives rise to a static warning. A malformed |
281 // type is then interpreted as dynamic by the static type checker and the | 278 // type is then interpreted as dynamic by the static type checker and the |
282 // runtime unless explicitly specified otherwise. | 279 // runtime unless explicitly specified otherwise. |
283 class DartTypeTranslator : public DartTypeVisitor { | 280 class DartTypeTranslator : public DartTypeVisitor { |
284 public: | 281 public: |
285 DartTypeTranslator(TranslationHelper* helper, ActiveClass* active_class, | 282 DartTypeTranslator(TranslationHelper* helper, |
286 bool finalize = true) | 283 ActiveClass* active_class, |
| 284 bool finalize = false) |
287 : translation_helper_(*helper), | 285 : translation_helper_(*helper), |
288 active_class_(active_class), | 286 active_class_(active_class), |
289 zone_(helper->zone()), | 287 zone_(helper->zone()), |
290 result_(AbstractType::Handle(helper->zone())), | 288 result_(AbstractType::Handle(helper->zone())), |
291 finalize_(finalize) {} | 289 finalize_(finalize) {} |
292 | 290 |
293 // Can return a malformed type. | 291 // Can return a malformed type. |
294 AbstractType& TranslateType(DartType* node); | 292 AbstractType& TranslateType(DartType* node); |
295 | 293 |
296 // Can return a malformed type. | 294 // Can return a malformed type. |
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
892 friend class SwitchBlock; | 890 friend class SwitchBlock; |
893 friend class TryCatchBlock; | 891 friend class TryCatchBlock; |
894 friend class TryFinallyBlock; | 892 friend class TryFinallyBlock; |
895 }; | 893 }; |
896 | 894 |
897 } // namespace kernel | 895 } // namespace kernel |
898 } // namespace dart | 896 } // namespace dart |
899 | 897 |
900 | 898 |
901 #endif // RUNTIME_VM_KERNEL_TO_IL_H_ | 899 #endif // RUNTIME_VM_KERNEL_TO_IL_H_ |
OLD | NEW |