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

Side by Side Diff: runtime/vm/object.cc

Issue 1654273003: Fix typedef cycle check (fixes #25620). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « runtime/vm/class_finalizer.cc ('k') | tests/language/regress_25620_test.dart » ('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) 2012, 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 #include "vm/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 15691 matching lines...) Expand 10 before | Expand all | Expand 10 after
15702 // If the type is still being finalized, we may be reporting an error about 15702 // If the type is still being finalized, we may be reporting an error about
15703 // a malformed type, so proceed with caution. 15703 // a malformed type, so proceed with caution.
15704 const TypeArguments& args = TypeArguments::Handle(zone, arguments()); 15704 const TypeArguments& args = TypeArguments::Handle(zone, arguments());
15705 const intptr_t num_args = args.IsNull() ? 0 : args.Length(); 15705 const intptr_t num_args = args.IsNull() ? 0 : args.Length();
15706 String& class_name = String::Handle(zone); 15706 String& class_name = String::Handle(zone);
15707 intptr_t first_type_param_index; 15707 intptr_t first_type_param_index;
15708 intptr_t num_type_params; // Number of type parameters to print. 15708 intptr_t num_type_params; // Number of type parameters to print.
15709 Class& cls = Class::Handle(zone); 15709 Class& cls = Class::Handle(zone);
15710 if (IsFunctionType()) { 15710 if (IsFunctionType()) {
15711 cls = type_class(); 15711 cls = type_class();
15712 if (!cls.IsTypedefClass()) { 15712 const Function& signature_function = Function::Handle(
15713 const Function& signature_function = Function::Handle( 15713 zone, FunctionType::Cast(*this).signature());
15714 zone, FunctionType::Cast(*this).signature()); 15714 if (!cls.IsTypedefClass() ||
15715 (cls.signature_function() != signature_function.raw())) {
15715 if (!IsFinalized() || IsBeingFinalized() || IsMalformed()) { 15716 if (!IsFinalized() || IsBeingFinalized() || IsMalformed()) {
15716 return signature_function.UserVisibleSignature(); 15717 return signature_function.UserVisibleSignature();
15717 } 15718 }
15718 return signature_function.InstantiatedSignatureFrom(args, 15719 return signature_function.InstantiatedSignatureFrom(args,
15719 name_visibility); 15720 name_visibility);
15720 } 15721 }
15721 class_name = cls.Name(); // Typedef name. 15722 class_name = cls.Name(); // Typedef name.
15722 // We may be reporting an error about a malformed function type. In that 15723 // We may be reporting an error about a malformed function type. In that
15723 // case, avoid instantiating the signature, since it may cause divergence. 15724 // case, avoid instantiating the signature, since it may cause divergence.
15724 if (!IsFinalized() || IsBeingFinalized() || IsMalformed()) { 15725 if (!IsFinalized() || IsBeingFinalized() || IsMalformed()) {
(...skipping 1409 matching lines...) Expand 10 before | Expand all | Expand 10 after
17134 (state <= RawFunctionType::kFinalizedUninstantiated)); 17135 (state <= RawFunctionType::kFinalizedUninstantiated));
17135 StoreNonPointer(&raw_ptr()->type_state_, state); 17136 StoreNonPointer(&raw_ptr()->type_state_, state);
17136 } 17137 }
17137 17138
17138 17139
17139 const char* FunctionType::ToCString() const { 17140 const char* FunctionType::ToCString() const {
17140 const char* unresolved = IsResolved() ? "" : "Unresolved "; 17141 const char* unresolved = IsResolved() ? "" : "Unresolved ";
17141 const Class& scope_cls = Class::Handle(scope_class()); 17142 const Class& scope_cls = Class::Handle(scope_class());
17142 const TypeArguments& type_arguments = TypeArguments::Handle(arguments()); 17143 const TypeArguments& type_arguments = TypeArguments::Handle(arguments());
17143 const Function& signature_function = Function::Handle(signature()); 17144 const Function& signature_function = Function::Handle(signature());
17144 const String& signature_string = String::Handle( 17145 const String& signature_string = IsFinalized() ?
17145 signature_function.InstantiatedSignatureFrom(type_arguments, 17146 String::Handle(
17146 kInternalName)); 17147 signature_function.InstantiatedSignatureFrom(type_arguments,
17148 kInternalName)) :
17149 String::Handle(signature_function.Signature());
17147 if (scope_cls.IsClosureClass()) { 17150 if (scope_cls.IsClosureClass()) {
17148 ASSERT(arguments() == TypeArguments::null()); 17151 ASSERT(arguments() == TypeArguments::null());
17149 return OS::SCreate( 17152 return OS::SCreate(
17150 Thread::Current()->zone(), 17153 Thread::Current()->zone(),
17151 "%sFunctionType: %s", unresolved, signature_string.ToCString()); 17154 "%sFunctionType: %s", unresolved, signature_string.ToCString());
17152 } 17155 }
17153 const char* class_name = String::Handle(scope_cls.Name()).ToCString(); 17156 const char* class_name = String::Handle(scope_cls.Name()).ToCString();
17154 const char* args_cstr = 17157 const char* args_cstr =
17155 type_arguments.IsNull() ? "null" : type_arguments.ToCString(); 17158 type_arguments.IsNull() ? "null" : type_arguments.ToCString();
17156 return OS::SCreate( 17159 return OS::SCreate(
(...skipping 5682 matching lines...) Expand 10 before | Expand all | Expand 10 after
22839 return tag_label.ToCString(); 22842 return tag_label.ToCString();
22840 } 22843 }
22841 22844
22842 22845
22843 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 22846 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
22844 Instance::PrintJSONImpl(stream, ref); 22847 Instance::PrintJSONImpl(stream, ref);
22845 } 22848 }
22846 22849
22847 22850
22848 } // namespace dart 22851 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/class_finalizer.cc ('k') | tests/language/regress_25620_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698