Support when a property is specified by a string literal instead of a nameof expression

In earlier versions of the Razor generator, a string literal was used
instead of a `nameof` expression in order to indicate the name of the
property being modified. This means we need to look up the property by
name instead of using a more explicit access.
This commit is contained in:
Edward Minnix III
2025-03-08 17:16:22 -05:00
committed by Tamas Vajk
parent 342d4a6982
commit 52b889f008

View File

@@ -159,7 +159,13 @@ private module JumpNodes {
*/
Property getParameterProperty() {
result.getAnAttribute() instanceof MicrosoftAspNetCoreComponentsParameterAttribute and
exists(NameOfExpr ne | ne = this.getArgument(1) | result.getAnAccess() = ne.getAccess())
(
exists(NameOfExpr ne | ne = this.getArgument(1) | result.getAnAccess() = ne.getAccess())
or
exists(string propertyName | propertyName = this.getArgument(1).(StringLiteral).getValue() |
result.hasName(propertyName)
)
)
}
/**