| 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 #if !defined(DART_PRECOMPILED_RUNTIME) | 8 #if !defined(DART_PRECOMPILED_RUNTIME) |
| 9 | 9 |
| 10 #include "vm/growable_array.h" | 10 #include "vm/growable_array.h" |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 // 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 |
| 278 // 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 |
| 279 // runtime unless explicitly specified otherwise. | 279 // runtime unless explicitly specified otherwise. |
| 280 class DartTypeTranslator : public DartTypeVisitor { | 280 class DartTypeTranslator : public DartTypeVisitor { |
| 281 public: | 281 public: |
| 282 DartTypeTranslator(TranslationHelper* helper, | 282 DartTypeTranslator(TranslationHelper* helper, |
| 283 ActiveClass* active_class, | 283 ActiveClass* active_class, |
| 284 bool finalize = false) | 284 bool finalize = false) |
| 285 : translation_helper_(*helper), | 285 : translation_helper_(*helper), |
| 286 active_class_(active_class), | 286 active_class_(active_class), |
| 287 type_parameter_scope_(NULL), |
| 287 zone_(helper->zone()), | 288 zone_(helper->zone()), |
| 288 result_(AbstractType::Handle(helper->zone())), | 289 result_(AbstractType::Handle(helper->zone())), |
| 289 finalize_(finalize) {} | 290 finalize_(finalize) {} |
| 290 | 291 |
| 291 // Can return a malformed type. | 292 // Can return a malformed type. |
| 292 AbstractType& TranslateType(DartType* node); | 293 AbstractType& TranslateType(DartType* node); |
| 293 | 294 |
| 294 // Can return a malformed type. | 295 // Can return a malformed type. |
| 295 AbstractType& TranslateTypeWithoutFinalization(DartType* node); | 296 AbstractType& TranslateTypeWithoutFinalization(DartType* node); |
| 296 | 297 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 320 intptr_t length); | 321 intptr_t length); |
| 321 | 322 |
| 322 // Will return `TypeArguments::null()` in case any of the arguments are | 323 // Will return `TypeArguments::null()` in case any of the arguments are |
| 323 // malformed. | 324 // malformed. |
| 324 const TypeArguments& TranslateTypeArguments(DartType** dart_types, | 325 const TypeArguments& TranslateTypeArguments(DartType** dart_types, |
| 325 intptr_t length); | 326 intptr_t length); |
| 326 | 327 |
| 327 const Type& ReceiverType(const dart::Class& klass); | 328 const Type& ReceiverType(const dart::Class& klass); |
| 328 | 329 |
| 329 private: | 330 private: |
| 331 class TypeParameterScope { |
| 332 public: |
| 333 TypeParameterScope(DartTypeTranslator* translator, |
| 334 List<TypeParameter>* parameters) |
| 335 : parameters_(parameters), |
| 336 outer_(translator->type_parameter_scope_), |
| 337 translator_(translator) { |
| 338 translator_->type_parameter_scope_ = this; |
| 339 } |
| 340 ~TypeParameterScope() { translator_->type_parameter_scope_ = outer_; } |
| 341 |
| 342 TypeParameterScope* outer() const { return outer_; } |
| 343 List<TypeParameter>* parameters() const { return parameters_; } |
| 344 |
| 345 private: |
| 346 List<TypeParameter>* parameters_; |
| 347 TypeParameterScope* outer_; |
| 348 DartTypeTranslator* translator_; |
| 349 }; |
| 350 |
| 330 TranslationHelper& translation_helper_; | 351 TranslationHelper& translation_helper_; |
| 331 ActiveClass* active_class_; | 352 ActiveClass* active_class_; |
| 353 TypeParameterScope* type_parameter_scope_; |
| 332 Zone* zone_; | 354 Zone* zone_; |
| 333 AbstractType& result_; | 355 AbstractType& result_; |
| 334 | |
| 335 bool finalize_; | 356 bool finalize_; |
| 336 }; | 357 }; |
| 337 | 358 |
| 338 | 359 |
| 339 // There are several cases when we are compiling constant expressions: | 360 // There are several cases when we are compiling constant expressions: |
| 340 // | 361 // |
| 341 // * constant field initializers: | 362 // * constant field initializers: |
| 342 // const FieldName = <expr>; | 363 // const FieldName = <expr>; |
| 343 // | 364 // |
| 344 // * constant expressions: | 365 // * constant expressions: |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 920 friend class SwitchBlock; | 941 friend class SwitchBlock; |
| 921 friend class TryCatchBlock; | 942 friend class TryCatchBlock; |
| 922 friend class TryFinallyBlock; | 943 friend class TryFinallyBlock; |
| 923 }; | 944 }; |
| 924 | 945 |
| 925 } // namespace kernel | 946 } // namespace kernel |
| 926 } // namespace dart | 947 } // namespace dart |
| 927 | 948 |
| 928 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 949 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
| 929 #endif // RUNTIME_VM_KERNEL_TO_IL_H_ | 950 #endif // RUNTIME_VM_KERNEL_TO_IL_H_ |
| OLD | NEW |