Add BoundTreeRewriter
This commit is contained in:
parent
d613ea3f12
commit
652bd92f01
@ -70,14 +70,14 @@ namespace Parser.Binding
|
||||
private BoundIfStatement BindIfStatement(IfStatementSyntaxNode node)
|
||||
{
|
||||
var condition = BindExpression(node.Condition);
|
||||
var body = BindBlockStatement(node.Body);
|
||||
var elseIfClauses = node.ElseifClauses
|
||||
var body = BindStatement(node.Body);
|
||||
var elseifClauses = node.ElseifClauses
|
||||
.Where(n => n.IsNode)
|
||||
.Select(n => (ElseifClause)n.AsNode()!);
|
||||
var builder = ImmutableArray.CreateBuilder<BoundElseIfClause>();
|
||||
foreach (var elseIfClause in elseIfClauses)
|
||||
var builder = ImmutableArray.CreateBuilder<BoundElseifClause>();
|
||||
foreach (var elseifClause in elseifClauses)
|
||||
{
|
||||
var clause = BindElseIfClause(elseIfClause);
|
||||
var clause = BindElseifClause(elseifClause);
|
||||
builder.Add(clause);
|
||||
}
|
||||
var maybeElseClause = node.ElseClause switch
|
||||
@ -86,12 +86,12 @@ namespace Parser.Binding
|
||||
_ => null,
|
||||
};
|
||||
|
||||
return new BoundIfStatement(node, condition, body, elseIfClauses, maybeElseClause);
|
||||
return new BoundIfStatement(node, condition, body, builder.ToImmutable(), maybeElseClause);
|
||||
}
|
||||
|
||||
private BoundElseClause BindElseClause(ElseClause node)
|
||||
{
|
||||
var body = BindBlockStatement(node.Body);
|
||||
var body = BindStatement(node.Body);
|
||||
return new BoundElseClause(node, body);
|
||||
}
|
||||
|
||||
@ -127,11 +127,11 @@ namespace Parser.Binding
|
||||
return builder.ToImmutable();
|
||||
}
|
||||
|
||||
private BoundElseIfClause BindElseIfClause(ElseifClause node)
|
||||
private BoundElseifClause BindElseifClause(ElseifClause node)
|
||||
{
|
||||
var condition = BindExpression(node.Condition);
|
||||
var body = BindBlockStatement(node.Body);
|
||||
return new BoundElseIfClause(node, condition, body);
|
||||
var body = BindStatement(node.Body);
|
||||
return new BoundElseifClause(node, condition, body);
|
||||
}
|
||||
|
||||
private BoundFunctionDeclaration BindFunctionDeclaration(FunctionDeclarationSyntaxNode node)
|
||||
|
48
Parser/Binding/BoundBinaryOperator.cs
Normal file
48
Parser/Binding/BoundBinaryOperator.cs
Normal file
@ -0,0 +1,48 @@
|
||||
using System.Linq;
|
||||
|
||||
namespace Parser.Binding
|
||||
{
|
||||
public class BoundBinaryOperator
|
||||
{
|
||||
private static BoundBinaryOperator[] _operators =
|
||||
{
|
||||
new BoundBinaryOperator(TokenKind.EqualsToken, BoundBinaryOperatorKind.Equals),
|
||||
new BoundBinaryOperator(TokenKind.PipePipeToken, BoundBinaryOperatorKind.PipePipe),
|
||||
new BoundBinaryOperator(TokenKind.AmpersandAmpersandToken, BoundBinaryOperatorKind.AmpersandAmpersand),
|
||||
new BoundBinaryOperator(TokenKind.PipeToken, BoundBinaryOperatorKind.Pipe),
|
||||
new BoundBinaryOperator(TokenKind.AmpersandToken, BoundBinaryOperatorKind.Ampersand),
|
||||
new BoundBinaryOperator(TokenKind.LessToken, BoundBinaryOperatorKind.Less),
|
||||
new BoundBinaryOperator(TokenKind.LessOrEqualsToken, BoundBinaryOperatorKind.LessOrEquals),
|
||||
new BoundBinaryOperator(TokenKind.GreaterToken, BoundBinaryOperatorKind.Greater),
|
||||
new BoundBinaryOperator(TokenKind.GreaterOrEqualsToken, BoundBinaryOperatorKind.GreaterOrEquals),
|
||||
new BoundBinaryOperator(TokenKind.EqualsEqualsToken, BoundBinaryOperatorKind.EqualsEquals),
|
||||
new BoundBinaryOperator(TokenKind.TildeEqualsToken, BoundBinaryOperatorKind.TildeEquals),
|
||||
new BoundBinaryOperator(TokenKind.ColonToken, BoundBinaryOperatorKind.Colon),
|
||||
new BoundBinaryOperator(TokenKind.PlusToken, BoundBinaryOperatorKind.Plus),
|
||||
new BoundBinaryOperator(TokenKind.MinusToken, BoundBinaryOperatorKind.Minus),
|
||||
new BoundBinaryOperator(TokenKind.StarToken, BoundBinaryOperatorKind.Star),
|
||||
new BoundBinaryOperator(TokenKind.DotStarToken, BoundBinaryOperatorKind.DotStar),
|
||||
new BoundBinaryOperator(TokenKind.SlashToken, BoundBinaryOperatorKind.Slash),
|
||||
new BoundBinaryOperator(TokenKind.DotSlashToken, BoundBinaryOperatorKind.DotSlash),
|
||||
new BoundBinaryOperator(TokenKind.BackslashToken, BoundBinaryOperatorKind.Backslash),
|
||||
new BoundBinaryOperator(TokenKind.DotBackslashToken, BoundBinaryOperatorKind.DotBackslash),
|
||||
new BoundBinaryOperator(TokenKind.TildeToken, BoundBinaryOperatorKind.Tilde),
|
||||
new BoundBinaryOperator(TokenKind.CaretToken, BoundBinaryOperatorKind.Caret),
|
||||
new BoundBinaryOperator(TokenKind.DotCaretToken, BoundBinaryOperatorKind.DotCaret),
|
||||
};
|
||||
|
||||
public BoundBinaryOperator(TokenKind syntaxKind, BoundBinaryOperatorKind kind)
|
||||
{
|
||||
SyntaxKind = syntaxKind;
|
||||
Kind = kind;
|
||||
}
|
||||
|
||||
public TokenKind SyntaxKind { get; }
|
||||
public BoundBinaryOperatorKind Kind { get; }
|
||||
|
||||
internal static BoundBinaryOperator? GetOperator(TokenKind kind)
|
||||
{
|
||||
return _operators.FirstOrDefault(op => op.SyntaxKind == kind);
|
||||
}
|
||||
}
|
||||
}
|
29
Parser/Binding/BoundBinaryOperatorKind.cs
Normal file
29
Parser/Binding/BoundBinaryOperatorKind.cs
Normal file
@ -0,0 +1,29 @@
|
||||
namespace Parser.Binding
|
||||
{
|
||||
public enum BoundBinaryOperatorKind
|
||||
{
|
||||
Equals,
|
||||
PipePipe,
|
||||
AmpersandAmpersand,
|
||||
Pipe,
|
||||
Ampersand,
|
||||
Less,
|
||||
LessOrEquals,
|
||||
Greater,
|
||||
GreaterOrEquals,
|
||||
EqualsEquals,
|
||||
TildeEquals,
|
||||
Colon,
|
||||
Plus,
|
||||
Minus,
|
||||
Star,
|
||||
DotStar,
|
||||
Slash,
|
||||
DotSlash,
|
||||
Backslash,
|
||||
DotBackslash,
|
||||
Tilde,
|
||||
Caret,
|
||||
DotCaret,
|
||||
}
|
||||
}
|
13
Parser/Binding/BoundNode.cs
Normal file
13
Parser/Binding/BoundNode.cs
Normal file
@ -0,0 +1,13 @@
|
||||
namespace Parser.Binding
|
||||
{
|
||||
public abstract class BoundNode
|
||||
{
|
||||
public BoundNode(SyntaxNode syntax)
|
||||
{
|
||||
Syntax = syntax;
|
||||
}
|
||||
|
||||
public SyntaxNode Syntax { get; }
|
||||
public abstract BoundNodeKind Kind { get; }
|
||||
}
|
||||
}
|
52
Parser/Binding/BoundNodeKind.cs
Normal file
52
Parser/Binding/BoundNodeKind.cs
Normal file
@ -0,0 +1,52 @@
|
||||
namespace Parser.Binding
|
||||
{
|
||||
public enum BoundNodeKind
|
||||
{
|
||||
Root,
|
||||
File,
|
||||
|
||||
// Statements
|
||||
|
||||
AbstractMethodDeclaration,
|
||||
BlockStatement,
|
||||
ClassDeclaration,
|
||||
ConcreteMethodDeclaration,
|
||||
EmptyStatement,
|
||||
ExpressionStatement,
|
||||
ForStatement,
|
||||
FunctionDeclaration,
|
||||
IfStatement,
|
||||
SwitchStatement,
|
||||
TryCatchStatement,
|
||||
WhileStatement,
|
||||
|
||||
// Expressions
|
||||
|
||||
ArrayLiteralExpression,
|
||||
AssignmentExpression,
|
||||
BinaryOperationExpression,
|
||||
CellArrayElementAccessExpression,
|
||||
CellArrayLiteralExpression,
|
||||
ClassInvokationExpression,
|
||||
CommandExpression,
|
||||
CompoundNameExpression,
|
||||
DoubleQuotedStringLiteralExpression,
|
||||
EmptyExpression,
|
||||
FunctionCallExpression,
|
||||
IdentifierNameExpression,
|
||||
IndirectMemberAccessExpression,
|
||||
LambdaExpression,
|
||||
MemberAccessExpression,
|
||||
NamedFunctionHandleExpression,
|
||||
NumberLiteralExpression,
|
||||
ParenthesizedExpression,
|
||||
StringLiteralExpression,
|
||||
UnaryPrefixOperationExpression,
|
||||
UnaryPostfixOperationExpression,
|
||||
UnquotedStringLiteralExpression,
|
||||
|
||||
// Parts
|
||||
ElseIfClause,
|
||||
ElseClause
|
||||
}
|
||||
}
|
@ -1,98 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Linq;
|
||||
|
||||
namespace Parser.Binding
|
||||
{
|
||||
public enum BoundNodeKind
|
||||
{
|
||||
Root,
|
||||
File,
|
||||
|
||||
// Statements
|
||||
|
||||
AbstractMethodDeclaration,
|
||||
BlockStatement,
|
||||
ClassDeclaration,
|
||||
ConcreteMethodDeclaration,
|
||||
EmptyStatement,
|
||||
ExpressionStatement,
|
||||
ForStatement,
|
||||
FunctionDeclaration,
|
||||
IfStatement,
|
||||
SwitchStatement,
|
||||
TryCatchStatement,
|
||||
WhileStatement,
|
||||
|
||||
// Expressions
|
||||
|
||||
ArrayLiteralExpression,
|
||||
AssignmentExpression,
|
||||
BinaryOperationExpression,
|
||||
CellArrayElementAccessExpression,
|
||||
CellArrayLiteralExpression,
|
||||
ClassInvokationExpression,
|
||||
CommandExpression,
|
||||
CompoundNameExpression,
|
||||
DoubleQuotedStringLiteralExpression,
|
||||
EmptyExpression,
|
||||
FunctionCallExpression,
|
||||
IdentifierNameExpression,
|
||||
IndirectMemberAccessExpression,
|
||||
LambdaExpression,
|
||||
MemberAccessExpression,
|
||||
NamedFunctionHandleExpression,
|
||||
NumberLiteralExpression,
|
||||
ParenthesizedExpression,
|
||||
StringLiteralExpression,
|
||||
UnaryPrefixOperationExpression,
|
||||
UnaryPostfixOperationExpression,
|
||||
UnquotedStringLiteralExpression,
|
||||
|
||||
// Parts
|
||||
ElseIfClause,
|
||||
ElseClause
|
||||
}
|
||||
|
||||
public enum BoundBinaryOperatorKind
|
||||
{
|
||||
Equals,
|
||||
PipePipe,
|
||||
AmpersandAmpersand,
|
||||
Pipe,
|
||||
Ampersand,
|
||||
Less,
|
||||
LessOrEquals,
|
||||
Greater,
|
||||
GreaterOrEquals,
|
||||
EqualsEquals,
|
||||
TildeEquals,
|
||||
Colon,
|
||||
Plus,
|
||||
Minus,
|
||||
Star,
|
||||
DotStar,
|
||||
Slash,
|
||||
DotSlash,
|
||||
Backslash,
|
||||
DotBackslash,
|
||||
Tilde,
|
||||
Caret,
|
||||
DotCaret,
|
||||
}
|
||||
|
||||
public abstract class BoundNode
|
||||
{
|
||||
public BoundNode(SyntaxNode syntax)
|
||||
{
|
||||
Syntax = syntax;
|
||||
}
|
||||
|
||||
public SyntaxNode Syntax { get; }
|
||||
public abstract BoundNodeKind Kind { get; }
|
||||
}
|
||||
|
||||
public class BoundRoot : BoundNode
|
||||
{
|
||||
public BoundRoot(SyntaxNode syntax, BoundFile file)
|
||||
@ -223,18 +133,18 @@ namespace Parser.Binding
|
||||
|
||||
public class BoundIfStatement : BoundStatement
|
||||
{
|
||||
public BoundIfStatement(SyntaxNode syntax, BoundExpression condition, BoundBlockStatement body, IEnumerable<ElseifClause> elseIfClauses, BoundElseClause? elseClause)
|
||||
public BoundIfStatement(SyntaxNode syntax, BoundExpression condition, BoundStatement body, ImmutableArray<BoundElseifClause> elseifClauses, BoundElseClause? elseClause)
|
||||
: base(syntax)
|
||||
{
|
||||
Condition = condition;
|
||||
Body = body;
|
||||
ElseIfClauses = elseIfClauses;
|
||||
ElseifClauses = elseifClauses;
|
||||
ElseClause = elseClause;
|
||||
}
|
||||
|
||||
public BoundExpression Condition { get; }
|
||||
public BoundBlockStatement Body { get; }
|
||||
public IEnumerable<ElseifClause> ElseIfClauses { get; }
|
||||
public BoundStatement Body { get; }
|
||||
public ImmutableArray<BoundElseifClause> ElseifClauses { get; }
|
||||
public BoundElseClause? ElseClause { get; }
|
||||
|
||||
public override BoundNodeKind Kind => BoundNodeKind.IfStatement;
|
||||
@ -523,9 +433,9 @@ namespace Parser.Binding
|
||||
public override BoundNodeKind Kind => BoundNodeKind.UnquotedStringLiteralExpression;
|
||||
}
|
||||
|
||||
public class BoundElseIfClause : BoundNode
|
||||
public class BoundElseifClause : BoundNode
|
||||
{
|
||||
public BoundElseIfClause(SyntaxNode syntax, BoundExpression condition, BoundBlockStatement body)
|
||||
public BoundElseifClause(SyntaxNode syntax, BoundExpression condition, BoundStatement body)
|
||||
: base(syntax)
|
||||
{
|
||||
Condition = condition;
|
||||
@ -533,63 +443,19 @@ namespace Parser.Binding
|
||||
}
|
||||
|
||||
public BoundExpression Condition { get; }
|
||||
public BoundBlockStatement Body { get; }
|
||||
public BoundStatement Body { get; }
|
||||
public override BoundNodeKind Kind => BoundNodeKind.ElseIfClause;
|
||||
}
|
||||
|
||||
public class BoundElseClause : BoundNode
|
||||
{
|
||||
public BoundElseClause(SyntaxNode syntax, BoundBlockStatement body)
|
||||
public BoundElseClause(SyntaxNode syntax, BoundStatement body)
|
||||
: base(syntax)
|
||||
{
|
||||
Body = body;
|
||||
}
|
||||
|
||||
public BoundBlockStatement Body { get; }
|
||||
public BoundStatement Body { get; }
|
||||
public override BoundNodeKind Kind => BoundNodeKind.ElseClause;
|
||||
}
|
||||
|
||||
public class BoundBinaryOperator
|
||||
{
|
||||
private static BoundBinaryOperator[] _operators =
|
||||
{
|
||||
new BoundBinaryOperator(TokenKind.EqualsToken, BoundBinaryOperatorKind.Equals),
|
||||
new BoundBinaryOperator(TokenKind.PipePipeToken, BoundBinaryOperatorKind.PipePipe),
|
||||
new BoundBinaryOperator(TokenKind.AmpersandAmpersandToken, BoundBinaryOperatorKind.AmpersandAmpersand),
|
||||
new BoundBinaryOperator(TokenKind.PipeToken, BoundBinaryOperatorKind.Pipe),
|
||||
new BoundBinaryOperator(TokenKind.AmpersandToken, BoundBinaryOperatorKind.Ampersand),
|
||||
new BoundBinaryOperator(TokenKind.LessToken, BoundBinaryOperatorKind.Less),
|
||||
new BoundBinaryOperator(TokenKind.LessOrEqualsToken, BoundBinaryOperatorKind.LessOrEquals),
|
||||
new BoundBinaryOperator(TokenKind.GreaterToken, BoundBinaryOperatorKind.Greater),
|
||||
new BoundBinaryOperator(TokenKind.GreaterOrEqualsToken, BoundBinaryOperatorKind.GreaterOrEquals),
|
||||
new BoundBinaryOperator(TokenKind.EqualsEqualsToken, BoundBinaryOperatorKind.EqualsEquals),
|
||||
new BoundBinaryOperator(TokenKind.TildeEqualsToken, BoundBinaryOperatorKind.TildeEquals),
|
||||
new BoundBinaryOperator(TokenKind.ColonToken, BoundBinaryOperatorKind.Colon),
|
||||
new BoundBinaryOperator(TokenKind.PlusToken, BoundBinaryOperatorKind.Plus),
|
||||
new BoundBinaryOperator(TokenKind.MinusToken, BoundBinaryOperatorKind.Minus),
|
||||
new BoundBinaryOperator(TokenKind.StarToken, BoundBinaryOperatorKind.Star),
|
||||
new BoundBinaryOperator(TokenKind.DotStarToken, BoundBinaryOperatorKind.DotStar),
|
||||
new BoundBinaryOperator(TokenKind.SlashToken, BoundBinaryOperatorKind.Slash),
|
||||
new BoundBinaryOperator(TokenKind.DotSlashToken, BoundBinaryOperatorKind.DotSlash),
|
||||
new BoundBinaryOperator(TokenKind.BackslashToken, BoundBinaryOperatorKind.Backslash),
|
||||
new BoundBinaryOperator(TokenKind.DotBackslashToken, BoundBinaryOperatorKind.DotBackslash),
|
||||
new BoundBinaryOperator(TokenKind.TildeToken, BoundBinaryOperatorKind.Tilde),
|
||||
new BoundBinaryOperator(TokenKind.CaretToken, BoundBinaryOperatorKind.Caret),
|
||||
new BoundBinaryOperator(TokenKind.DotCaretToken, BoundBinaryOperatorKind.DotCaret),
|
||||
};
|
||||
|
||||
public BoundBinaryOperator(TokenKind syntaxKind, BoundBinaryOperatorKind kind)
|
||||
{
|
||||
SyntaxKind = syntaxKind;
|
||||
Kind = kind;
|
||||
}
|
||||
|
||||
public TokenKind SyntaxKind { get; }
|
||||
public BoundBinaryOperatorKind Kind { get; }
|
||||
|
||||
internal static BoundBinaryOperator? GetOperator(TokenKind kind)
|
||||
{
|
||||
return _operators.FirstOrDefault(op => op.SyntaxKind == kind);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
396
Parser/Binding/BoundTreeRewriter.cs
Normal file
396
Parser/Binding/BoundTreeRewriter.cs
Normal file
@ -0,0 +1,396 @@
|
||||
using System;
|
||||
using System.Collections.Immutable;
|
||||
|
||||
namespace Parser.Binding
|
||||
{
|
||||
public abstract class BoundTreeRewriter
|
||||
{
|
||||
public virtual BoundStatement RewriteStatement(BoundStatement node)
|
||||
{
|
||||
return node.Kind switch
|
||||
{
|
||||
BoundNodeKind.AbstractMethodDeclaration =>
|
||||
RewriteAbstractMethodDeclaration((BoundAbstractMethodDeclaration)node),
|
||||
BoundNodeKind.BlockStatement =>
|
||||
RewriteBlockStatement((BoundBlockStatement)node),
|
||||
BoundNodeKind.ClassDeclaration =>
|
||||
RewriteClassDeclaration((BoundClassDeclaration)node),
|
||||
BoundNodeKind.ConcreteMethodDeclaration =>
|
||||
RewriteConcreteMethodDeclaration((BoundConcreteMethodDeclaration)node),
|
||||
BoundNodeKind.EmptyStatement =>
|
||||
RewriteEmptyStatement((BoundEmptyStatement)node),
|
||||
BoundNodeKind.ExpressionStatement =>
|
||||
RewriteExpressionStatement((BoundExpressionStatement)node),
|
||||
BoundNodeKind.ForStatement =>
|
||||
RewriteForStatement((BoundForStatement)node),
|
||||
BoundNodeKind.FunctionDeclaration =>
|
||||
RewriteFunctionDeclaration((BoundFunctionDeclaration)node),
|
||||
BoundNodeKind.IfStatement =>
|
||||
RewriteIfStatement((BoundIfStatement)node),
|
||||
BoundNodeKind.SwitchStatement =>
|
||||
RewriteSwitchStatement((BoundSwitchStatement)node),
|
||||
BoundNodeKind.TryCatchStatement =>
|
||||
RewriteTryCatchStatement((BoundTryCatchStatement)node),
|
||||
BoundNodeKind.WhileStatement =>
|
||||
RewriteWhileStatement((BoundWhileStatement)node),
|
||||
_ =>
|
||||
throw new Exception($"Invalid statement kind {node.Kind}."),
|
||||
};
|
||||
}
|
||||
|
||||
public virtual BoundStatement RewriteWhileStatement(BoundWhileStatement node)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public virtual BoundStatement RewriteTryCatchStatement(BoundTryCatchStatement node)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public virtual BoundStatement RewriteSwitchStatement(BoundSwitchStatement node)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public virtual BoundStatement RewriteIfStatement(BoundIfStatement node)
|
||||
{
|
||||
var condition = RewriteExpression(node.Condition);
|
||||
var body = RewriteStatement(node.Body);
|
||||
ImmutableArray<BoundElseifClause>.Builder? builder = null;
|
||||
for (var i = 0; i < node.ElseifClauses.Length; i++)
|
||||
{
|
||||
var oldClause = node.ElseifClauses[i];
|
||||
var newClause = RewriteElseifClause(oldClause);
|
||||
if (oldClause != newClause && builder is null)
|
||||
{
|
||||
builder = ImmutableArray.CreateBuilder<BoundElseifClause>(node.ElseifClauses.Length);
|
||||
for (var j = 0; j < i; i++)
|
||||
{
|
||||
builder.Add(node.ElseifClauses[j]);
|
||||
}
|
||||
}
|
||||
if (builder is not null)
|
||||
{
|
||||
builder.Add(newClause);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var elseIfClauses = builder is null ? node.ElseifClauses : builder.MoveToImmutable();
|
||||
var elseClause = node.ElseClause is null ? null : RewriteElseifClause(node.ElseClause);
|
||||
if (condition == node.Condition &&
|
||||
body == node.Body &&
|
||||
elseIfClauses == node.ElseifClauses &&
|
||||
elseClause == node.ElseClause )
|
||||
{
|
||||
return node;
|
||||
}
|
||||
|
||||
return new BoundIfStatement(node.Syntax, condition, body, elseIfClauses, elseClause);
|
||||
}
|
||||
|
||||
public virtual BoundElseClause RewriteElseifClause(BoundElseClause node)
|
||||
{
|
||||
var body = RewriteStatement(node.Body);
|
||||
if (body == node.Body)
|
||||
{
|
||||
return node;
|
||||
}
|
||||
|
||||
return new BoundElseClause(node.Syntax, body);
|
||||
}
|
||||
|
||||
public virtual BoundElseifClause RewriteElseifClause(BoundElseifClause node)
|
||||
{
|
||||
var condition = RewriteExpression(node.Condition);
|
||||
var body = RewriteStatement(node.Body);
|
||||
if (condition == node.Condition && body == node.Body)
|
||||
{
|
||||
return node;
|
||||
}
|
||||
|
||||
return new BoundElseifClause(node.Syntax, condition, body);
|
||||
}
|
||||
|
||||
public virtual BoundStatement RewriteFunctionDeclaration(BoundFunctionDeclaration node)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public virtual BoundStatement RewriteForStatement(BoundForStatement node)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public virtual BoundStatement RewriteExpressionStatement(BoundExpressionStatement node)
|
||||
{
|
||||
var expression = RewriteExpression(node.Expression);
|
||||
if (expression == node.Expression)
|
||||
{
|
||||
return node;
|
||||
}
|
||||
|
||||
return new BoundExpressionStatement(node.Syntax, expression);
|
||||
}
|
||||
|
||||
public virtual BoundStatement RewriteEmptyStatement(BoundEmptyStatement node)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public virtual BoundStatement RewriteConcreteMethodDeclaration(BoundConcreteMethodDeclaration node)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public virtual BoundStatement RewriteClassDeclaration(BoundClassDeclaration node)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public virtual BoundStatement RewriteBlockStatement(BoundBlockStatement node)
|
||||
{
|
||||
ImmutableArray<BoundStatement>.Builder? builder = null;
|
||||
for (var i = 0; i < node.Statements.Length; i++)
|
||||
{
|
||||
var oldStatement = node.Statements[i];
|
||||
var newStatement = RewriteStatement(oldStatement);
|
||||
if (oldStatement != newStatement && builder is null)
|
||||
{
|
||||
builder = ImmutableArray.CreateBuilder<BoundStatement>(node.Statements.Length);
|
||||
for (var j = 0; j < i; i++)
|
||||
{
|
||||
builder.Add(node.Statements[j]);
|
||||
}
|
||||
}
|
||||
if (builder is not null)
|
||||
{
|
||||
builder.Add(newStatement);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (builder is null)
|
||||
{
|
||||
return node;
|
||||
}
|
||||
|
||||
return new BoundBlockStatement(node.Syntax, builder.MoveToImmutable());
|
||||
}
|
||||
|
||||
public virtual BoundStatement RewriteAbstractMethodDeclaration(BoundAbstractMethodDeclaration node)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public virtual BoundExpression RewriteExpression(BoundExpression node)
|
||||
{
|
||||
return node.Kind switch
|
||||
{
|
||||
BoundNodeKind.ArrayLiteralExpression =>
|
||||
RewriteArrayLiteralExpression((BoundArrayLiteralExpression)node),
|
||||
BoundNodeKind.AssignmentExpression =>
|
||||
RewriteAssignmentExpression((BoundAssignmentExpression)node),
|
||||
BoundNodeKind.BinaryOperationExpression =>
|
||||
RewriteBinaryOperationExpression((BoundBinaryOperationExpression)node),
|
||||
BoundNodeKind.CellArrayElementAccessExpression =>
|
||||
RewriteCellArrayElementAccessExpression((BoundCellArrayElementAccessExpression)node),
|
||||
BoundNodeKind.CellArrayLiteralExpression =>
|
||||
RewriteCellArrayLiteralExpression((BoundCellArrayLiteralExpression)node),
|
||||
BoundNodeKind.ClassInvokationExpression =>
|
||||
RewriteClassInvokationExpression((BoundClassInvokationExpression)node),
|
||||
BoundNodeKind.CommandExpression =>
|
||||
RewriteCommandExpression((BoundCommandExpression)node),
|
||||
BoundNodeKind.CompoundNameExpression =>
|
||||
RewriteCompoundNameExpression((BoundCompoundNameExpression)node),
|
||||
BoundNodeKind.DoubleQuotedStringLiteralExpression =>
|
||||
RewriteDoubleQuotedStringLiteralExpression((BoundDoubleQuotedStringLiteralExpression)node),
|
||||
BoundNodeKind.EmptyExpression =>
|
||||
RewriteEmptyExpression((BoundEmptyExpression)node),
|
||||
BoundNodeKind.FunctionCallExpression =>
|
||||
RewriteFunctionCallExpression((BoundFunctionCallExpression)node),
|
||||
BoundNodeKind.IdentifierNameExpression =>
|
||||
RewriteIdentifierNameExpression((BoundIdentifierNameExpression)node),
|
||||
BoundNodeKind.IndirectMemberAccessExpression =>
|
||||
RewriteIndirectMemberAccessExpression((BoundIndirectMemberAccessExpression)node),
|
||||
BoundNodeKind.LambdaExpression =>
|
||||
RewriteLambdaExpression((BoundLambdaExpression)node),
|
||||
BoundNodeKind.MemberAccessExpression =>
|
||||
RewriteMemberAccessExpression((BoundMemberAccessExpression)node),
|
||||
BoundNodeKind.NamedFunctionHandleExpression =>
|
||||
RewriteNamedFunctionHandleExpression((BoundNamedFunctionHandleExpression)node),
|
||||
BoundNodeKind.NumberLiteralExpression =>
|
||||
RewriteNumberLiteralExpression((BoundNumberLiteralExpression)node),
|
||||
BoundNodeKind.ParenthesizedExpression =>
|
||||
RewriteParenthesizedExpression((BoundParenthesizedExpression)node),
|
||||
BoundNodeKind.StringLiteralExpression =>
|
||||
RewriteStringLiteralExpression((BoundStringLiteralExpression)node),
|
||||
BoundNodeKind.UnaryPrefixOperationExpression =>
|
||||
RewriteUnaryPrefixOperationExpression((BoundUnaryPrefixOperationExpression)node),
|
||||
BoundNodeKind.UnaryPostfixOperationExpression =>
|
||||
RewriteUnaryPostfixOperationExpression((BoundUnaryPostfixOperationExpression)node),
|
||||
BoundNodeKind.UnquotedStringLiteralExpression =>
|
||||
RewriteUnquotedStringLiteralExpression((BoundUnquotedStringLiteralExpression)node),
|
||||
_ =>
|
||||
throw new Exception($"Invalid expression kind {node.Kind}."),
|
||||
};
|
||||
}
|
||||
|
||||
public virtual BoundExpression RewriteUnquotedStringLiteralExpression(BoundUnquotedStringLiteralExpression node)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public virtual BoundExpression RewriteUnaryPostfixOperationExpression(BoundUnaryPostfixOperationExpression node)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public virtual BoundExpression RewriteUnaryPrefixOperationExpression(BoundUnaryPrefixOperationExpression node)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public virtual BoundExpression RewriteStringLiteralExpression(BoundStringLiteralExpression node)
|
||||
{
|
||||
return node;
|
||||
}
|
||||
|
||||
public virtual BoundExpression RewriteParenthesizedExpression(BoundParenthesizedExpression node)
|
||||
{
|
||||
var expression = RewriteExpression(node.Expression);
|
||||
if (expression == node.Expression)
|
||||
{
|
||||
return node;
|
||||
}
|
||||
|
||||
return new BoundParenthesizedExpression(node.Syntax, expression);
|
||||
}
|
||||
|
||||
public virtual BoundExpression RewriteNumberLiteralExpression(BoundNumberLiteralExpression node)
|
||||
{
|
||||
return node;
|
||||
}
|
||||
|
||||
public virtual BoundExpression RewriteNamedFunctionHandleExpression(BoundNamedFunctionHandleExpression node)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public virtual BoundExpression RewriteMemberAccessExpression(BoundMemberAccessExpression node)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public virtual BoundExpression RewriteLambdaExpression(BoundLambdaExpression node)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public virtual BoundExpression RewriteIndirectMemberAccessExpression(BoundIndirectMemberAccessExpression node)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public virtual BoundExpression RewriteIdentifierNameExpression(BoundIdentifierNameExpression node)
|
||||
{
|
||||
return node;
|
||||
}
|
||||
|
||||
public virtual BoundExpression RewriteFunctionCallExpression(BoundFunctionCallExpression node)
|
||||
{
|
||||
|
||||
ImmutableArray<BoundExpression>.Builder? builder = null;
|
||||
for (var i = 0; i < node.Arguments.Length; i++)
|
||||
{
|
||||
var oldArgument = node.Arguments[i];
|
||||
var newArgument = RewriteExpression(oldArgument);
|
||||
if (oldArgument != newArgument && builder is null)
|
||||
{
|
||||
builder = ImmutableArray.CreateBuilder<BoundExpression>(node.Arguments.Length);
|
||||
for (var j = 0; j < i; i++)
|
||||
{
|
||||
builder.Add(node.Arguments[j]);
|
||||
}
|
||||
}
|
||||
if (builder is not null)
|
||||
{
|
||||
builder.Add(newArgument);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (builder is null)
|
||||
{
|
||||
return node;
|
||||
}
|
||||
|
||||
return new BoundFunctionCallExpression(node.Syntax, node.Name, builder.MoveToImmutable());
|
||||
}
|
||||
|
||||
public virtual BoundExpression RewriteEmptyExpression(BoundEmptyExpression node)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public virtual BoundExpression RewriteDoubleQuotedStringLiteralExpression(BoundDoubleQuotedStringLiteralExpression node)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public virtual BoundExpression RewriteCommandExpression(BoundCommandExpression node)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public virtual BoundExpression RewriteCompoundNameExpression(BoundCompoundNameExpression node)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public virtual BoundExpression RewriteClassInvokationExpression(BoundClassInvokationExpression node)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public virtual BoundExpression RewriteCellArrayLiteralExpression(BoundCellArrayLiteralExpression node)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public virtual BoundExpression RewriteCellArrayElementAccessExpression(BoundCellArrayElementAccessExpression node)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public virtual BoundExpression RewriteBinaryOperationExpression(BoundBinaryOperationExpression node)
|
||||
{
|
||||
var left = RewriteExpression(node.Left);
|
||||
var right = RewriteExpression(node.Right);
|
||||
if (left == node.Left && right == node.Right)
|
||||
{
|
||||
return node;
|
||||
}
|
||||
|
||||
return new BoundBinaryOperationExpression(node.Syntax, left, node.Op, right);
|
||||
}
|
||||
|
||||
public virtual BoundExpression RewriteAssignmentExpression(BoundAssignmentExpression node)
|
||||
{
|
||||
var left = RewriteExpression(node.Left);
|
||||
var right = RewriteExpression(node.Right);
|
||||
if (left == node.Left && right == node.Right)
|
||||
{
|
||||
return node;
|
||||
}
|
||||
|
||||
return new BoundAssignmentExpression(node.Syntax, left, right);
|
||||
}
|
||||
|
||||
public virtual BoundExpression RewriteArrayLiteralExpression(BoundArrayLiteralExpression node)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
@ -13,7 +13,7 @@ namespace Parser.Internal
|
||||
return new BlockStatementSyntaxNode(statements);
|
||||
}
|
||||
|
||||
public FunctionDeclarationSyntaxNode FunctionDeclarationSyntax(SyntaxToken functionKeyword, FunctionOutputDescriptionSyntaxNode? outputDescription, SyntaxToken name, FunctionInputDescriptionSyntaxNode? inputDescription, SyntaxList<SyntaxToken> commas, BlockStatementSyntaxNode body, EndKeywordSyntaxNode? endKeyword)
|
||||
public FunctionDeclarationSyntaxNode FunctionDeclarationSyntax(SyntaxToken functionKeyword, FunctionOutputDescriptionSyntaxNode? outputDescription, SyntaxToken name, FunctionInputDescriptionSyntaxNode? inputDescription, SyntaxList<SyntaxToken> commas, StatementSyntaxNode body, EndKeywordSyntaxNode? endKeyword)
|
||||
{
|
||||
return new FunctionDeclarationSyntaxNode(functionKeyword, outputDescription, name, inputDescription, commas, body, endKeyword);
|
||||
}
|
||||
@ -33,32 +33,32 @@ namespace Parser.Internal
|
||||
return new SwitchStatementSyntaxNode(switchKeyword, switchExpression, optionalCommas, cases, endKeyword);
|
||||
}
|
||||
|
||||
public SwitchCaseSyntaxNode SwitchCaseSyntax(SyntaxToken caseKeyword, ExpressionSyntaxNode caseIdentifier, SyntaxList<SyntaxToken> optionalCommas, BlockStatementSyntaxNode body)
|
||||
public SwitchCaseSyntaxNode SwitchCaseSyntax(SyntaxToken caseKeyword, ExpressionSyntaxNode caseIdentifier, SyntaxList<SyntaxToken> optionalCommas, StatementSyntaxNode body)
|
||||
{
|
||||
return new SwitchCaseSyntaxNode(caseKeyword, caseIdentifier, optionalCommas, body);
|
||||
}
|
||||
|
||||
public WhileStatementSyntaxNode WhileStatementSyntax(SyntaxToken whileKeyword, ExpressionSyntaxNode condition, SyntaxList<SyntaxToken> optionalCommas, BlockStatementSyntaxNode body, SyntaxToken endKeyword)
|
||||
public WhileStatementSyntaxNode WhileStatementSyntax(SyntaxToken whileKeyword, ExpressionSyntaxNode condition, SyntaxList<SyntaxToken> optionalCommas, StatementSyntaxNode body, SyntaxToken endKeyword)
|
||||
{
|
||||
return new WhileStatementSyntaxNode(whileKeyword, condition, optionalCommas, body, endKeyword);
|
||||
}
|
||||
|
||||
public ElseifClause ElseifClause(SyntaxToken elseifKeyword, ExpressionSyntaxNode condition, SyntaxList<SyntaxToken> optionalCommas, BlockStatementSyntaxNode body)
|
||||
public ElseifClause ElseifClause(SyntaxToken elseifKeyword, ExpressionSyntaxNode condition, SyntaxList<SyntaxToken> optionalCommas, StatementSyntaxNode body)
|
||||
{
|
||||
return new ElseifClause(elseifKeyword, condition, optionalCommas, body);
|
||||
}
|
||||
|
||||
public ElseClause ElseClause(SyntaxToken elseKeyword, BlockStatementSyntaxNode body)
|
||||
public ElseClause ElseClause(SyntaxToken elseKeyword, StatementSyntaxNode body)
|
||||
{
|
||||
return new ElseClause(elseKeyword, body);
|
||||
}
|
||||
|
||||
public IfStatementSyntaxNode IfStatementSyntax(SyntaxToken ifKeyword, ExpressionSyntaxNode condition, SyntaxList<SyntaxToken> optionalCommas, BlockStatementSyntaxNode body, SyntaxList<ElseifClause> elseifClauses, ElseClause? elseClause, SyntaxToken endKeyword)
|
||||
public IfStatementSyntaxNode IfStatementSyntax(SyntaxToken ifKeyword, ExpressionSyntaxNode condition, SyntaxList<SyntaxToken> optionalCommas, StatementSyntaxNode body, SyntaxList<ElseifClause> elseifClauses, ElseClause? elseClause, SyntaxToken endKeyword)
|
||||
{
|
||||
return new IfStatementSyntaxNode(ifKeyword, condition, optionalCommas, body, elseifClauses, elseClause, endKeyword);
|
||||
}
|
||||
|
||||
public ForStatementSyntaxNode ForStatementSyntax(SyntaxToken forKeyword, AssignmentExpressionSyntaxNode assignment, SyntaxList<SyntaxToken> optionalCommas, BlockStatementSyntaxNode body, SyntaxToken endKeyword)
|
||||
public ForStatementSyntaxNode ForStatementSyntax(SyntaxToken forKeyword, AssignmentExpressionSyntaxNode assignment, SyntaxList<SyntaxToken> optionalCommas, StatementSyntaxNode body, SyntaxToken endKeyword)
|
||||
{
|
||||
return new ForStatementSyntaxNode(forKeyword, assignment, optionalCommas, body, endKeyword);
|
||||
}
|
||||
@ -73,7 +73,7 @@ namespace Parser.Internal
|
||||
return new CatchClauseSyntaxNode(catchKeyword, catchBody);
|
||||
}
|
||||
|
||||
public TryCatchStatementSyntaxNode TryCatchStatementSyntax(SyntaxToken tryKeyword, BlockStatementSyntaxNode tryBody, CatchClauseSyntaxNode? catchClause, SyntaxToken endKeyword)
|
||||
public TryCatchStatementSyntaxNode TryCatchStatementSyntax(SyntaxToken tryKeyword, StatementSyntaxNode tryBody, CatchClauseSyntaxNode? catchClause, SyntaxToken endKeyword)
|
||||
{
|
||||
return new TryCatchStatementSyntaxNode(tryKeyword, tryBody, catchClause, endKeyword);
|
||||
}
|
||||
@ -208,7 +208,7 @@ namespace Parser.Internal
|
||||
return new AttributeListSyntaxNode(openingBracket, nodes, closingBracket);
|
||||
}
|
||||
|
||||
public ConcreteMethodDeclarationSyntaxNode ConcreteMethodDeclarationSyntax(SyntaxToken functionKeyword, FunctionOutputDescriptionSyntaxNode? outputDescription, CompoundNameExpressionSyntaxNode name, FunctionInputDescriptionSyntaxNode? inputDescription, SyntaxList<SyntaxToken> commas, BlockStatementSyntaxNode body, EndKeywordSyntaxNode? endKeyword)
|
||||
public ConcreteMethodDeclarationSyntaxNode ConcreteMethodDeclarationSyntax(SyntaxToken functionKeyword, FunctionOutputDescriptionSyntaxNode? outputDescription, CompoundNameExpressionSyntaxNode name, FunctionInputDescriptionSyntaxNode? inputDescription, SyntaxList<SyntaxToken> commas, StatementSyntaxNode body, EndKeywordSyntaxNode? endKeyword)
|
||||
{
|
||||
return new ConcreteMethodDeclarationSyntaxNode(functionKeyword, outputDescription, name, inputDescription, commas, body, endKeyword);
|
||||
}
|
||||
|
@ -89,9 +89,9 @@ namespace Parser.Internal
|
||||
internal readonly SyntaxToken _name;
|
||||
internal readonly FunctionInputDescriptionSyntaxNode? _inputDescription;
|
||||
internal readonly SyntaxList<SyntaxToken> _commas;
|
||||
internal readonly BlockStatementSyntaxNode _body;
|
||||
internal readonly StatementSyntaxNode _body;
|
||||
internal readonly EndKeywordSyntaxNode? _endKeyword;
|
||||
internal FunctionDeclarationSyntaxNode(SyntaxToken functionKeyword, FunctionOutputDescriptionSyntaxNode? outputDescription, SyntaxToken name, FunctionInputDescriptionSyntaxNode? inputDescription, SyntaxList<SyntaxToken> commas, BlockStatementSyntaxNode body, EndKeywordSyntaxNode? endKeyword): base(TokenKind.FunctionDeclaration)
|
||||
internal FunctionDeclarationSyntaxNode(SyntaxToken functionKeyword, FunctionOutputDescriptionSyntaxNode? outputDescription, SyntaxToken name, FunctionInputDescriptionSyntaxNode? inputDescription, SyntaxList<SyntaxToken> commas, StatementSyntaxNode body, EndKeywordSyntaxNode? endKeyword): base(TokenKind.FunctionDeclaration)
|
||||
{
|
||||
Slots = 7;
|
||||
this.AdjustWidth(functionKeyword);
|
||||
@ -110,7 +110,7 @@ namespace Parser.Internal
|
||||
_endKeyword = endKeyword;
|
||||
}
|
||||
|
||||
internal FunctionDeclarationSyntaxNode(SyntaxToken functionKeyword, FunctionOutputDescriptionSyntaxNode? outputDescription, SyntaxToken name, FunctionInputDescriptionSyntaxNode? inputDescription, SyntaxList<SyntaxToken> commas, BlockStatementSyntaxNode body, EndKeywordSyntaxNode? endKeyword, TokenDiagnostic[] diagnostics): base(TokenKind.FunctionDeclaration, diagnostics)
|
||||
internal FunctionDeclarationSyntaxNode(SyntaxToken functionKeyword, FunctionOutputDescriptionSyntaxNode? outputDescription, SyntaxToken name, FunctionInputDescriptionSyntaxNode? inputDescription, SyntaxList<SyntaxToken> commas, StatementSyntaxNode body, EndKeywordSyntaxNode? endKeyword, TokenDiagnostic[] diagnostics): base(TokenKind.FunctionDeclaration, diagnostics)
|
||||
{
|
||||
Slots = 7;
|
||||
this.AdjustWidth(functionKeyword);
|
||||
@ -304,8 +304,8 @@ namespace Parser.Internal
|
||||
internal readonly SyntaxToken _caseKeyword;
|
||||
internal readonly ExpressionSyntaxNode _caseIdentifier;
|
||||
internal readonly SyntaxList<SyntaxToken> _optionalCommas;
|
||||
internal readonly BlockStatementSyntaxNode _body;
|
||||
internal SwitchCaseSyntaxNode(SyntaxToken caseKeyword, ExpressionSyntaxNode caseIdentifier, SyntaxList<SyntaxToken> optionalCommas, BlockStatementSyntaxNode body): base(TokenKind.SwitchCase)
|
||||
internal readonly StatementSyntaxNode _body;
|
||||
internal SwitchCaseSyntaxNode(SyntaxToken caseKeyword, ExpressionSyntaxNode caseIdentifier, SyntaxList<SyntaxToken> optionalCommas, StatementSyntaxNode body): base(TokenKind.SwitchCase)
|
||||
{
|
||||
Slots = 4;
|
||||
this.AdjustWidth(caseKeyword);
|
||||
@ -318,7 +318,7 @@ namespace Parser.Internal
|
||||
_body = body;
|
||||
}
|
||||
|
||||
internal SwitchCaseSyntaxNode(SyntaxToken caseKeyword, ExpressionSyntaxNode caseIdentifier, SyntaxList<SyntaxToken> optionalCommas, BlockStatementSyntaxNode body, TokenDiagnostic[] diagnostics): base(TokenKind.SwitchCase, diagnostics)
|
||||
internal SwitchCaseSyntaxNode(SyntaxToken caseKeyword, ExpressionSyntaxNode caseIdentifier, SyntaxList<SyntaxToken> optionalCommas, StatementSyntaxNode body, TokenDiagnostic[] diagnostics): base(TokenKind.SwitchCase, diagnostics)
|
||||
{
|
||||
Slots = 4;
|
||||
this.AdjustWidth(caseKeyword);
|
||||
@ -357,9 +357,9 @@ namespace Parser.Internal
|
||||
internal readonly SyntaxToken _whileKeyword;
|
||||
internal readonly ExpressionSyntaxNode _condition;
|
||||
internal readonly SyntaxList<SyntaxToken> _optionalCommas;
|
||||
internal readonly BlockStatementSyntaxNode _body;
|
||||
internal readonly StatementSyntaxNode _body;
|
||||
internal readonly SyntaxToken _endKeyword;
|
||||
internal WhileStatementSyntaxNode(SyntaxToken whileKeyword, ExpressionSyntaxNode condition, SyntaxList<SyntaxToken> optionalCommas, BlockStatementSyntaxNode body, SyntaxToken endKeyword): base(TokenKind.WhileStatement)
|
||||
internal WhileStatementSyntaxNode(SyntaxToken whileKeyword, ExpressionSyntaxNode condition, SyntaxList<SyntaxToken> optionalCommas, StatementSyntaxNode body, SyntaxToken endKeyword): base(TokenKind.WhileStatement)
|
||||
{
|
||||
Slots = 5;
|
||||
this.AdjustWidth(whileKeyword);
|
||||
@ -374,7 +374,7 @@ namespace Parser.Internal
|
||||
_endKeyword = endKeyword;
|
||||
}
|
||||
|
||||
internal WhileStatementSyntaxNode(SyntaxToken whileKeyword, ExpressionSyntaxNode condition, SyntaxList<SyntaxToken> optionalCommas, BlockStatementSyntaxNode body, SyntaxToken endKeyword, TokenDiagnostic[] diagnostics): base(TokenKind.WhileStatement, diagnostics)
|
||||
internal WhileStatementSyntaxNode(SyntaxToken whileKeyword, ExpressionSyntaxNode condition, SyntaxList<SyntaxToken> optionalCommas, StatementSyntaxNode body, SyntaxToken endKeyword, TokenDiagnostic[] diagnostics): base(TokenKind.WhileStatement, diagnostics)
|
||||
{
|
||||
Slots = 5;
|
||||
this.AdjustWidth(whileKeyword);
|
||||
@ -415,8 +415,8 @@ namespace Parser.Internal
|
||||
internal readonly SyntaxToken _elseifKeyword;
|
||||
internal readonly ExpressionSyntaxNode _condition;
|
||||
internal readonly SyntaxList<SyntaxToken> _optionalCommas;
|
||||
internal readonly BlockStatementSyntaxNode _body;
|
||||
internal ElseifClause(SyntaxToken elseifKeyword, ExpressionSyntaxNode condition, SyntaxList<SyntaxToken> optionalCommas, BlockStatementSyntaxNode body): base(TokenKind.ElseifClause)
|
||||
internal readonly StatementSyntaxNode _body;
|
||||
internal ElseifClause(SyntaxToken elseifKeyword, ExpressionSyntaxNode condition, SyntaxList<SyntaxToken> optionalCommas, StatementSyntaxNode body): base(TokenKind.ElseifClause)
|
||||
{
|
||||
Slots = 4;
|
||||
this.AdjustWidth(elseifKeyword);
|
||||
@ -429,7 +429,7 @@ namespace Parser.Internal
|
||||
_body = body;
|
||||
}
|
||||
|
||||
internal ElseifClause(SyntaxToken elseifKeyword, ExpressionSyntaxNode condition, SyntaxList<SyntaxToken> optionalCommas, BlockStatementSyntaxNode body, TokenDiagnostic[] diagnostics): base(TokenKind.ElseifClause, diagnostics)
|
||||
internal ElseifClause(SyntaxToken elseifKeyword, ExpressionSyntaxNode condition, SyntaxList<SyntaxToken> optionalCommas, StatementSyntaxNode body, TokenDiagnostic[] diagnostics): base(TokenKind.ElseifClause, diagnostics)
|
||||
{
|
||||
Slots = 4;
|
||||
this.AdjustWidth(elseifKeyword);
|
||||
@ -466,8 +466,8 @@ namespace Parser.Internal
|
||||
internal class ElseClause : SyntaxNode
|
||||
{
|
||||
internal readonly SyntaxToken _elseKeyword;
|
||||
internal readonly BlockStatementSyntaxNode _body;
|
||||
internal ElseClause(SyntaxToken elseKeyword, BlockStatementSyntaxNode body): base(TokenKind.ElseClause)
|
||||
internal readonly StatementSyntaxNode _body;
|
||||
internal ElseClause(SyntaxToken elseKeyword, StatementSyntaxNode body): base(TokenKind.ElseClause)
|
||||
{
|
||||
Slots = 2;
|
||||
this.AdjustWidth(elseKeyword);
|
||||
@ -476,7 +476,7 @@ namespace Parser.Internal
|
||||
_body = body;
|
||||
}
|
||||
|
||||
internal ElseClause(SyntaxToken elseKeyword, BlockStatementSyntaxNode body, TokenDiagnostic[] diagnostics): base(TokenKind.ElseClause, diagnostics)
|
||||
internal ElseClause(SyntaxToken elseKeyword, StatementSyntaxNode body, TokenDiagnostic[] diagnostics): base(TokenKind.ElseClause, diagnostics)
|
||||
{
|
||||
Slots = 2;
|
||||
this.AdjustWidth(elseKeyword);
|
||||
@ -511,11 +511,11 @@ namespace Parser.Internal
|
||||
internal readonly SyntaxToken _ifKeyword;
|
||||
internal readonly ExpressionSyntaxNode _condition;
|
||||
internal readonly SyntaxList<SyntaxToken> _optionalCommas;
|
||||
internal readonly BlockStatementSyntaxNode _body;
|
||||
internal readonly StatementSyntaxNode _body;
|
||||
internal readonly SyntaxList<ElseifClause> _elseifClauses;
|
||||
internal readonly ElseClause? _elseClause;
|
||||
internal readonly SyntaxToken _endKeyword;
|
||||
internal IfStatementSyntaxNode(SyntaxToken ifKeyword, ExpressionSyntaxNode condition, SyntaxList<SyntaxToken> optionalCommas, BlockStatementSyntaxNode body, SyntaxList<ElseifClause> elseifClauses, ElseClause? elseClause, SyntaxToken endKeyword): base(TokenKind.IfStatement)
|
||||
internal IfStatementSyntaxNode(SyntaxToken ifKeyword, ExpressionSyntaxNode condition, SyntaxList<SyntaxToken> optionalCommas, StatementSyntaxNode body, SyntaxList<ElseifClause> elseifClauses, ElseClause? elseClause, SyntaxToken endKeyword): base(TokenKind.IfStatement)
|
||||
{
|
||||
Slots = 7;
|
||||
this.AdjustWidth(ifKeyword);
|
||||
@ -534,7 +534,7 @@ namespace Parser.Internal
|
||||
_endKeyword = endKeyword;
|
||||
}
|
||||
|
||||
internal IfStatementSyntaxNode(SyntaxToken ifKeyword, ExpressionSyntaxNode condition, SyntaxList<SyntaxToken> optionalCommas, BlockStatementSyntaxNode body, SyntaxList<ElseifClause> elseifClauses, ElseClause? elseClause, SyntaxToken endKeyword, TokenDiagnostic[] diagnostics): base(TokenKind.IfStatement, diagnostics)
|
||||
internal IfStatementSyntaxNode(SyntaxToken ifKeyword, ExpressionSyntaxNode condition, SyntaxList<SyntaxToken> optionalCommas, StatementSyntaxNode body, SyntaxList<ElseifClause> elseifClauses, ElseClause? elseClause, SyntaxToken endKeyword, TokenDiagnostic[] diagnostics): base(TokenKind.IfStatement, diagnostics)
|
||||
{
|
||||
Slots = 7;
|
||||
this.AdjustWidth(ifKeyword);
|
||||
@ -579,9 +579,9 @@ namespace Parser.Internal
|
||||
internal readonly SyntaxToken _forKeyword;
|
||||
internal readonly AssignmentExpressionSyntaxNode _assignment;
|
||||
internal readonly SyntaxList<SyntaxToken> _optionalCommas;
|
||||
internal readonly BlockStatementSyntaxNode _body;
|
||||
internal readonly StatementSyntaxNode _body;
|
||||
internal readonly SyntaxToken _endKeyword;
|
||||
internal ForStatementSyntaxNode(SyntaxToken forKeyword, AssignmentExpressionSyntaxNode assignment, SyntaxList<SyntaxToken> optionalCommas, BlockStatementSyntaxNode body, SyntaxToken endKeyword): base(TokenKind.ForStatement)
|
||||
internal ForStatementSyntaxNode(SyntaxToken forKeyword, AssignmentExpressionSyntaxNode assignment, SyntaxList<SyntaxToken> optionalCommas, StatementSyntaxNode body, SyntaxToken endKeyword): base(TokenKind.ForStatement)
|
||||
{
|
||||
Slots = 5;
|
||||
this.AdjustWidth(forKeyword);
|
||||
@ -596,7 +596,7 @@ namespace Parser.Internal
|
||||
_endKeyword = endKeyword;
|
||||
}
|
||||
|
||||
internal ForStatementSyntaxNode(SyntaxToken forKeyword, AssignmentExpressionSyntaxNode assignment, SyntaxList<SyntaxToken> optionalCommas, BlockStatementSyntaxNode body, SyntaxToken endKeyword, TokenDiagnostic[] diagnostics): base(TokenKind.ForStatement, diagnostics)
|
||||
internal ForStatementSyntaxNode(SyntaxToken forKeyword, AssignmentExpressionSyntaxNode assignment, SyntaxList<SyntaxToken> optionalCommas, StatementSyntaxNode body, SyntaxToken endKeyword, TokenDiagnostic[] diagnostics): base(TokenKind.ForStatement, diagnostics)
|
||||
{
|
||||
Slots = 5;
|
||||
this.AdjustWidth(forKeyword);
|
||||
@ -726,10 +726,10 @@ namespace Parser.Internal
|
||||
internal class TryCatchStatementSyntaxNode : StatementSyntaxNode
|
||||
{
|
||||
internal readonly SyntaxToken _tryKeyword;
|
||||
internal readonly BlockStatementSyntaxNode _tryBody;
|
||||
internal readonly StatementSyntaxNode _tryBody;
|
||||
internal readonly CatchClauseSyntaxNode? _catchClause;
|
||||
internal readonly SyntaxToken _endKeyword;
|
||||
internal TryCatchStatementSyntaxNode(SyntaxToken tryKeyword, BlockStatementSyntaxNode tryBody, CatchClauseSyntaxNode? catchClause, SyntaxToken endKeyword): base(TokenKind.TryCatchStatement)
|
||||
internal TryCatchStatementSyntaxNode(SyntaxToken tryKeyword, StatementSyntaxNode tryBody, CatchClauseSyntaxNode? catchClause, SyntaxToken endKeyword): base(TokenKind.TryCatchStatement)
|
||||
{
|
||||
Slots = 4;
|
||||
this.AdjustWidth(tryKeyword);
|
||||
@ -742,7 +742,7 @@ namespace Parser.Internal
|
||||
_endKeyword = endKeyword;
|
||||
}
|
||||
|
||||
internal TryCatchStatementSyntaxNode(SyntaxToken tryKeyword, BlockStatementSyntaxNode tryBody, CatchClauseSyntaxNode? catchClause, SyntaxToken endKeyword, TokenDiagnostic[] diagnostics): base(TokenKind.TryCatchStatement, diagnostics)
|
||||
internal TryCatchStatementSyntaxNode(SyntaxToken tryKeyword, StatementSyntaxNode tryBody, CatchClauseSyntaxNode? catchClause, SyntaxToken endKeyword, TokenDiagnostic[] diagnostics): base(TokenKind.TryCatchStatement, diagnostics)
|
||||
{
|
||||
Slots = 4;
|
||||
this.AdjustWidth(tryKeyword);
|
||||
@ -1916,9 +1916,9 @@ namespace Parser.Internal
|
||||
internal readonly CompoundNameExpressionSyntaxNode _name;
|
||||
internal readonly FunctionInputDescriptionSyntaxNode? _inputDescription;
|
||||
internal readonly SyntaxList<SyntaxToken> _commas;
|
||||
internal readonly BlockStatementSyntaxNode _body;
|
||||
internal readonly StatementSyntaxNode _body;
|
||||
internal readonly EndKeywordSyntaxNode? _endKeyword;
|
||||
internal ConcreteMethodDeclarationSyntaxNode(SyntaxToken functionKeyword, FunctionOutputDescriptionSyntaxNode? outputDescription, CompoundNameExpressionSyntaxNode name, FunctionInputDescriptionSyntaxNode? inputDescription, SyntaxList<SyntaxToken> commas, BlockStatementSyntaxNode body, EndKeywordSyntaxNode? endKeyword): base(TokenKind.ConcreteMethodDeclaration)
|
||||
internal ConcreteMethodDeclarationSyntaxNode(SyntaxToken functionKeyword, FunctionOutputDescriptionSyntaxNode? outputDescription, CompoundNameExpressionSyntaxNode name, FunctionInputDescriptionSyntaxNode? inputDescription, SyntaxList<SyntaxToken> commas, StatementSyntaxNode body, EndKeywordSyntaxNode? endKeyword): base(TokenKind.ConcreteMethodDeclaration)
|
||||
{
|
||||
Slots = 7;
|
||||
this.AdjustWidth(functionKeyword);
|
||||
@ -1937,7 +1937,7 @@ namespace Parser.Internal
|
||||
_endKeyword = endKeyword;
|
||||
}
|
||||
|
||||
internal ConcreteMethodDeclarationSyntaxNode(SyntaxToken functionKeyword, FunctionOutputDescriptionSyntaxNode? outputDescription, CompoundNameExpressionSyntaxNode name, FunctionInputDescriptionSyntaxNode? inputDescription, SyntaxList<SyntaxToken> commas, BlockStatementSyntaxNode body, EndKeywordSyntaxNode? endKeyword, TokenDiagnostic[] diagnostics): base(TokenKind.ConcreteMethodDeclaration, diagnostics)
|
||||
internal ConcreteMethodDeclarationSyntaxNode(SyntaxToken functionKeyword, FunctionOutputDescriptionSyntaxNode? outputDescription, CompoundNameExpressionSyntaxNode name, FunctionInputDescriptionSyntaxNode? inputDescription, SyntaxList<SyntaxToken> commas, StatementSyntaxNode body, EndKeywordSyntaxNode? endKeyword, TokenDiagnostic[] diagnostics): base(TokenKind.ConcreteMethodDeclaration, diagnostics)
|
||||
{
|
||||
Slots = 7;
|
||||
this.AdjustWidth(functionKeyword);
|
||||
|
@ -3,6 +3,7 @@
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<LangVersion>8.0</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<LangVersion>preview</LangVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.Collections.Immutable" Version="1.5.0" />
|
||||
|
@ -13,7 +13,7 @@
|
||||
<Field Type="SyntaxToken" Name="name" />
|
||||
<Field Type="FunctionInputDescriptionSyntaxNode" Name="inputDescription" Nullable="true"/>
|
||||
<Field Type="SyntaxList<SyntaxToken>" Name="commas" />
|
||||
<Field Type="BlockStatementSyntaxNode" Name="body" />
|
||||
<Field Type="StatementSyntaxNode" Name="body" />
|
||||
<Field Type="EndKeywordSyntaxNode" Name="endKeyword" Nullable="true"/>
|
||||
</Class>
|
||||
<Class Name="FunctionOutputDescriptionSyntaxNode" BaseClass="SyntaxNode" Kind="FunctionOutputDescription">
|
||||
@ -36,30 +36,30 @@
|
||||
<Field Type="SyntaxToken" Name="caseKeyword" />
|
||||
<Field Type="ExpressionSyntaxNode" Name="caseIdentifier" />
|
||||
<Field Type="SyntaxList<SyntaxToken>" Name="optionalCommas" />
|
||||
<Field Type="BlockStatementSyntaxNode" Name="body" />
|
||||
<Field Type="StatementSyntaxNode" Name="body" />
|
||||
</Class>
|
||||
<Class Name="WhileStatementSyntaxNode" BaseClass="StatementSyntaxNode" Kind="WhileStatement">
|
||||
<Field Type="SyntaxToken" Name="whileKeyword" />
|
||||
<Field Type="ExpressionSyntaxNode" Name="condition" />
|
||||
<Field Type="SyntaxList<SyntaxToken>" Name="optionalCommas" />
|
||||
<Field Type="BlockStatementSyntaxNode" Name="body" />
|
||||
<Field Type="StatementSyntaxNode" Name="body" />
|
||||
<Field Type="SyntaxToken" Name="endKeyword" />
|
||||
</Class>
|
||||
<Class Name="ElseifClause" BaseClass="SyntaxNode" Kind="ElseifClause">
|
||||
<Field Type="SyntaxToken" Name="elseifKeyword" />
|
||||
<Field Type="ExpressionSyntaxNode" Name="condition" />
|
||||
<Field Type="SyntaxList<SyntaxToken>" Name="optionalCommas" />
|
||||
<Field Type="BlockStatementSyntaxNode" Name="body" />
|
||||
<Field Type="StatementSyntaxNode" Name="body" />
|
||||
</Class>
|
||||
<Class Name="ElseClause" BaseClass="SyntaxNode" Kind="ElseClause">
|
||||
<Field Type="SyntaxToken" Name="elseKeyword" />
|
||||
<Field Type="BlockStatementSyntaxNode" Name="body" />
|
||||
<Field Type="StatementSyntaxNode" Name="body" />
|
||||
</Class>
|
||||
<Class Name="IfStatementSyntaxNode" BaseClass="StatementSyntaxNode" Kind="IfStatement">
|
||||
<Field Type="SyntaxToken" Name="ifKeyword" />
|
||||
<Field Type="ExpressionSyntaxNode" Name="condition" />
|
||||
<Field Type="SyntaxList<SyntaxToken>" Name="optionalCommas" />
|
||||
<Field Type="BlockStatementSyntaxNode" Name="body" />
|
||||
<Field Type="StatementSyntaxNode" Name="body" />
|
||||
<Field Type="SyntaxList<ElseifClause>" Name="elseifClauses" />
|
||||
<Field Type="ElseClause" Name="elseClause" Nullable="true" />
|
||||
<Field Type="SyntaxToken" Name="endKeyword" />
|
||||
@ -68,7 +68,7 @@
|
||||
<Field Type="SyntaxToken" Name="forKeyword" />
|
||||
<Field Type="AssignmentExpressionSyntaxNode" Name="assignment" />
|
||||
<Field Type="SyntaxList<SyntaxToken>" Name="optionalCommas" />
|
||||
<Field Type="BlockStatementSyntaxNode" Name="body" />
|
||||
<Field Type="StatementSyntaxNode" Name="body" />
|
||||
<Field Type="SyntaxToken" Name="endKeyword" />
|
||||
</Class>
|
||||
<Class Name="AssignmentExpressionSyntaxNode" BaseClass="ExpressionSyntaxNode" Kind="AssignmentExpression">
|
||||
@ -82,7 +82,7 @@
|
||||
</Class>
|
||||
<Class Name="TryCatchStatementSyntaxNode" BaseClass="StatementSyntaxNode" Kind="TryCatchStatement">
|
||||
<Field Type="SyntaxToken" Name="tryKeyword" />
|
||||
<Field Type="BlockStatementSyntaxNode" Name="tryBody" />
|
||||
<Field Type="StatementSyntaxNode" Name="tryBody" />
|
||||
<Field Type="CatchClauseSyntaxNode" Name="catchClause" Nullable="true" />
|
||||
<Field Type="SyntaxToken" Name="endKeyword" />
|
||||
</Class>
|
||||
@ -199,7 +199,7 @@
|
||||
<Field Type="CompoundNameExpressionSyntaxNode" Name="name" />
|
||||
<Field Type="FunctionInputDescriptionSyntaxNode" Name="inputDescription" Nullable="true"/>
|
||||
<Field Type="SyntaxList<SyntaxToken>" Name="commas" />
|
||||
<Field Type="BlockStatementSyntaxNode" Name="body" />
|
||||
<Field Type="StatementSyntaxNode" Name="body" />
|
||||
<Field Type="EndKeywordSyntaxNode" Name="endKeyword" Nullable="true" />
|
||||
</Class>
|
||||
<Class Name="AbstractMethodDeclarationSyntaxNode" BaseClass="MethodDeclarationSyntaxNode" Kind="AbstractMethodDeclaration">
|
||||
|
@ -127,12 +127,12 @@ namespace Parser
|
||||
}
|
||||
}
|
||||
|
||||
public BlockStatementSyntaxNode Body
|
||||
public StatementSyntaxNode Body
|
||||
{
|
||||
get
|
||||
{
|
||||
var red = this.GetRed(ref this._body!, 5);
|
||||
return red is null ? throw new System.Exception("body cannot be null.") : (BlockStatementSyntaxNode)red;
|
||||
return red is null ? throw new System.Exception("body cannot be null.") : (StatementSyntaxNode)red;
|
||||
}
|
||||
}
|
||||
|
||||
@ -352,12 +352,12 @@ namespace Parser
|
||||
}
|
||||
}
|
||||
|
||||
public BlockStatementSyntaxNode Body
|
||||
public StatementSyntaxNode Body
|
||||
{
|
||||
get
|
||||
{
|
||||
var red = this.GetRed(ref this._body!, 3);
|
||||
return red is null ? throw new System.Exception("body cannot be null.") : (BlockStatementSyntaxNode)red;
|
||||
return red is null ? throw new System.Exception("body cannot be null.") : (StatementSyntaxNode)red;
|
||||
}
|
||||
}
|
||||
|
||||
@ -420,12 +420,12 @@ namespace Parser
|
||||
}
|
||||
}
|
||||
|
||||
public BlockStatementSyntaxNode Body
|
||||
public StatementSyntaxNode Body
|
||||
{
|
||||
get
|
||||
{
|
||||
var red = this.GetRed(ref this._body!, 3);
|
||||
return red is null ? throw new System.Exception("body cannot be null.") : (BlockStatementSyntaxNode)red;
|
||||
return red is null ? throw new System.Exception("body cannot be null.") : (StatementSyntaxNode)red;
|
||||
}
|
||||
}
|
||||
|
||||
@ -480,12 +480,12 @@ namespace Parser
|
||||
}
|
||||
}
|
||||
|
||||
public BlockStatementSyntaxNode Body
|
||||
public StatementSyntaxNode Body
|
||||
{
|
||||
get
|
||||
{
|
||||
var red = this.GetRed(ref this._body!, 3);
|
||||
return red is null ? throw new System.Exception("body cannot be null.") : (BlockStatementSyntaxNode)red;
|
||||
return red is null ? throw new System.Exception("body cannot be null.") : (StatementSyntaxNode)red;
|
||||
}
|
||||
}
|
||||
|
||||
@ -520,12 +520,12 @@ namespace Parser
|
||||
}
|
||||
}
|
||||
|
||||
public BlockStatementSyntaxNode Body
|
||||
public StatementSyntaxNode Body
|
||||
{
|
||||
get
|
||||
{
|
||||
var red = this.GetRed(ref this._body!, 1);
|
||||
return red is null ? throw new System.Exception("body cannot be null.") : (BlockStatementSyntaxNode)red;
|
||||
return red is null ? throw new System.Exception("body cannot be null.") : (StatementSyntaxNode)red;
|
||||
}
|
||||
}
|
||||
|
||||
@ -590,12 +590,12 @@ namespace Parser
|
||||
}
|
||||
}
|
||||
|
||||
public BlockStatementSyntaxNode Body
|
||||
public StatementSyntaxNode Body
|
||||
{
|
||||
get
|
||||
{
|
||||
var red = this.GetRed(ref this._body!, 3);
|
||||
return red is null ? throw new System.Exception("body cannot be null.") : (BlockStatementSyntaxNode)red;
|
||||
return red is null ? throw new System.Exception("body cannot be null.") : (StatementSyntaxNode)red;
|
||||
}
|
||||
}
|
||||
|
||||
@ -676,12 +676,12 @@ namespace Parser
|
||||
}
|
||||
}
|
||||
|
||||
public BlockStatementSyntaxNode Body
|
||||
public StatementSyntaxNode Body
|
||||
{
|
||||
get
|
||||
{
|
||||
var red = this.GetRed(ref this._body!, 3);
|
||||
return red is null ? throw new System.Exception("body cannot be null.") : (BlockStatementSyntaxNode)red;
|
||||
return red is null ? throw new System.Exception("body cannot be null.") : (StatementSyntaxNode)red;
|
||||
}
|
||||
}
|
||||
|
||||
@ -815,12 +815,12 @@ namespace Parser
|
||||
}
|
||||
}
|
||||
|
||||
public BlockStatementSyntaxNode TryBody
|
||||
public StatementSyntaxNode TryBody
|
||||
{
|
||||
get
|
||||
{
|
||||
var red = this.GetRed(ref this._tryBody!, 1);
|
||||
return red is null ? throw new System.Exception("tryBody cannot be null.") : (BlockStatementSyntaxNode)red;
|
||||
return red is null ? throw new System.Exception("tryBody cannot be null.") : (StatementSyntaxNode)red;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1967,12 +1967,12 @@ namespace Parser
|
||||
}
|
||||
}
|
||||
|
||||
public BlockStatementSyntaxNode Body
|
||||
public StatementSyntaxNode Body
|
||||
{
|
||||
get
|
||||
{
|
||||
var red = this.GetRed(ref this._body!, 5);
|
||||
return red is null ? throw new System.Exception("body cannot be null.") : (BlockStatementSyntaxNode)red;
|
||||
return red is null ? throw new System.Exception("body cannot be null.") : (StatementSyntaxNode)red;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user