提交 1e55db60 编写于 作者: J John Hamby

Partway through removing IStatement.

上级 9d9d0f9f
......@@ -8,7 +8,7 @@
namespace Microsoft.CodeAnalysis.CSharp
{
partial class BoundStatement : IStatement
partial class BoundStatement : IOperation
{
OperationKind IOperation.Kind => this.StatementKind;
......@@ -28,13 +28,13 @@ partial class BoundBlock : IBlockStatement
private static readonly ConditionalWeakTable<BoundBlock, object> s_blockStatementsMappings =
new ConditionalWeakTable<BoundBlock, object>();
ImmutableArray<IStatement> IBlockStatement.Statements
ImmutableArray<IOperation> IBlockStatement.Statements
{
get
{
// This is to filter out operations of kind None.
return (ImmutableArray<IStatement>) s_blockStatementsMappings.GetValue(this,
blockStatement => { return blockStatement.Statements.AsImmutable<IStatement>().WhereAsArray(statement => statement.Kind != OperationKind.None); }
return (ImmutableArray<IOperation>) s_blockStatementsMappings.GetValue(this,
blockStatement => { return blockStatement.Statements.AsImmutable<IOperation>().WhereAsArray(statement => statement.Kind != OperationKind.None); }
);
}
}
......@@ -88,8 +88,10 @@ public override void Accept(OperationVisitor visitor)
}
}
partial class BoundYieldBreakStatement
partial class BoundYieldBreakStatement : IReturnStatement
{
IExpression IReturnStatement.ReturnedValue => null;
protected override OperationKind StatementKind => OperationKind.YieldBreakStatement;
public override void Accept(OperationVisitor visitor)
......@@ -120,7 +122,7 @@ public override void Accept(OperationVisitor visitor)
}
}
partial class BoundNoOpStatement
partial class BoundNoOpStatement : IEmptyStatement
{
protected override OperationKind StatementKind => OperationKind.EmptyStatement;
......@@ -139,9 +141,9 @@ partial class BoundIfStatement : IIfStatement
{
IExpression IIfStatement.Condition => this.Condition;
IStatement IIfStatement.IfTrue => this.Consequence;
IOperation IIfStatement.IfTrue => this.Consequence;
IStatement IIfStatement.IfFalse => this.AlternativeOpt;
IOperation IIfStatement.IfFalse => this.AlternativeOpt;
protected override OperationKind StatementKind => OperationKind.IfStatement;
......@@ -166,7 +168,7 @@ partial class BoundWhileStatement : IWhileUntilLoopStatement
LoopKind ILoopStatement.LoopKind => LoopKind.WhileUntil;
IStatement ILoopStatement.Body => this.Body;
IOperation ILoopStatement.Body => this.Body;
protected override OperationKind StatementKind => OperationKind.LoopStatement;
......@@ -191,7 +193,7 @@ partial class BoundDoStatement : IWhileUntilLoopStatement
LoopKind ILoopStatement.LoopKind => LoopKind.WhileUntil;
IStatement ILoopStatement.Body => this.Body;
IOperation ILoopStatement.Body => this.Body;
protected override OperationKind StatementKind => OperationKind.LoopStatement;
......@@ -208,9 +210,9 @@ public override void Accept(OperationVisitor visitor)
partial class BoundForStatement : IForLoopStatement
{
ImmutableArray<IStatement> IForLoopStatement.Before => ToStatements(this.Initializer);
ImmutableArray<IOperation> IForLoopStatement.Before => ToStatements(this.Initializer);
ImmutableArray<IStatement> IForLoopStatement.AtLoopBottom => ToStatements(this.Increment);
ImmutableArray<IOperation> IForLoopStatement.AtLoopBottom => ToStatements(this.Increment);
ImmutableArray<ILocalSymbol> IForLoopStatement.Locals => this.OuterLocals.As<ILocalSymbol>();
......@@ -218,23 +220,23 @@ partial class BoundForStatement : IForLoopStatement
LoopKind ILoopStatement.LoopKind => LoopKind.For;
IStatement ILoopStatement.Body => this.Body;
IOperation ILoopStatement.Body => this.Body;
protected override OperationKind StatementKind => OperationKind.LoopStatement;
ImmutableArray<IStatement> ToStatements(BoundStatement statement)
ImmutableArray<IOperation> ToStatements(BoundStatement statement)
{
BoundStatementList statementList = statement as BoundStatementList;
if (statementList != null)
{
return statementList.Statements.As<IStatement>();
return statementList.Statements.As<IOperation>();
}
else if (statement == null)
{
return ImmutableArray<IStatement>.Empty;
return ImmutableArray<IOperation>.Empty;
}
return ImmutableArray.Create<IStatement>(statement);
return ImmutableArray.Create<IOperation>(statement);
}
public override void Accept(OperationVisitor visitor)
......@@ -256,7 +258,7 @@ partial class BoundForEachStatement : IForEachLoopStatement
LoopKind ILoopStatement.LoopKind => LoopKind.ForEach;
IStatement ILoopStatement.Body => this.Body;
IOperation ILoopStatement.Body => this.Body;
protected override OperationKind StatementKind => OperationKind.LoopStatement;
......@@ -306,13 +308,13 @@ private sealed class SwitchSection : ICase
{
public SwitchSection(BoundSwitchSection boundNode)
{
this.Body = boundNode.Statements.As<IStatement>();
this.Body = boundNode.Statements.As<IOperation>();
this.Clauses = boundNode.BoundSwitchLabels.As<ICaseClause>();
this.IsInvalid = boundNode.HasErrors;
this.Syntax = boundNode.Syntax;
}
public ImmutableArray<IStatement> Body { get; }
public ImmutableArray<IOperation> Body { get; }
public ImmutableArray<ICaseClause> Clauses { get; }
......@@ -446,7 +448,7 @@ partial class BoundFixedStatement : IFixedStatement
{
IVariableDeclarationStatement IFixedStatement.Variables => this.Declarations;
IStatement IFixedStatement.Body => this.Body;
IOperation IFixedStatement.Body => this.Body;
protected override OperationKind StatementKind => OperationKind.FixedStatement;
......@@ -467,7 +469,7 @@ partial class BoundUsingStatement : IUsingWithDeclarationStatement, IUsingWithEx
IExpression IUsingWithExpressionStatement.Value => this.ExpressionOpt;
IStatement IUsingStatement.Body => this.Body;
IOperation IUsingStatement.Body => this.Body;
protected override OperationKind StatementKind => this.ExpressionOpt != null ? OperationKind.UsingWithExpressionStatement : OperationKind.UsingWithDeclarationStatement;
......@@ -510,7 +512,7 @@ public override void Accept(OperationVisitor visitor)
partial class BoundReturnStatement : IReturnStatement
{
IExpression IReturnStatement.Returned => this.ExpressionOpt;
IExpression IReturnStatement.ReturnedValue => this.ExpressionOpt;
protected override OperationKind StatementKind => OperationKind.ReturnStatement;
......@@ -527,7 +529,7 @@ public override void Accept(OperationVisitor visitor)
partial class BoundYieldReturnStatement : IReturnStatement
{
IExpression IReturnStatement.Returned => this.Expression;
IExpression IReturnStatement.ReturnedValue => this.Expression;
protected override OperationKind StatementKind => OperationKind.YieldReturnStatement;
......@@ -546,7 +548,7 @@ partial class BoundLockStatement : ILockStatement
{
IExpression ILockStatement.LockedObject => this.Argument;
IStatement ILockStatement.Body => this.Body;
IOperation ILockStatement.Body => this.Body;
protected override OperationKind StatementKind => OperationKind.LockStatement;
......@@ -561,7 +563,7 @@ public override void Accept(OperationVisitor visitor)
}
}
partial class BoundBadStatement
partial class BoundBadStatement : IInvalidStatement
{
protected override OperationKind StatementKind => OperationKind.InvalidStatement;
......@@ -651,7 +653,7 @@ public override void Accept(OperationVisitor visitor)
partial class BoundLabeledStatement : ILabeledStatement
{
IStatement ILabeledStatement.Labeled => this.Body;
IOperation ILabeledStatement.Labeled => this.Body;
ILabelSymbol ILabelStatement.Label => this.Label;
......
......@@ -177,7 +177,7 @@ public interface ISyntheticLocalReferenceExpression : IReferenceExpression
/// <summary>
/// Statement defining the lifetime of the synthetic local.
/// </summary>
IStatement ContainingStatement { get; }
IOperation ContainingStatement { get; }
}
/// <summary>
......
......@@ -36,6 +36,7 @@ public enum OperationKind
{
None = 0x0,
/// <summary>Indicates an <see cref="IInvalidStatement"/>.</summary>
InvalidStatement = 0x1,
/// <summary>Indicates an <see cref="IBlockStatement"/>.</summary>
BlockStatement = 0x2,
......@@ -51,11 +52,13 @@ public enum OperationKind
ContinueStatement = 0x7,
/// <summary>Indicates an <see cref="IBranchStatement"/>.</summary>
BreakStatement = 0x8,
/// <summary>Indicates an <see cref="IReturnStatement"/>.</summary>
YieldBreakStatement = 0x9,
LabelStatement = 0xa,
LabeledStatement = 0xb, // Why do both of these exist?
/// <summary>Indicates an <see cref="IBranchStatement"/>.</summary>
GoToStatement = 0xc,
/// <summary>Indicates an <see cref="IEmptyStatement"/>.</summary>
EmptyStatement = 0xd,
/// <summary>Indicates an <see cref="IThrowStatement"/>.</summary>
ThrowStatement = 0xe,
......@@ -151,7 +154,9 @@ public enum OperationKind
// VB only
OmittedArgumentExpression = 0x3c,
/// <summary>Indicates an <see cref="IStopStatement"/>.</summary>
StopStatement = 0x3d,
/// <summary>Indicates an <see cref="IEndStatement"/>.</summary>
EndStatement = 0x3e,
/// <summary>Indicates an <see cref="IWithStatement"/>.</summary>
WithStatement = 0x3f,
......
......@@ -4,22 +4,15 @@
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Root type for representing the abstract semantics of C# and VB statements.
/// </summary>
public interface IStatement : IOperation
{
}
/// <summary>
/// Represents a block scope.
/// </summary>
public interface IBlockStatement : IStatement
public interface IBlockStatement : IOperation
{
/// <summary>
/// Statements contained within the block.
/// </summary>
ImmutableArray<IStatement> Statements { get; }
ImmutableArray<IOperation> Statements { get; }
/// <summary>
/// Local declarations contained within the block.
/// </summary>
......@@ -29,7 +22,7 @@ public interface IBlockStatement : IStatement
/// <summary>
/// Represents a local variable declaration statement.
/// </summary>
public interface IVariableDeclarationStatement : IStatement
public interface IVariableDeclarationStatement : IOperation
{
/// <summary>
/// Variables declared by the statement.
......@@ -55,7 +48,7 @@ public interface IVariableDeclaration : IOperation
/// <summary>
/// Represents a C# switch or VB Select Case statement.
/// </summary>
public interface ISwitchStatement : IStatement
public interface ISwitchStatement : IOperation
{
/// <summary>
/// Value to be switched upon.
......@@ -79,7 +72,7 @@ public interface ICase : IOperation
/// <summary>
/// Statements of the case.
/// </summary>
ImmutableArray<IStatement> Body { get; }
ImmutableArray<IOperation> Body { get; }
}
/// <summary>
......@@ -164,7 +157,7 @@ public interface IRangeCaseClause : ICaseClause
/// <summary>
/// Represents an if statement in C# or an If statement in VB.
/// </summary>
public interface IIfStatement : IStatement
public interface IIfStatement : IOperation
{
/// <summary>
/// Condition of the if statement. For C# there is naturally one clause per if, but for VB If statements with multiple clauses are rewritten to have only one.
......@@ -173,17 +166,17 @@ public interface IIfStatement : IStatement
/// <summary>
/// Statement executed if the condition is true.
/// </summary>
IStatement IfTrue { get; }
IOperation IfTrue { get; }
/// <summary>
/// Statement executed if the condition is false.
/// </summary>
IStatement IfFalse { get; }
IOperation IfFalse { get; }
}
/// <summary>
/// Represents a C# while, for, foreach, or do statement, or a VB While, For, For Each, or Do statement.
/// </summary>
public interface ILoopStatement : IStatement
public interface ILoopStatement : IOperation
{
/// <summary>
/// Kind of the loop.
......@@ -192,7 +185,7 @@ public interface ILoopStatement : IStatement
/// <summary>
/// Body of the loop.
/// </summary>
IStatement Body { get; }
IOperation Body { get; }
}
/// <summary>
......@@ -203,15 +196,15 @@ public enum LoopKind
/// <summary>
/// Indicates a C# while or do loop, or a VB While or Do loop.
/// </summary>
WhileUntil,
WhileUntil = 0x0,
/// <summary>
/// Indicates a C# for loop or a VB For loop.
/// </summary>
For,
For = 0x1,
/// <summary>
/// Indicates a C# foreach loop or a VB For Each loop.
/// </summary>
ForEach
ForEach = 0x2
}
/// <summary>
......@@ -248,11 +241,11 @@ public interface IForLoopStatement : IForWhileUntilLoopStatement
/// <summary>
/// Statements to execute before entry to the loop. For C# these come from the first clause of the for statement. For VB these initialize the index variable of the For statement.
/// </summary>
ImmutableArray<IStatement> Before { get; }
ImmutableArray<IOperation> Before { get; }
/// <summary>
/// Statements to execute at the bottom of the loop. For C# these come from the third clause of the for statement. For VB these increment the index variable of the For statement.
/// </summary>
ImmutableArray<IStatement> AtLoopBottom { get; }
ImmutableArray<IOperation> AtLoopBottom { get; }
/// <summary>
/// Declarations local to the loop.
/// </summary>
......@@ -277,7 +270,7 @@ public interface IForEachLoopStatement : ILoopStatement
/// <summary>
/// Represents a C# or VB label statement.
/// </summary>
public interface ILabelStatement : IStatement
public interface ILabelStatement : IOperation
{
// Label that can be the target of branches.
ILabelSymbol Label { get; }
......@@ -289,13 +282,13 @@ public interface ILabelStatement : IStatement
public interface ILabeledStatement : ILabelStatement
{
// Statement that has been labeled.
IStatement Labeled { get; }
IOperation Labeled { get; }
}
/// <summary>
/// Represents a C# goto, break, or continue statement, or a VB GoTo, Exit ***, or Continue *** statement
/// </summary>
public interface IBranchStatement : IStatement
public interface IBranchStatement : IOperation
{
// Label that is the target of the branch.
ILabelSymbol Target { get; }
......@@ -304,7 +297,7 @@ public interface IBranchStatement : IStatement
/// <summary>
/// Represents a C# throw or a VB Throw statement.
/// </summary>
public interface IThrowStatement : IStatement
public interface IThrowStatement : IOperation
{
// Thrown expression.
IExpression ThrownObject { get; }
......@@ -313,18 +306,18 @@ public interface IThrowStatement : IStatement
/// <summary>
/// Represents a C# return or a VB Return statement.
/// </summary>
public interface IReturnStatement : IStatement
public interface IReturnStatement : IOperation
{
/// <summary>
/// Value to be returned.
/// </summary>
IExpression Returned { get; }
IExpression ReturnedValue { get; }
}
/// <summary>
/// Represents a C# lock or a VB SyncLock statement.
/// </summary>
public interface ILockStatement : IStatement
public interface ILockStatement : IOperation
{
/// <summary>
/// Value to be locked.
......@@ -333,13 +326,13 @@ public interface ILockStatement : IStatement
/// <summary>
/// Body of the lock, to be executed while holding the lock.
/// </summary>
IStatement Body { get; }
IOperation Body { get; }
}
/// <summary>
/// Represents a C# try or a VB Try statement.
/// </summary>
public interface ITryStatement : IStatement
public interface ITryStatement : IOperation
{
/// <summary>
/// Body of the try, over which the handlers are active.
......@@ -381,12 +374,12 @@ public interface ICatch : IOperation
/// <summary>
/// Represents a C# using or VB Using statement.
/// </summary>
public interface IUsingStatement : IStatement
public interface IUsingStatement : IOperation
{
/// <summary>
/// Body of the using, over which the resources of the using are maintained.
/// </summary>
IStatement Body { get; }
IOperation Body { get; }
}
/// <summary>
......@@ -414,7 +407,7 @@ public interface IUsingWithExpressionStatement : IUsingStatement
/// <summary>
/// Represents a C# fixed staement.
/// </summary>
public interface IFixedStatement : IStatement
public interface IFixedStatement : IOperation
{
/// <summary>
/// Variables to be fixed.
......@@ -423,13 +416,13 @@ public interface IFixedStatement : IStatement
/// <summary>
/// Body of the fixed, over which the variables are fixed.
/// </summary>
IStatement Body { get; }
IOperation Body { get; }
}
/// <summary>
/// Represents a C# or VB statement that consists solely of an expression.
/// </summary>
public interface IExpressionStatement : IStatement
public interface IExpressionStatement : IOperation
{
/// <summary>
/// Expression of the statement.
......@@ -440,15 +433,43 @@ public interface IExpressionStatement : IStatement
/// <summary>
/// Represents a VB With statement.
/// </summary>
public interface IWithStatement : IStatement
public interface IWithStatement : IOperation
{
/// <summary>
/// Body of the with.
/// </summary>
IStatement Body { get; }
IOperation Body { get; }
/// <summary>
/// Value to whose members leading-dot-qualified references within the with body bind.
/// </summary>
IExpression Value { get; }
}
/// <summary>
/// Reprsents an empty statement.
/// </summary>
public interface IEmptyStatement : IOperation
{
}
/// <summary>
/// Represents a VB Stop statement.
/// </summary>
public interface IStopStatement : IOperation
{
}
/// <summary>
/// Represents a VB End statemnt.
/// </summary>
public interface IEndStatement : IOperation
{
}
/// <summary>
/// Represents a syntactically or semantically invalid C# or VB statement.
/// </summary>
public interface IInvalidStatement : IOperation
{
}
}
......@@ -93,12 +93,12 @@ public virtual void VisitBranchStatement(IBranchStatement operation)
DefaultVisit(operation);
}
public virtual void VisitYieldBreakStatement(IStatement operation)
public virtual void VisitYieldBreakStatement(IReturnStatement operation)
{
DefaultVisit(operation);
}
public virtual void VisitEmptyStatement(IStatement operation)
public virtual void VisitEmptyStatement(IEmptyStatement operation)
{
DefaultVisit(operation);
}
......@@ -153,12 +153,12 @@ public virtual void VisitWithStatement(IWithStatement operation)
DefaultVisit(operation);
}
public virtual void VisitStopStatement(IStatement operation)
public virtual void VisitStopStatement(IStopStatement operation)
{
DefaultVisit(operation);
}
public virtual void VisitEndStatement(IStatement operation)
public virtual void VisitEndStatement(IEndStatement operation)
{
DefaultVisit(operation);
}
......@@ -368,7 +368,7 @@ public virtual void VisitTypeParameterObjectCreationExpression(IExpression opera
DefaultVisit(operation);
}
public virtual void VisitInvalidStatement(IStatement operation)
public virtual void VisitInvalidStatement(IInvalidStatement operation)
{
DefaultVisit(operation);
}
......@@ -478,12 +478,12 @@ public virtual TResult VisitBranchStatement(IBranchStatement operation, TArgumen
return DefaultVisit(operation, argument);
}
public virtual TResult VisitYieldBreakStatement(IStatement operation, TArgument argument)
public virtual TResult VisitYieldBreakStatement(IReturnStatement operation, TArgument argument)
{
return DefaultVisit(operation, argument);
}
public virtual TResult VisitEmptyStatement(IStatement operation, TArgument argument)
public virtual TResult VisitEmptyStatement(IEmptyStatement operation, TArgument argument)
{
return DefaultVisit(operation, argument);
}
......@@ -538,12 +538,12 @@ public virtual TResult VisitWithStatement(IWithStatement operation, TArgument ar
return DefaultVisit(operation, argument);
}
public virtual TResult VisitStopStatement(IStatement operation, TArgument argument)
public virtual TResult VisitStopStatement(IStopStatement operation, TArgument argument)
{
return DefaultVisit(operation, argument);
}
public virtual TResult VisitEndStatement(IStatement operation, TArgument argument)
public virtual TResult VisitEndStatement(IEndStatement operation, TArgument argument)
{
return DefaultVisit(operation, argument);
}
......@@ -753,7 +753,7 @@ public virtual TResult VisitTypeParameterObjectCreationExpression(IExpression op
return DefaultVisit(operation, argument);
}
public virtual TResult VisitInvalidStatement(IStatement operation, TArgument argument)
public virtual TResult VisitInvalidStatement(IInvalidStatement operation, TArgument argument)
{
return DefaultVisit(operation, argument);
}
......
......@@ -130,10 +130,10 @@ public override void VisitLabeledStatement(ILabeledStatement operation)
public override void VisitBranchStatement(IBranchStatement operation)
{ }
public override void VisitYieldBreakStatement(IStatement operation)
public override void VisitYieldBreakStatement(IReturnStatement operation)
{ }
public override void VisitEmptyStatement(IStatement operation)
public override void VisitEmptyStatement(IEmptyStatement operation)
{ }
public override void VisitThrowStatement(IThrowStatement operation)
......@@ -143,7 +143,7 @@ public override void VisitThrowStatement(IThrowStatement operation)
public override void VisitReturnStatement(IReturnStatement operation)
{
Visit(operation.Returned);
Visit(operation.ReturnedValue);
}
public override void VisitLockStatement(ILockStatement operation)
......@@ -192,10 +192,10 @@ public override void VisitWithStatement(IWithStatement operation)
Visit(operation.Body);
}
public override void VisitStopStatement(IStatement operation)
public override void VisitStopStatement(IStopStatement operation)
{ }
public override void VisitEndStatement(IStatement operation)
public override void VisitEndStatement(IEndStatement operation)
{ }
public override void VisitInvocationExpression(IInvocationExpression operation)
......@@ -395,7 +395,7 @@ public override void VisitDefaultValueExpression(IExpression operation)
public override void VisitTypeParameterObjectCreationExpression(IExpression operation)
{ }
public override void VisitInvalidStatement(IStatement operation)
public override void VisitInvalidStatement(IInvalidStatement operation)
{ }
public override void VisitInvalidExpression(IExpression operation)
......
......@@ -7,7 +7,7 @@ Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Namespace Microsoft.CodeAnalysis.VisualBasic
Partial Class BoundStatement
Implements IStatement
Implements IOperation
Private ReadOnly Property IKind As OperationKind Implements IOperation.Kind
Get
......@@ -43,13 +43,13 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End Get
End Property
Private ReadOnly Property IIfTrue As IStatement Implements IIfStatement.IfTrue
Private ReadOnly Property IIfTrue As IOperation Implements IIfStatement.IfTrue
Get
Return Me.Consequence
End Get
End Property
Private ReadOnly Property IIfFalse As IStatement Implements IIfStatement.IfFalse
Private ReadOnly Property IIfFalse As IOperation Implements IIfStatement.IfFalse
Get
Return Me.AlternativeOpt
End Get
......@@ -106,7 +106,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Implements ICase
Private ReadOnly _clauses As ImmutableArray(Of ICaseClause)
Private ReadOnly _body As ImmutableArray(Of IStatement)
Private ReadOnly _body As ImmutableArray(Of IOperation)
Private ReadOnly _isInvalid As Boolean
Private ReadOnly _syntax As SyntaxNode
......@@ -120,7 +120,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
_clauses = caseStatement.CaseClauses.As(Of ICaseClause)()
End If
_body = ImmutableArray.Create(Of IStatement)(boundCaseBlock.Body)
_body = ImmutableArray.Create(Of IOperation)(boundCaseBlock.Body)
_isInvalid = boundCaseBlock.HasErrors
_syntax = boundCaseBlock.Syntax
End Sub
......@@ -133,7 +133,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Return visitor.VisitCase(Me, argument)
End Function
Public ReadOnly Property Body As ImmutableArray(Of IStatement) Implements ICase.Body
Public ReadOnly Property Body As ImmutableArray(Of IOperation) Implements ICase.Body
Get
Return _body
End Get
......@@ -455,7 +455,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End Get
End Property
Private ReadOnly Property IBody As IStatement Implements ILoopStatement.Body
Private ReadOnly Property IBody As IOperation Implements ILoopStatement.Body
Get
Return Me.Body
End Get
......@@ -497,12 +497,12 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Private Shared ReadOnly s_loopBottomMappings As New System.Runtime.CompilerServices.ConditionalWeakTable(Of BoundForToStatement, Object)
Private ReadOnly Property IAtLoopBottom As ImmutableArray(Of IStatement) Implements IForLoopStatement.AtLoopBottom
Private ReadOnly Property IAtLoopBottom As ImmutableArray(Of IOperation) Implements IForLoopStatement.AtLoopBottom
Get
Dim result = s_loopBottomMappings.GetValue(
Me,
Function(BoundFor)
Dim statements As ArrayBuilder(Of IStatement) = ArrayBuilder(Of IStatement).GetInstance()
Dim statements As ArrayBuilder(Of IOperation) = ArrayBuilder(Of IOperation).GetInstance()
Dim operators As BoundForToUserDefinedOperators = BoundFor.OperatorsOpt
If operators IsNot Nothing Then
' Use the operator methods. Figure out the precise rules first.
......@@ -527,18 +527,18 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Return statements.ToImmutableAndFree()
End Function)
Return DirectCast(result, ImmutableArray(Of IStatement))
Return DirectCast(result, ImmutableArray(Of IOperation))
End Get
End Property
Private Shared ReadOnly s_loopTopMappings As New System.Runtime.CompilerServices.ConditionalWeakTable(Of BoundForToStatement, Object)
Private ReadOnly Property IBefore As ImmutableArray(Of IStatement) Implements IForLoopStatement.Before
Private ReadOnly Property IBefore As ImmutableArray(Of IOperation) Implements IForLoopStatement.Before
Get
Dim result = s_loopTopMappings.GetValue(
Me,
Function(BoundFor)
Dim statements As ArrayBuilder(Of IStatement) = ArrayBuilder(Of IStatement).GetInstance()
Dim statements As ArrayBuilder(Of IOperation) = ArrayBuilder(Of IOperation).GetInstance()
' ControlVariable = InitialValue
Dim controlReference As IReferenceExpression = TryCast(BoundFor.ControlVariable, IReferenceExpression)
......@@ -559,7 +559,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Return statements.ToImmutableAndFree()
End Function)
Return DirectCast(result, ImmutableArray(Of IStatement))
Return DirectCast(result, ImmutableArray(Of IOperation))
End Get
End Property
......@@ -611,7 +611,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End Get
End Property
Private ReadOnly Property IBody As IStatement Implements ILoopStatement.Body
Private ReadOnly Property IBody As IOperation Implements ILoopStatement.Body
Get
Return Me.Body
End Get
......@@ -639,10 +639,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Implements ISyntheticLocalReferenceExpression
Private _temporaryKind As SyntheticLocalKind
Private _containingStatement As IStatement
Private _containingStatement As IOperation
Private _capturedValue As IExpression
Public Sub New(temporaryKind As SyntheticLocalKind, containingStatement As IStatement, capturedValue As IExpression)
Public Sub New(temporaryKind As SyntheticLocalKind, containingStatement As IOperation, capturedValue As IExpression)
Me._temporaryKind = temporaryKind
Me._containingStatement = containingStatement
Me._capturedValue = capturedValue
......@@ -686,7 +686,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End Get
End Property
Public ReadOnly Property ContainingStatement As IStatement Implements ISyntheticLocalReferenceExpression.ContainingStatement
Public ReadOnly Property ContainingStatement As IOperation Implements ISyntheticLocalReferenceExpression.ContainingStatement
Get
Return Me._containingStatement
End Get
......@@ -726,7 +726,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End Get
End Property
Private ReadOnly Property ILoop_Body As IStatement Implements ILoopStatement.Body
Private ReadOnly Property ILoop_Body As IOperation Implements ILoopStatement.Body
Get
Return Me.Body
End Get
......@@ -849,15 +849,15 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End Get
End Property
Private ReadOnly Property IStatements As ImmutableArray(Of IStatement) Implements IBlockStatement.Statements
Private ReadOnly Property IStatements As ImmutableArray(Of IOperation) Implements IBlockStatement.Statements
Get
' This is to filter out operations of kind None.
Dim statements = s_blockStatementsMappings.GetValue(Me, Function(boundBlock)
Return boundBlock.Statements.As(Of IStatement).WhereAsArray(Function(statement)
Return boundBlock.Statements.As(Of IOperation).WhereAsArray(Function(statement)
Return statement.Kind <> OperationKind.None
End Function)
End Function)
Return DirectCast(statements, ImmutableArray(Of IStatement))
Return DirectCast(statements, ImmutableArray(Of IOperation))
End Get
End Property
......@@ -875,6 +875,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End Class
Partial Class BoundBadStatement
Implements IInvalidStatement
Protected Overrides Function StatementKind() As OperationKind
Return OperationKind.InvalidStatement
End Function
......@@ -891,7 +892,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Partial Class BoundReturnStatement
Implements IReturnStatement
Private ReadOnly Property IReturned As IExpression Implements IReturnStatement.Returned
Private ReadOnly Property IReturned As IExpression Implements IReturnStatement.ReturnedValue
Get
Return Me.ExpressionOpt
End Get
......@@ -941,7 +942,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End Get
End Property
Private ReadOnly Property IBody As IStatement Implements ILoopStatement.Body
Private ReadOnly Property IBody As IOperation Implements ILoopStatement.Body
Get
Return Me.Body
End Get
......@@ -1020,7 +1021,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Partial Class BoundYieldStatement
Implements IReturnStatement
Private ReadOnly Property IReturned As IExpression Implements IReturnStatement.Returned
Private ReadOnly Property IReturned As IExpression Implements IReturnStatement.ReturnedValue
Get
Return Me.Expression
End Get
......@@ -1136,7 +1137,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End Get
End Property
Private ReadOnly Property IBody As IStatement Implements ILockStatement.Body
Private ReadOnly Property IBody As IOperation Implements ILockStatement.Body
Get
Return Me.Body
End Get
......@@ -1156,6 +1157,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End Class
Partial Class BoundNoOpStatement
Implements IEmptyStatement
Protected Overrides Function StatementKind() As OperationKind
Return OperationKind.EmptyStatement
End Function
......@@ -1212,6 +1215,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End Class
Partial Class BoundStopStatement
Implements IStopStatement
Protected Overrides Function StatementKind() As OperationKind
Return OperationKind.StopStatement
End Function
......@@ -1226,6 +1231,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End Class
Partial Class BoundEndStatement
Implements IEndStatement
Protected Overrides Function StatementKind() As OperationKind
Return OperationKind.EndStatement
End Function
......@@ -1242,7 +1249,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
Partial Class BoundWithStatement
Implements IWithStatement
Private ReadOnly Property IBody As IStatement Implements IWithStatement.Body
Private ReadOnly Property IBody As IOperation Implements IWithStatement.Body
Get
Return Me.Body
End Get
......@@ -1288,7 +1295,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End Get
End Property
Private ReadOnly Property IBody As IStatement Implements IUsingStatement.Body
Private ReadOnly Property IBody As IOperation Implements IUsingStatement.Body
Get
Return Me.Body
End Get
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册