[vm] documentation of TypeArguments vs arguments
Change-Id: I1bae456f70c79ac7c56c380b106e9ac8c89eaef6
Reviewed-on: https://dart-review.googlesource.com/c/87584
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index fed6805..9a89acf 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -16032,6 +16032,7 @@
}
RawTypeArguments* Instance::GetTypeArguments() const {
+ ASSERT(!IsType());
const Class& cls = Class::Handle(clazz());
intptr_t field_offset = cls.type_arguments_field_offset();
ASSERT(field_offset != Class::kNoTypeArguments);
@@ -16041,6 +16042,7 @@
}
void Instance::SetTypeArguments(const TypeArguments& value) const {
+ ASSERT(!IsType());
ASSERT(value.IsNull() || value.IsCanonical());
const Class& cls = Class::Handle(clazz());
intptr_t field_offset = cls.type_arguments_field_offset();
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index ec52787..95a86b9 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -5834,6 +5834,9 @@
RawAbstractType* GetType(Heap::Space space) const;
+ // Access the arguments of the [Type] of this [Instance].
+ // Note: for [Type]s instead of [Instance]s with a [Type] attached, use
+ // [arguments()] and [set_arguments()]
virtual RawTypeArguments* GetTypeArguments() const;
virtual void SetTypeArguments(const TypeArguments& value) const;