Skip to content

MemberExpression

Create a member expression from parts. Each part can provide one of the following:

  • id: The identifier for the member expression part
  • refkey: a refkey for a symbol whose name becomes the identifier
  • symbol: a symbol whose name becomes the identifier part
  • args: create a method call with the given args
  • children: arbitrary contents for the identifier part.
import { MemberExpression } from "@alloy-js/python";
<MemberExpression >
{children}
</MemberExpression>
childrenChildren
<MemberExpression>
<MemberExpression.Part id="base" />
<MemberExpression.Part refkey={rk} />
<MemberExpression.Part symbol={sym} />
<MemberExpression.Part args={["hello", "world"]} />
<MemberExpression.Part>SomeValue</MemberExpression.Part>
</MemberExpression>

Assuming rk is a refkey to a symbol name “prop1”, and sym is a symbol with a name of “prop2”, this will render:

base.prop1.prop2("hello", "world").SomeValue