Skip to content

Commit c9ba99a

Browse files
rmacnak-googlecommit-bot@chromium.org
authored andcommitted
[vm, compiler] Make the difference between the CompileTypes for int and _IntegerImplementation visible when printing IL.
TEST=ci Change-Id: I17f6a79e3642a809a57f7d240c3894a093429a81 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191460 Commit-Queue: Ryan Macnak <[email protected]> Reviewed-by: Régis Crelier <[email protected]>
1 parent 11e922f commit c9ba99a

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

runtime/vm/compiler/backend/type_propagator.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -900,7 +900,7 @@ void CompileType::PrintTo(BaseTextBuffer* f) const {
900900
} else if (type_ != NULL) {
901901
type_name = type_->IsDynamicType()
902902
? "*"
903-
: String::Handle(type_->UserVisibleName()).ToCString();
903+
: String::Handle(type_->ScrubbedName()).ToCString();
904904
} else if (!is_nullable()) {
905905
type_name = "!null";
906906
}

runtime/vm/object.cc

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19433,7 +19433,7 @@ const char* AbstractType::NullabilitySuffix(
1943319433
case Nullability::kNonNullable:
1943419434
return "";
1943519435
case Nullability::kLegacy:
19436-
return (FLAG_show_internal_names || name_visibility == kInternalName)
19436+
return (FLAG_show_internal_names || name_visibility != kUserVisibleName)
1943719437
? "*"
1943819438
: "";
1943919439
default:
@@ -19455,6 +19455,13 @@ StringPtr AbstractType::UserVisibleName() const {
1945519455
return Symbols::New(thread, printer.buffer());
1945619456
}
1945719457

19458+
StringPtr AbstractType::ScrubbedName() const {
19459+
Thread* thread = Thread::Current();
19460+
ZoneTextBuffer printer(thread->zone());
19461+
PrintName(kScrubbedName, &printer);
19462+
return Symbols::New(thread, printer.buffer());
19463+
}
19464+
1945819465
void AbstractType::PrintName(NameVisibility name_visibility,
1945919466
BaseTextBuffer* printer) const {
1946019467
if (IsTypeRef()) {
@@ -19464,11 +19471,9 @@ void AbstractType::PrintName(NameVisibility name_visibility,
1946419471
ref_type.PrintName(name_visibility, printer);
1946519472
return;
1946619473
}
19467-
ASSERT(name_visibility != kScrubbedName);
1946819474
Thread* thread = Thread::Current();
1946919475
Zone* zone = thread->zone();
1947019476
Class& cls = Class::Handle(zone);
19471-
String& name_str = String::Handle(zone);
1947219477
if (IsTypeParameter()) {
1947319478
const TypeParameter& type_param = TypeParameter::Cast(*this);
1947419479
printer->AddString(String::Handle(type_param.name()).ToCString());
@@ -19494,14 +19499,7 @@ void AbstractType::PrintName(NameVisibility name_visibility,
1949419499
cls = type_class();
1949519500
// Do not print the full vector, but only the declared type parameters.
1949619501
num_type_params = cls.NumTypeParameters();
19497-
if (name_visibility == kInternalName) {
19498-
name_str = cls.Name();
19499-
printer->AddString(name_str.ToCString());
19500-
} else {
19501-
ASSERT(name_visibility == kUserVisibleName);
19502-
// Map internal types to their corresponding public interfaces.
19503-
printer->AddString(cls.UserVisibleNameCString());
19504-
}
19502+
printer->AddString(cls.NameCString(name_visibility));
1950519503
if (num_type_params > num_args) {
1950619504
first_type_param_index = 0;
1950719505
if (!IsFinalized() || IsBeingFinalized()) {

runtime/vm/object.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7682,6 +7682,10 @@ class AbstractType : public Instance {
76827682
// Names of internal classes are mapped to their public interfaces.
76837683
virtual StringPtr UserVisibleName() const;
76847684

7685+
// The name of this type, including the names of its type arguments, if any.
7686+
// Privacy suffixes are dropped.
7687+
virtual StringPtr ScrubbedName() const;
7688+
76857689
// Return the internal or public name of this type, including the names of its
76867690
// type arguments, if any.
76877691
void PrintName(NameVisibility visibility, BaseTextBuffer* printer) const;

0 commit comments

Comments
 (0)