Skip to content

Commit

Permalink
moving the fix introduced in last iteration from ExpressionBuilder an…
Browse files Browse the repository at this point in the history
…d add it to the correct location
  • Loading branch information
ouldsid committed Feb 7, 2025
1 parent 4bc280e commit dea5122
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/Bicep.Core/Emit/PlaceholderParametersBicepParamWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ public static SyntaxBase GetValueForParameter(ParameterDeclarationSyntax syntax,
{
if (e.Value is FunctionCallSyntax valueAsFunctionCall)
{
return SyntaxFactory.CreateArrayItem(CreateCommentSyntaxForFunctionCallSyntax(valueAsFunctionCall.Name.IdentifierName, isJsonParamWriter));
return SyntaxFactory.CreateArrayItem(CreateCommentSyntaxForFunctionCallSyntax(valueAsFunctionCall.Name.IdentifierName, isJsonParamWriter)).Value;
}

return e;
return e.Value;
}).ToList();

return SyntaxFactory.CreateArray(value);
Expand Down
3 changes: 2 additions & 1 deletion src/Bicep.Core/Emit/PlaceholderParametersJsonWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ private JToken GenerateTemplate(string contentVersion)

jsonWriter.WriteStartObject();

// emit value property only if the value is not a newline token
// Emit value property only if the value is not a newline token.
// GetValueForParameter return TokenType.NewLine when syntax of assigning the value is not correct
if (value is not Token { Type: TokenType.NewLine})
{
emitter.EmitProperty("value", value);
Expand Down
12 changes: 1 addition & 11 deletions src/Bicep.Core/Intermediate/ExpressionBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -735,17 +735,7 @@ void completePreviousChunk()
}
else if (child is ArrayItemSyntax arrayItem)
{
if (arrayItem.Value is not null && arrayItem.Value is ArrayItemSyntax arrayItemInside)
{
currentChunk.Add(ConvertWithoutLowering(arrayItemInside.Value));
}
else
{
if (arrayItem.Value is not null)
{
currentChunk.Add(ConvertWithoutLowering(arrayItem.Value));
}
}
currentChunk.Add(ConvertWithoutLowering(arrayItem.Value));
}
}
completePreviousChunk();
Expand Down

0 comments on commit dea5122

Please sign in to comment.