Explorar o código

Explain BoundMethod and function_id a bit more (#4739)

Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
Dana Jansens hai 1 ano
pai
achega
bf5c891540
Modificáronse 1 ficheiros con 4 adicións e 2 borrados
  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;
 };