Skip to content

Commit a7c241e

Browse files
committed
Move Clone to GeneratBindingPropertyResolvers
1 parent 4854507 commit a7c241e

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

src/Framework/Framework/Compilation/Binding/GeneralBindingPropertyResolvers.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ public SimplePathExpressionBindingProperty FormatSimplePath(IBinding binding)
142142
// if contains api parameter, can't use this as a path
143143
if (js.Expression.DescendantNodes().Any(n => n.TryGetAnnotation(out ViewModelInfoAnnotation? vmInfo) && vmInfo.ExtensionParameter is RestApiRegistrationHelpers.ApiExtensionParameter apiParameter))
144144
throw new Exception($"Can't get a path expression for command binding from binding that is using rest api.");
145-
return new(js.Expression.FormatParametrizedScript());
145+
var expr = js.Expression.Clone(); // need to Clone, because js.Expression is frozen and not parethesized
146+
return new(expr.FormatParametrizedScript());
146147
}
147148
else if (binding.GetProperty<KnockoutExpressionBindingProperty>(ErrorHandlingMode.ReturnNull) is { } expr)
148149
{

src/Framework/Framework/Compilation/Javascript/Ast/JsAstHelpers.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@ public static ParametrizedCode FormatParametrizedScript(this JsNode node, bool n
7373
{
7474
if (node is null)
7575
throw new ArgumentNullException(nameof(node));
76-
// FixParenthesis modifies the tree in-place; if the node is frozen we must clone it first
77-
if (node.IsFrozen) node = node.Clone();
7876
node = node.FixParenthesis();
7977
var visitor = new JsFormattingVisitor(niceMode, indent);
8078
node.AcceptVisitor(visitor);

0 commit comments

Comments
 (0)