forked from Azure/bicep
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IR part 1: Introduce IR for simple syntax conversions (Azure#9047)
- Loading branch information
1 parent
2bdb13b
commit d9f8f68
Showing
5 changed files
with
226 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
using System.Collections.Immutable; | ||
using Bicep.Core.Syntax; | ||
|
||
namespace Bicep.Core.Intermediate; | ||
|
||
public abstract record Expression() | ||
{ | ||
public abstract void Accept(IExpressionVisitor visitor); | ||
} | ||
|
||
public record BooleanLiteralExpression( | ||
bool Value | ||
) : Expression | ||
{ | ||
public override void Accept(IExpressionVisitor visitor) | ||
=> visitor.VisitBooleanLiteralExpression(this); | ||
} | ||
|
||
public record IntegerLiteralExpression( | ||
long Value | ||
) : Expression | ||
{ | ||
public override void Accept(IExpressionVisitor visitor) | ||
=> visitor.VisitIntegerLiteralExpression(this); | ||
} | ||
|
||
public record StringLiteralExpression( | ||
string Value | ||
) : Expression | ||
{ | ||
public override void Accept(IExpressionVisitor visitor) | ||
=> visitor.VisitStringLiteralExpression(this); | ||
} | ||
|
||
public record NullLiteralExpression() : Expression | ||
{ | ||
public override void Accept(IExpressionVisitor visitor) | ||
=> visitor.VisitNullLiteralExpression(this); | ||
} | ||
|
||
public record SyntaxExpression( | ||
SyntaxBase Syntax | ||
) : Expression | ||
{ | ||
public override void Accept(IExpressionVisitor visitor) | ||
=> visitor.VisitSyntaxExpression(this); | ||
} | ||
|
||
public record InterpolatedStringExpression( | ||
ImmutableArray<string> SegmentValues, | ||
ImmutableArray<Expression> Expressions | ||
) : Expression | ||
{ | ||
public override void Accept(IExpressionVisitor visitor) | ||
=> visitor.VisitInterpolatedStringExpression(this); | ||
} | ||
|
||
public record ObjectProperty( | ||
Expression Key, | ||
Expression Value); | ||
|
||
public record ObjectExpression( | ||
ImmutableArray<ObjectProperty> Properties | ||
) : Expression | ||
{ | ||
public override void Accept(IExpressionVisitor visitor) | ||
=> visitor.VisitObjectExpression(this); | ||
} | ||
|
||
public record ArrayExpression( | ||
ImmutableArray<Expression> Items | ||
) : Expression | ||
{ | ||
public override void Accept(IExpressionVisitor visitor) | ||
=> visitor.VisitArrayExpression(this); | ||
} |
Oops, something went wrong.