public static LNode @nameof(LNode nameof, IMacroContext context) { if (nameof.ArgCount != 1) { return(null); } Symbol expr = EcsValidators.KeyNameComponentOf(nameof.Args[0]); return(F.Literal(expr.Name)); }
/// <summary>Retrieves the "key" name component for the nameof(...) macro.</summary> /// <remarks> /// The key name component of <c>global::Foo!int.Bar!T(x)</c> (in C# notation /// global::Foo<int>.Bar<T>(x)) is <c>Bar</c>. This example tree has the /// structure <c>((((global::Foo)!int).Bar)!T)(x)</c>). /// </remarks> public static Symbol KeyNameComponentOf(LNode name) { return(EcsValidators.KeyNameComponentOf(name)); }