Skip to content

Commit

Permalink
validate if, elseif and each expr syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherHX committed Jul 27, 2024
1 parent 4e8df48 commit 38f34f8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Sdk/DTObjectTemplating/ObjectTemplating/TemplateReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -702,15 +702,15 @@ private ExpressionToken ParseExpression(
{
return null;
}
else if (extendedDirectives && MatchesDirective(trimmed, "if", 1, out parameters, out ex))
else if (extendedDirectives && MatchesDirective(trimmed, "if", 1, out parameters, out ex) && ExpressionToken.IsValidExpression(parameters[0], allowedContext, out ex, m_context.Flags))
{
return new IfExpressionToken(m_fileId, line, column, parameters[0]);
}
else if (ex != null)
{
return null;
}
else if (extendedDirectives && MatchesDirective(trimmed, "elseif", 1, out parameters, out ex))
else if (extendedDirectives && MatchesDirective(trimmed, "elseif", 1, out parameters, out ex) && ExpressionToken.IsValidExpression(parameters[0], allowedContext, out ex, m_context.Flags))
{
return new ElseIfExpressionToken(m_fileId, line, column, parameters[0]);
}
Expand All @@ -726,7 +726,7 @@ private ExpressionToken ParseExpression(
{
return null;
}
else if (extendedDirectives && MatchesDirective(trimmed, "each", 3, out parameters, out ex) && parameters[1] == "in")
else if (extendedDirectives && MatchesDirective(trimmed, "each", 3, out parameters, out ex) && parameters[1] == "in" && ExpressionToken.IsValidExpression(parameters[2], allowedContext, out ex, m_context.Flags))
{
return new EachExpressionToken(m_fileId, line, column, parameters[0], parameters[2]);
}
Expand Down

0 comments on commit 38f34f8

Please sign in to comment.