Просмотр исходного кода

Explain BoundMethod and function_id a bit more (#4739)

Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
Dana Jansens 1 год назад
Родитель
Сommit
bf5c891540
1 измененных файлов с 4 добавлено и 2 удалено
  1. 4 2
      toolchain/sem_ir/typed_insts.h

+ 4 - 2
toolchain/sem_ir/typed_insts.h

@@ -384,8 +384,9 @@ struct BoolLiteral {
   BoolValue value;
 };
 
-// A bound method, that combines a function with the value to use for its
-// `self` parameter, such as `object.MethodName`.
+// For member access such as `object.MethodName`, combines a member function
+// with the value to use for `self`. This is a callable structure; `Call` will
+// handle the argument assignment.
 struct BoundMethod {
   static constexpr auto Kind = InstKind::BoundMethod.Define<Parse::NodeId>(
       {.ir_name = "bound_method",
@@ -396,6 +397,7 @@ struct BoundMethod {
   // `self`, or whose address will be used to initialize `self` for an `addr
   // self` parameter.
   InstId object_id;
+  // The function being bound, whose type_id is always a `FunctionType`.
   InstId function_id;
 };