OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 #include "vm/class_finalizer.h" | 5 #include "vm/class_finalizer.h" |
6 | 6 |
7 #include "vm/code_generator.h" | 7 #include "vm/code_generator.h" |
8 #include "vm/flags.h" | 8 #include "vm/flags.h" |
9 #include "vm/heap.h" | 9 #include "vm/heap.h" |
10 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 | 724 |
725 // Check the type argument vector 'arguments' against the corresponding bounds | 725 // Check the type argument vector 'arguments' against the corresponding bounds |
726 // of the type parameters of class 'cls' and, recursively, of its superclasses. | 726 // of the type parameters of class 'cls' and, recursively, of its superclasses. |
727 // Replace a type argument that cannot be checked at compile time by a | 727 // Replace a type argument that cannot be checked at compile time by a |
728 // BoundedType, thereby postponing the bound check to run time. | 728 // BoundedType, thereby postponing the bound check to run time. |
729 // Return a bound error if a type argument is not within bound at compile time. | 729 // Return a bound error if a type argument is not within bound at compile time. |
730 void ClassFinalizer::CheckTypeArgumentBounds(const Class& cls, | 730 void ClassFinalizer::CheckTypeArgumentBounds(const Class& cls, |
731 const TypeArguments& arguments, | 731 const TypeArguments& arguments, |
732 Error* bound_error) { | 732 Error* bound_error) { |
733 if (!cls.is_type_finalized()) { | 733 if (!cls.is_type_finalized()) { |
| 734 FinalizeTypeParameters(cls); |
734 FinalizeUpperBounds(cls); | 735 FinalizeUpperBounds(cls); |
735 } | 736 } |
736 // Note that when finalizing a type, we need to verify the bounds in both | 737 // Note that when finalizing a type, we need to verify the bounds in both |
737 // production mode and checked mode, because the finalized type may be written | 738 // production mode and checked mode, because the finalized type may be written |
738 // to a snapshot. It would be wrong to ignore bounds when generating the | 739 // to a snapshot. It would be wrong to ignore bounds when generating the |
739 // snapshot in production mode and then use the unchecked type in checked mode | 740 // snapshot in production mode and then use the unchecked type in checked mode |
740 // after reading it from the snapshot. | 741 // after reading it from the snapshot. |
741 // However, we do not immediately report a bound error, which would be wrong | 742 // However, we do not immediately report a bound error, which would be wrong |
742 // in production mode, but simply postpone the bound checking to runtime. | 743 // in production mode, but simply postpone the bound checking to runtime. |
743 const intptr_t num_type_params = cls.NumTypeParameters(); | 744 const intptr_t num_type_params = cls.NumTypeParameters(); |
(...skipping 2328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3072 expected_name ^= String::New("_offset"); | 3073 expected_name ^= String::New("_offset"); |
3073 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name)); | 3074 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name)); |
3074 field ^= fields_array.At(2); | 3075 field ^= fields_array.At(2); |
3075 ASSERT(field.Offset() == TypedDataView::length_offset()); | 3076 ASSERT(field.Offset() == TypedDataView::length_offset()); |
3076 name ^= field.name(); | 3077 name ^= field.name(); |
3077 ASSERT(name.Equals("length")); | 3078 ASSERT(name.Equals("length")); |
3078 #endif | 3079 #endif |
3079 } | 3080 } |
3080 | 3081 |
3081 } // namespace dart | 3082 } // namespace dart |
OLD | NEW |