| 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/flags.h" | 7 #include "vm/flags.h" |
| 8 #include "vm/heap.h" | 8 #include "vm/heap.h" |
| 9 #include "vm/isolate.h" | 9 #include "vm/isolate.h" |
| 10 #include "vm/longjump.h" | 10 #include "vm/longjump.h" |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 ReportError(script, factory.token_pos(), | 370 ReportError(script, factory.token_pos(), |
| 371 "constructor '%s' must be const as required by redirecting" | 371 "constructor '%s' must be const as required by redirecting" |
| 372 "const factory '%s'", | 372 "const factory '%s'", |
| 373 String::Handle(target.name()).ToCString(), | 373 String::Handle(target.name()).ToCString(), |
| 374 String::Handle(factory.name()).ToCString()); | 374 String::Handle(factory.name()).ToCString()); |
| 375 } | 375 } |
| 376 | 376 |
| 377 // Update redirection data with resolved target. | 377 // Update redirection data with resolved target. |
| 378 factory.SetRedirectionTarget(target); | 378 factory.SetRedirectionTarget(target); |
| 379 // Not needed anymore. | 379 // Not needed anymore. |
| 380 factory.SetRedirectionIdentifier(String::null_object()); | 380 factory.SetRedirectionIdentifier(Object::null_string()); |
| 381 if (!target.IsRedirectingFactory()) { | 381 if (!target.IsRedirectingFactory()) { |
| 382 return; | 382 return; |
| 383 } | 383 } |
| 384 | 384 |
| 385 // The target is itself a redirecting factory. Recursively resolve its own | 385 // The target is itself a redirecting factory. Recursively resolve its own |
| 386 // target and update the current redirection data to point to the end target | 386 // target and update the current redirection data to point to the end target |
| 387 // of the redirection chain. | 387 // of the redirection chain. |
| 388 ResolveRedirectingFactoryTarget(target_class, target, visited_factories); | 388 ResolveRedirectingFactoryTarget(target_class, target, visited_factories); |
| 389 Type& target_type = Type::Handle(target.RedirectionType()); | 389 Type& target_type = Type::Handle(target.RedirectionType()); |
| 390 Function& target_target = Function::Handle(target.RedirectionTarget()); | 390 Function& target_target = Function::Handle(target.RedirectionTarget()); |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 878 parameterized_type.UserVisibleName()); | 878 parameterized_type.UserVisibleName()); |
| 879 const Type& malformed_bound = Type::Handle( | 879 const Type& malformed_bound = Type::Handle( |
| 880 NewFinalizedMalformedType(bound_error, | 880 NewFinalizedMalformedType(bound_error, |
| 881 cls, | 881 cls, |
| 882 parameterized_type.token_pos(), | 882 parameterized_type.token_pos(), |
| 883 bound_finalization, | 883 bound_finalization, |
| 884 "type '%s' has an out of bound type argument", | 884 "type '%s' has an out of bound type argument", |
| 885 parameterized_type_name.ToCString())); | 885 parameterized_type_name.ToCString())); |
| 886 return BoundedType::New(parameterized_type, | 886 return BoundedType::New(parameterized_type, |
| 887 malformed_bound, | 887 malformed_bound, |
| 888 TypeParameter::null_object()); | 888 TypeParameter::Handle()); |
| 889 } | 889 } |
| 890 | 890 |
| 891 if (finalization >= kCanonicalize) { | 891 if (finalization >= kCanonicalize) { |
| 892 return parameterized_type.Canonicalize(); | 892 return parameterized_type.Canonicalize(); |
| 893 } else { | 893 } else { |
| 894 return parameterized_type.raw(); | 894 return parameterized_type.raw(); |
| 895 } | 895 } |
| 896 } | 896 } |
| 897 | 897 |
| 898 | 898 |
| (...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1910 } | 1910 } |
| 1911 } | 1911 } |
| 1912 // In checked mode, always mark the type as malformed. | 1912 // In checked mode, always mark the type as malformed. |
| 1913 // In production mode, mark the type as malformed only if its type class is | 1913 // In production mode, mark the type as malformed only if its type class is |
| 1914 // not resolved. | 1914 // not resolved. |
| 1915 // In both mode, make the type raw, since it may not be possible to | 1915 // In both mode, make the type raw, since it may not be possible to |
| 1916 // properly finalize its type arguments. | 1916 // properly finalize its type arguments. |
| 1917 if (FLAG_enable_type_checks || !type.HasResolvedTypeClass()) { | 1917 if (FLAG_enable_type_checks || !type.HasResolvedTypeClass()) { |
| 1918 type.set_malformed_error(error); | 1918 type.set_malformed_error(error); |
| 1919 } | 1919 } |
| 1920 type.set_arguments(AbstractTypeArguments::null_object()); | 1920 type.set_arguments(Object::null_abstract_type_arguments()); |
| 1921 if (!type.IsFinalized()) { | 1921 if (!type.IsFinalized()) { |
| 1922 type.SetIsFinalized(); | 1922 type.SetIsFinalized(); |
| 1923 // Do not canonicalize malformed types, since they may not be resolved. | 1923 // Do not canonicalize malformed types, since they may not be resolved. |
| 1924 } else { | 1924 } else { |
| 1925 // The only case where the malformed type was already finalized is when its | 1925 // The only case where the malformed type was already finalized is when its |
| 1926 // type arguments are not within bounds. In that case, we have a prev_error. | 1926 // type arguments are not within bounds. In that case, we have a prev_error. |
| 1927 ASSERT(!prev_error.IsNull()); | 1927 ASSERT(!prev_error.IsNull()); |
| 1928 } | 1928 } |
| 1929 } | 1929 } |
| 1930 | 1930 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2044 expected_name ^= String::New("_offset"); | 2044 expected_name ^= String::New("_offset"); |
| 2045 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name)); | 2045 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name)); |
| 2046 field ^= fields_array.At(2); | 2046 field ^= fields_array.At(2); |
| 2047 ASSERT(field.Offset() == TypedDataView::length_offset()); | 2047 ASSERT(field.Offset() == TypedDataView::length_offset()); |
| 2048 name ^= field.name(); | 2048 name ^= field.name(); |
| 2049 ASSERT(name.Equals("length")); | 2049 ASSERT(name.Equals("length")); |
| 2050 #endif | 2050 #endif |
| 2051 } | 2051 } |
| 2052 | 2052 |
| 2053 } // namespace dart | 2053 } // namespace dart |
| OLD | NEW |