提交 43f14f10 编写于 作者: H Heejae Chang

first step on separating IOperation from BoundTree.

this is easy step. just spliting all IOperations as its own files and put them in its own folder
上级 282904d7
......@@ -36,6 +36,102 @@
<Compile Include="InternalUtilities\NoThrowStreamDisposer.cs" />
<Compile Include="InternalUtilities\OrderedMultiDictionary.cs" />
<Compile Include="InternalUtilities\PlatformInformation.cs" />
<Compile Include="Operations\ArgumentKind.cs" />
<Compile Include="Operations\BinaryOperandsKind.cs" />
<Compile Include="Operations\BinaryOperationKind.cs" />
<Compile Include="Operations\BranchKind.cs" />
<Compile Include="Operations\CaseKind.cs" />
<Compile Include="Operations\ConversionKind.cs" />
<Compile Include="Operations\Expressions.cs" />
<Compile Include="Operations\IAddressOfExpression.cs" />
<Compile Include="Operations\IArgument.cs" />
<Compile Include="Operations\IArrayCreationExpression.cs" />
<Compile Include="Operations\IArrayElementReferenceExpression.cs" />
<Compile Include="Operations\IArrayInitializer.cs" />
<Compile Include="Operations\IAssignmentExpression.cs" />
<Compile Include="Operations\IAwaitExpression.cs" />
<Compile Include="Operations\IBinaryOperatorExpression.cs" />
<Compile Include="Operations\IBlockStatement.cs" />
<Compile Include="Operations\IBranchStatement.cs" />
<Compile Include="Operations\ICaseClause.cs" />
<Compile Include="Operations\ICatchClause.cs" />
<Compile Include="Operations\ICompoundAssignmentExpression.cs" />
<Compile Include="Operations\IConditionalAccessExpression.cs" />
<Compile Include="Operations\IConditionalAccessInstanceExpression.cs" />
<Compile Include="Operations\IConditionalChoiceExpression.cs" />
<Compile Include="Operations\IConversionExpression.cs" />
<Compile Include="Operations\IDefaultValueExpression.cs" />
<Compile Include="Operations\IEmptyStatement.cs" />
<Compile Include="Operations\IEndStatement.cs" />
<Compile Include="Operations\IEventAssignmentExpression.cs" />
<Compile Include="Operations\IEventReferenceExpression.cs" />
<Compile Include="Operations\IExpressionStatement.cs" />
<Compile Include="Operations\IFieldInitializer.cs" />
<Compile Include="Operations\IFieldReferenceExpression.cs" />
<Compile Include="Operations\IFixedStatement.cs" />
<Compile Include="Operations\IForEachLoopStatement.cs" />
<Compile Include="Operations\IForLoopStatement.cs" />
<Compile Include="Operations\IForWhileUntilLoopStatement.cs" />
<Compile Include="Operations\IHasArgumentsExpression.cs" />
<Compile Include="Operations\IHasOperatorMethodExpression.cs" />
<Compile Include="Operations\IIfStatement.cs" />
<Compile Include="Operations\IIncrementExpression.cs" />
<Compile Include="Operations\IIndexedPropertyReferenceExpression.cs" />
<Compile Include="Operations\IInstanceReferenceExpression.cs" />
<Compile Include="Operations\IInvalidExpression.cs" />
<Compile Include="Operations\IInvalidStatement.cs" />
<Compile Include="Operations\IInvocationExpression.cs" />
<Compile Include="Operations\IIsTypeExpression.cs" />
<Compile Include="Operations\ILabelStatement.cs" />
<Compile Include="Operations\ILambdaExpression.cs" />
<Compile Include="Operations\ILateBoundMemberReferenceExpression.cs" />
<Compile Include="Operations\ILiteralExpression.cs" />
<Compile Include="Operations\ILocalReferenceExpression.cs" />
<Compile Include="Operations\ILockStatement.cs" />
<Compile Include="Operations\ILoopStatement.cs" />
<Compile Include="Operations\IMemberReferenceExpression.cs" />
<Compile Include="Operations\IMethodBindingExpression.cs" />
<Compile Include="Operations\InstanceReferenceKind.cs" />
<Compile Include="Operations\INullCoalescingExpression.cs" />
<Compile Include="Operations\IObjectCreationExpression.cs" />
<Compile Include="Operations\IOmittedArgumentExpression.cs" />
<Compile Include="Operations\IOperationKind.cs" />
<Compile Include="Operations\IParameterInitializer.cs" />
<Compile Include="Operations\IParameterReferenceExpression.cs" />
<Compile Include="Operations\IParenthesizedExpression.cs" />
<Compile Include="Operations\IPlaceholderExpression.cs" />
<Compile Include="Operations\IPointerIndirectionReferenceExpression.cs" />
<Compile Include="Operations\IPropertyInitializer.cs" />
<Compile Include="Operations\IPropertyReferenceExpression.cs" />
<Compile Include="Operations\IRangeCaseClause.cs" />
<Compile Include="Operations\IRelationalCaseClause.cs" />
<Compile Include="Operations\IReturnStatement.cs" />
<Compile Include="Operations\ISingleValueCaseClause.cs" />
<Compile Include="Operations\ISizeOfExpression.cs" />
<Compile Include="Operations\IStopStatement.cs" />
<Compile Include="Operations\ISwitchCase.cs" />
<Compile Include="Operations\ISwitchStatement.cs" />
<Compile Include="Operations\ISymbolInitializer.cs" />
<Compile Include="Operations\ISyntheticLocalReferenceExpression.cs" />
<Compile Include="Operations\IThrowStatement.cs" />
<Compile Include="Operations\ITryStatement.cs" />
<Compile Include="Operations\ITypeOfExpression.cs" />
<Compile Include="Operations\ITypeOperationExpression.cs" />
<Compile Include="Operations\ITypeParameterObjectCreationExpression.cs" />
<Compile Include="Operations\IUnaryOperatorExpression.cs" />
<Compile Include="Operations\IUnboundLambdaExpression.cs" />
<Compile Include="Operations\IUsingStatement.cs" />
<Compile Include="Operations\IVariableDeclaration.cs" />
<Compile Include="Operations\IVariableDeclarationStatement.cs" />
<Compile Include="Operations\IWhileUntilLoopStatement.cs" />
<Compile Include="Operations\IWithStatement.cs" />
<Compile Include="Operations\LoopKind.cs" />
<Compile Include="Operations\SimpleBinaryOperationKind.cs" />
<Compile Include="Operations\SimpleUnaryOperationKind.cs" />
<Compile Include="Operations\SyntheticLocalKind.cs" />
<Compile Include="Operations\UnaryAndBinaryOperationExtensions.cs" />
<Compile Include="Operations\UnaryOperandKind.cs" />
<Compile Include="Operations\UnaryOperationKind.cs" />
<Compile Include="Serialization\IObjectWritable.cs" />
<Compile Include="Serialization\ObjectBinder.cs" />
<Compile Include="Serialization\StreamObjectReader.cs" />
......@@ -74,8 +170,8 @@
<Compile Include="InternalUtilities\EmptyComparer.cs" />
<Compile Include="InternalUtilities\StringOrdinalComparer.cs" />
<Compile Include="MetadataReference\AssemblyIdentityMap.cs" />
<Compile Include="Compilation\OperationVisitor.cs" />
<Compile Include="Compilation\OperationWalker.cs" />
<Compile Include="Operations\OperationVisitor.cs" />
<Compile Include="Operations\OperationWalker.cs" />
<Compile Include="Compilation\ScriptCompilationInfo.cs" />
<Compile Include="DiagnosticAnalyzer\SyntaxTreeValueProvider.cs" />
<Compile Include="DiagnosticAnalyzer\SourceTextValueProvider.cs" />
......@@ -293,9 +389,7 @@
<Compile Include="Compilation\EmitResult.cs" />
<Compile Include="Compilation\Expression.cs" />
<Compile Include="Compilation\Extensions.cs" />
<Compile Include="Compilation\IExpression.cs" />
<Compile Include="Compilation\IOperation.cs" />
<Compile Include="Compilation\IStatement.cs" />
<Compile Include="Operations\IOperation.cs" />
<Compile Include="Compilation\OperationExtensions.cs" />
<Compile Include="Compilation\OptimizationLevel.cs" />
<Compile Include="Compilation\ParseOptions.cs" />
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Linq;
namespace Microsoft.CodeAnalysis.Semantics
{
internal class Expression
......@@ -81,401 +75,4 @@ public static BinaryOperationKind DeriveAdditionKind(ITypeSymbol type)
return BinaryOperationKind.Invalid;
}
}
internal sealed class ConditionalChoice : IConditionalChoiceExpression
{
public ConditionalChoice(IOperation condition, IOperation ifTrue, IOperation ifFalse, ITypeSymbol resultType, SyntaxNode syntax)
{
this.Condition = condition;
this.IfTrueValue = ifTrue;
this.IfFalseValue = ifFalse;
this.Type = resultType;
this.Syntax = syntax;
}
public IOperation Condition { get; }
public IOperation IfTrueValue { get; }
public IOperation IfFalseValue { get; }
public ITypeSymbol Type { get; }
public SyntaxNode Syntax { get; }
public OperationKind Kind => OperationKind.ConditionalChoiceExpression;
public bool IsInvalid => Condition == null || Condition.IsInvalid || IfTrueValue == null || IfTrueValue.IsInvalid || IfFalseValue == null || IfFalseValue.IsInvalid || Type == null;
public Optional<object> ConstantValue => default(Optional<object>);
public void Accept(OperationVisitor visitor)
{
visitor.VisitConditionalChoiceExpression(this);
}
public TResult Accept<TArgument, TResult>(OperationVisitor<TArgument, TResult> visitor, TArgument argument)
{
return visitor.VisitConditionalChoiceExpression(this, argument);
}
}
internal sealed class Assignment : IExpressionStatement
{
private readonly AssignmentExpression _assignment;
public Assignment(IOperation target, IOperation value, SyntaxNode syntax)
{
_assignment = new AssignmentExpression(target, value, syntax);
this.Syntax = syntax;
}
public SyntaxNode Syntax { get; }
public OperationKind Kind => OperationKind.ExpressionStatement;
public bool IsInvalid => _assignment.IsInvalid;
public IOperation Expression => _assignment;
public ITypeSymbol Type => null;
public Optional<object> ConstantValue => default(Optional<object>);
public void Accept(OperationVisitor visitor)
{
visitor.VisitExpressionStatement(this);
}
public TResult Accept<TArgument, TResult>(OperationVisitor<TArgument, TResult> visitor, TArgument argument)
{
return visitor.VisitExpressionStatement(this, argument);
}
private sealed class AssignmentExpression : IAssignmentExpression
{
public AssignmentExpression(IOperation target, IOperation value, SyntaxNode syntax)
{
this.Value = value;
this.Target = target;
this.Syntax = syntax;
}
public IOperation Target { get; }
public IOperation Value { get; }
public SyntaxNode Syntax { get; }
public ITypeSymbol Type => this.Target.Type;
public OperationKind Kind => OperationKind.AssignmentExpression;
public bool IsInvalid => Target == null || Target.IsInvalid || Value == null || Value.IsInvalid;
public Optional<object> ConstantValue => default(Optional<object>);
public void Accept(OperationVisitor visitor)
{
visitor.VisitAssignmentExpression(this);
}
public TResult Accept<TArgument, TResult>(OperationVisitor<TArgument, TResult> visitor, TArgument argument)
{
return visitor.VisitAssignmentExpression(this, argument);
}
}
}
internal sealed class CompoundAssignment : IExpressionStatement
{
private readonly CompoundAssignmentExpression _compoundAssignment;
public CompoundAssignment(IOperation target, IOperation value, BinaryOperationKind binaryOperationKind, IMethodSymbol operatorMethod, SyntaxNode syntax)
{
_compoundAssignment = new CompoundAssignmentExpression(target, value, binaryOperationKind, operatorMethod, syntax);
this.Syntax = syntax;
}
public SyntaxNode Syntax { get; }
public OperationKind Kind => OperationKind.ExpressionStatement;
public bool IsInvalid => _compoundAssignment.IsInvalid;
public IOperation Expression => _compoundAssignment;
public ITypeSymbol Type => null;
public Optional<object> ConstantValue => default(Optional<object>);
public void Accept(OperationVisitor visitor)
{
visitor.VisitExpressionStatement(this);
}
public TResult Accept<TArgument, TResult>(OperationVisitor<TArgument, TResult> visitor, TArgument argument)
{
return visitor.VisitExpressionStatement(this, argument);
}
private sealed class CompoundAssignmentExpression : ICompoundAssignmentExpression
{
public CompoundAssignmentExpression(IOperation target, IOperation value, BinaryOperationKind binaryOperationKind, IMethodSymbol operatorMethod, SyntaxNode syntax)
{
this.Target = target;
this.Value = value;
this.BinaryOperationKind = binaryOperationKind;
this.OperatorMethod = operatorMethod;
this.Syntax = syntax;
}
public IOperation Target { get; }
public IOperation Value { get; }
public BinaryOperationKind BinaryOperationKind { get; }
public IMethodSymbol OperatorMethod { get; }
public SyntaxNode Syntax { get; }
public ITypeSymbol Type => this.Target.Type;
public OperationKind Kind => OperationKind.CompoundAssignmentExpression;
public bool IsInvalid => Target == null || Target.IsInvalid || Value == null || Value.IsInvalid;
public Optional<object> ConstantValue => default(Optional<object>);
public bool UsesOperatorMethod => this.OperatorMethod != null;
public void Accept(OperationVisitor visitor)
{
visitor.VisitCompoundAssignmentExpression(this);
}
public TResult Accept<TArgument, TResult>(OperationVisitor<TArgument, TResult> visitor, TArgument argument)
{
return visitor.VisitCompoundAssignmentExpression(this, argument);
}
}
}
internal sealed class IntegerLiteral : ILiteralExpression
{
private readonly long _value;
public IntegerLiteral(long value, ITypeSymbol resultType, SyntaxNode syntax)
{
_value = value;
this.Type = resultType;
this.Syntax = syntax;
}
public string Text =>_value.ToString();
public ITypeSymbol Type { get; }
public OperationKind Kind => OperationKind.LiteralExpression;
public bool IsInvalid => false;
public Optional<object> ConstantValue => new Optional<object>(_value);
public SyntaxNode Syntax { get; }
public void Accept(OperationVisitor visitor)
{
visitor.VisitLiteralExpression(this);
}
public TResult Accept<TArgument, TResult>(OperationVisitor<TArgument, TResult> visitor, TArgument argument)
{
return visitor.VisitLiteralExpression(this, argument);
}
}
internal class Literal : ILiteralExpression
{
private readonly ConstantValue _value;
public Literal(ConstantValue value, ITypeSymbol resultType, SyntaxNode syntax)
{
Debug.Assert(value != null, "value can't be null");
_value = value;
this.Type = resultType;
this.Syntax = syntax;
}
public string Text => _value.GetValueToDisplay();
public ITypeSymbol Type { get; }
public OperationKind Kind => OperationKind.LiteralExpression;
public bool IsInvalid => _value.IsBad;
public Optional<object> ConstantValue => new Optional<object>(_value.Value);
public SyntaxNode Syntax { get; }
public void Accept(OperationVisitor visitor)
{
visitor.VisitLiteralExpression(this);
}
public TResult Accept<TArgument, TResult>(OperationVisitor<TArgument, TResult> visitor, TArgument argument)
{
return visitor.VisitLiteralExpression(this, argument);
}
}
internal sealed class Binary : IBinaryOperatorExpression
{
public Binary(BinaryOperationKind binaryOperationKind, IOperation left, IOperation right, ITypeSymbol resultType, SyntaxNode syntax)
{
this.BinaryOperationKind = binaryOperationKind;
this.LeftOperand = left;
this.RightOperand = right;
this.Type = resultType;
this.Syntax = syntax;
}
public BinaryOperationKind BinaryOperationKind { get; }
public IOperation LeftOperand { get; }
public IOperation RightOperand { get; }
public bool UsesOperatorMethod => false;
public IMethodSymbol OperatorMethod => null;
public ITypeSymbol Type { get; }
public OperationKind Kind => OperationKind.BinaryOperatorExpression;
public bool IsInvalid => LeftOperand == null
|| LeftOperand.IsInvalid
|| RightOperand == null
|| RightOperand.IsInvalid
|| BinaryOperationKind == BinaryOperationKind.Invalid
|| Type == null;
public Optional<object> ConstantValue => default(Optional<object>);
public SyntaxNode Syntax { get; }
public void Accept(OperationVisitor visitor)
{
visitor.VisitBinaryOperatorExpression(this);
}
public TResult Accept<TArgument, TResult>(OperationVisitor<TArgument, TResult> visitor, TArgument argument)
{
return visitor.VisitBinaryOperatorExpression(this, argument);
}
}
internal sealed class ArrayCreation : IArrayCreationExpression
{
private readonly IArrayTypeSymbol _arrayType;
public ArrayCreation(IArrayTypeSymbol arrayType, ImmutableArray<IOperation> elementValues, SyntaxNode syntax)
{
_arrayType = arrayType;
this.DimensionSizes = ImmutableArray.Create<IOperation>(new IntegerLiteral(elementValues.Count(), null, syntax));
this.Initializer = new ArrayInitializer(elementValues, syntax, arrayType);
this.Syntax = syntax;
}
public ITypeSymbol Type => _arrayType;
public ImmutableArray<IOperation> DimensionSizes { get; }
public ITypeSymbol ElementType => _arrayType.ElementType;
public IArrayInitializer Initializer { get; }
public SyntaxNode Syntax { get; }
public OperationKind Kind => OperationKind.ArrayCreationExpression;
public bool IsInvalid => IsInvalidInitializer(Initializer);
private static bool IsInvalidInitializer(IArrayInitializer initializer) => initializer.IsInvalid;
public void Accept(OperationVisitor visitor)
{
visitor.VisitArrayCreationExpression(this);
}
public TResult Accept<TArgument, TResult>(OperationVisitor<TArgument, TResult> visitor, TArgument argument)
{
return visitor.VisitArrayCreationExpression(this, argument);
}
public Optional<object> ConstantValue => default(Optional<object>);
private sealed class ArrayInitializer : IArrayInitializer
{
public ArrayInitializer(ImmutableArray<IOperation> elementValues, SyntaxNode syntax, ITypeSymbol arrayType)
{
ElementValues = elementValues;
Syntax = syntax;
Type = arrayType;
}
public ImmutableArray<IOperation> ElementValues { get; }
public bool IsInvalid => ElementValues.Any(v => v.IsInvalid);
public OperationKind Kind => OperationKind.ArrayInitializer;
public ITypeSymbol Type { get; }
public SyntaxNode Syntax { get; }
public Optional<object> ConstantValue => default(Optional<object>);
public void Accept(OperationVisitor visitor)
{
visitor.VisitArrayInitializer(this);
}
public TResult Accept<TArgument, TResult>(OperationVisitor<TArgument, TResult> visitor, TArgument argument)
{
return visitor.VisitArrayInitializer(this, argument);
}
}
}
internal sealed class InvalidExpression : IInvalidExpression
{
public InvalidExpression(SyntaxNode syntax)
{
this.Syntax = syntax;
}
public Optional<object> ConstantValue => default(Optional<object>);
public bool IsInvalid => true;
public OperationKind Kind => OperationKind.InvalidExpression;
public SyntaxNode Syntax { get; }
public ITypeSymbol Type => null;
public void Accept(OperationVisitor visitor)
{
visitor.VisitInvalidExpression(this);
}
public TResult Accept<TArgument, TResult>(OperationVisitor<TArgument, TResult> visitor, TArgument argument)
{
return visitor.VisitInvalidExpression(this, argument);
}
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents a block scope.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IBlockStatement : IOperation
{
/// <summary>
/// Statements contained within the block.
/// </summary>
ImmutableArray<IOperation> Statements { get; }
/// <summary>
/// Local declarations contained within the block.
/// </summary>
ImmutableArray<ILocalSymbol> Locals { get; }
}
/// <summary>
/// Represents a local variable declaration statement.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IVariableDeclarationStatement : IOperation
{
/// <summary>
/// Variables declared by the statement.
/// </summary>
ImmutableArray<IVariableDeclaration> Variables { get; }
}
/// <summary>
/// Represents a local variable declaration.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IVariableDeclaration : IOperation
{
/// <summary>
/// Variable declared by the declaration.
/// </summary>
ILocalSymbol Variable { get; }
/// <summary>
/// Initializer of the variable.
/// </summary>
IOperation InitialValue { get; }
}
/// <summary>
/// Represents a C# switch or VB Select Case statement.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface ISwitchStatement : IOperation
{
/// <summary>
/// Value to be switched upon.
/// </summary>
IOperation Value { get; }
/// <summary>
/// Cases of the switch.
/// </summary>
ImmutableArray<ISwitchCase> Cases { get; }
}
/// <summary>
/// Represents a C# case or VB Case statement.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface ISwitchCase : IOperation
{
/// <summary>
/// Clauses of the case. For C# there is one clause per case, but for VB there can be multiple.
/// </summary>
ImmutableArray<ICaseClause> Clauses { get; }
/// <summary>
/// Statements of the case.
/// </summary>
ImmutableArray<IOperation> Body { get; }
}
/// <summary>
/// Represents a clause of a C# case or a VB Case.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface ICaseClause : IOperation
{
/// <summary>
/// Kind of the clause.
/// </summary>
CaseKind CaseKind { get; }
}
/// <summary>
/// Kinds of cases.
/// </summary>
public enum CaseKind
{
None = 0x0,
/// <summary>
/// Indicates case x in C# or Case x in VB.
/// </summary>
SingleValue = 0x1,
/// <summary>
/// Indicates Case Is op x in VB.
/// </summary>
Relational = 0x2,
/// <summary>
/// Indicates Case x To Y in VB.
/// </summary>
Range = 0x3,
/// <summary>
/// Indicates default in C# or Case Else in VB.
/// </summary>
Default = 0x4
}
/// <summary>
/// Represents case x in C# or Case x in VB.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface ISingleValueCaseClause : ICaseClause
{
/// <summary>
/// Case value.
/// </summary>
IOperation Value { get; }
/// <summary>
/// Relational operator used to compare the switch value with the case value.
/// </summary>
BinaryOperationKind Equality { get; }
}
/// <summary>
/// Represents Case Is op x in VB.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IRelationalCaseClause : ICaseClause
{
/// <summary>
/// Case value.
/// </summary>
IOperation Value { get; }
/// <summary>
/// Relational operator used to compare the switch value with the case value.
/// </summary>
BinaryOperationKind Relation { get; }
}
/// <summary>
/// Represents Case x To y in VB.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IRangeCaseClause : ICaseClause
{
/// <summary>
/// Minimum value of the case range.
/// </summary>
IOperation MinimumValue { get; }
/// <summary>
/// Maximum value of the case range.
/// </summary>
IOperation MaximumValue { get; }
}
/// <summary>
/// Represents an if statement in C# or an If statement in VB.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
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.
/// </summary>
IOperation Condition { get; }
/// <summary>
/// Statement executed if the condition is true.
/// </summary>
IOperation IfTrueStatement { get; }
/// <summary>
/// Statement executed if the condition is false.
/// </summary>
IOperation IfFalseStatement { get; }
}
/// <summary>
/// Represents a C# while, for, foreach, or do statement, or a VB While, For, For Each, or Do statement.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface ILoopStatement : IOperation
{
/// <summary>
/// Kind of the loop.
/// </summary>
LoopKind LoopKind { get; }
/// <summary>
/// Body of the loop.
/// </summary>
IOperation Body { get; }
}
/// <summary>
/// Kinds of loops.
/// </summary>
public enum LoopKind
{
None = 0x0,
/// <summary>
/// Indicates a C# while or do loop, or a VB While or Do loop.
/// </summary>
WhileUntil = 0x1,
/// <summary>
/// Indicates a C# for loop or a VB For loop.
/// </summary>
For = 0x2,
/// <summary>
/// Indicates a C# foreach loop or a VB For Each loop.
/// </summary>
ForEach = 0x3
}
/// <summary>
/// Represents a C# while, for, or do statement, or a VB While, For, or Do statement.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IForWhileUntilLoopStatement : ILoopStatement
{
/// <summary>
/// Condition of the loop.
/// </summary>
IOperation Condition { get; }
}
/// <summary>
/// Represents a C# while or do statement, or a VB While or Do statement.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IWhileUntilLoopStatement : IForWhileUntilLoopStatement
{
/// <summary>
/// True if the loop test executes at the top of the loop; false if the loop test executes at the bottom of the loop.
/// </summary>
bool IsTopTest { get; }
/// <summary>
/// True if the loop is a while loop; false if the loop is an until loop.
/// </summary>
bool IsWhile { get; }
}
/// <summary>
/// Represents a C# for statement or a VB For statement.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
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<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<IOperation> AtLoopBottom { get; }
/// <summary>
/// Declarations local to the loop.
/// </summary>
ImmutableArray<ILocalSymbol> Locals { get; }
}
/// <summary>
/// Represents a C# foreach statement or a VB For Each staement.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IForEachLoopStatement : ILoopStatement
{
/// <summary>
/// Iteration variable of the loop.
/// </summary>
ILocalSymbol IterationVariable { get; }
/// <summary>
/// Collection value over which the loop iterates.
/// </summary>
IOperation Collection { get; }
}
/// <summary>
/// Represents a C# or VB label statement.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface ILabelStatement : IOperation
{
/// <summary>
/// Label that can be the target of branches.
/// </summary>
ILabelSymbol Label { get; }
/// <summary>
/// Statement that has been labeled.
/// </summary>
IOperation LabeledStatement { get; }
}
/// <summary>
/// Represents a C# goto, break, or continue statement, or a VB GoTo, Exit ***, or Continue *** statement
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IBranchStatement : IOperation
{
/// <summary>
/// Label that is the target of the branch.
/// </summary>
ILabelSymbol Target { get; }
/// <summary>
/// Kind of the branch.
/// </summary>
BranchKind BranchKind { get; }
}
public enum BranchKind
{
None = 0x0,
Continue = 0x1,
Break = 0x2,
GoTo = 0x3
}
/// <summary>
/// Represents a C# throw or a VB Throw statement.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IThrowStatement : IOperation
{
/// <summary>
/// Value to be thrown.
/// </summary>
IOperation ThrownObject { get; }
}
/// <summary>
/// Represents a C# return or a VB Return statement.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IReturnStatement : IOperation
{
/// <summary>
/// Value to be returned.
/// </summary>
IOperation ReturnedValue { get; }
}
/// <summary>
/// Represents a C# lock or a VB SyncLock statement.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface ILockStatement : IOperation
{
/// <summary>
/// Value to be locked.
/// </summary>
IOperation LockedObject { get; }
/// <summary>
/// Body of the lock, to be executed while holding the lock.
/// </summary>
IOperation Body { get; }
}
/// <summary>
/// Represents a C# try or a VB Try statement.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface ITryStatement : IOperation
{
/// <summary>
/// Body of the try, over which the handlers are active.
/// </summary>
IBlockStatement Body { get; }
/// <summary>
/// Catch clauses of the try.
/// </summary>
ImmutableArray<ICatchClause> Catches { get; }
/// <summary>
/// Finally handler of the try.
/// </summary>
IBlockStatement FinallyHandler { get; }
}
/// <summary>
/// Represents a C# catch or VB Catch clause.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface ICatchClause : IOperation
{
/// <summary>
/// Body of the exception handler.
/// </summary>
IBlockStatement Handler { get; }
/// <summary>
/// Type of exception to be handled.
/// </summary>
ITypeSymbol CaughtType { get; }
/// <summary>
/// Filter expression to be executed to determine whether to handle the exception.
/// </summary>
IOperation Filter { get; }
/// <summary>
/// Symbol for the local catch variable bound to the caught exception.
/// </summary>
ILocalSymbol ExceptionLocal { get; }
}
/// <summary>
/// Represents a C# using or VB Using statement.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IUsingStatement : IOperation
{
/// <summary>
/// Body of the using, over which the resources of the using are maintained.
/// </summary>
IOperation Body { get; }
/// <summary>
/// Declaration introduced by the using statement. Null if the using statement does not declare any variables.
/// </summary>
IVariableDeclarationStatement Declaration { get; }
/// <summary>
/// Resource held by the using. Can be null if Declaration is not null.
/// </summary>
IOperation Value { get; }
}
/// <summary>
/// Represents a C# fixed staement.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IFixedStatement : IOperation
{
/// <summary>
/// Variables to be fixed.
/// </summary>
IVariableDeclarationStatement Variables { get; }
/// <summary>
/// Body of the fixed, over which the variables are fixed.
/// </summary>
IOperation Body { get; }
}
/// <summary>
/// Represents a C# or VB statement that consists solely of an expression.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IExpressionStatement : IOperation
{
/// <summary>
/// Expression of the statement.
/// </summary>
IOperation Expression { get; }
}
/// <summary>
/// Represents a VB With statement.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IWithStatement : IOperation
{
/// <summary>
/// Body of the with.
/// </summary>
IOperation Body { get; }
/// <summary>
/// Value to whose members leading-dot-qualified references within the with body bind.
/// </summary>
IOperation Value { get; }
}
/// <summary>
/// Reprsents an empty statement.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IEmptyStatement : IOperation
{
}
/// <summary>
/// Represents a VB Stop statement.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IStopStatement : IOperation
{
}
/// <summary>
/// Represents a VB End statemnt.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IEndStatement : IOperation
{
}
/// <summary>
/// Represents a syntactically or semantically invalid C# or VB statement.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IInvalidStatement : IOperation
{
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Kinds of arguments.
/// </summary>
public enum ArgumentKind
{
None = 0x0,
/// <summary>
/// Argument is specified positionally and matches the parameter of the same ordinality.
/// </summary>
Positional = 0x1,
/// <summary>
/// Argument is specified by name and matches the parameter of the same name.
/// </summary>
Named = 0x2,
/// <summary>
/// Argument becomes an element of an array that matches a trailing C# params or VB ParamArray parameter.
/// </summary>
ParamArray = 0x3,
/// <summary>
/// Argument was omitted in source but has a default value supplied automatically.
/// </summary>
DefaultValue = 0x4
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
public enum BinaryOperandsKind
{
None = 0x0,
OperatorMethod = 0x100,
Integer = 0x200,
Unsigned = 0x300,
Floating = 0x400,
Decimal = 0x500,
Boolean = 0x600,
Enum = 0x700,
Dynamic = 0x800,
Object = 0x900,
Pointer = 0xa00,
PointerInteger = 0xb00,
IntegerPointer = 0xc00,
String = 0xd00,
Delegate = 0xe00,
Nullable = 0xf00,
Invalid = 0xff00
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Kinds of binary operations.
/// </summary>
public enum BinaryOperationKind
{
None = 0x0,
OperatorMethodAdd = BinaryOperandsKind.OperatorMethod | SimpleBinaryOperationKind.Add,
OperatorMethodSubtract = BinaryOperandsKind.OperatorMethod | SimpleBinaryOperationKind.Subtract,
OperatorMethodMultiply = BinaryOperandsKind.OperatorMethod | SimpleBinaryOperationKind.Multiply,
OperatorMethodDivide = BinaryOperandsKind.OperatorMethod | SimpleBinaryOperationKind.Divide,
OperatorMethodIntegerDivide = BinaryOperandsKind.OperatorMethod | SimpleBinaryOperationKind.IntegerDivide,
OperatorMethodRemainder = BinaryOperandsKind.OperatorMethod | SimpleBinaryOperationKind.Remainder,
OperatorMethodLeftShift = BinaryOperandsKind.OperatorMethod | SimpleBinaryOperationKind.LeftShift,
OperatorMethodRightShift = BinaryOperandsKind.OperatorMethod | SimpleBinaryOperationKind.RightShift,
OperatorMethodAnd = BinaryOperandsKind.OperatorMethod | SimpleBinaryOperationKind.And,
OperatorMethodOr = BinaryOperandsKind.OperatorMethod | SimpleBinaryOperationKind.Or,
OperatorMethodExclusiveOr = BinaryOperandsKind.OperatorMethod | SimpleBinaryOperationKind.ExclusiveOr,
OperatorMethodConditionalAnd = BinaryOperandsKind.OperatorMethod | SimpleBinaryOperationKind.ConditionalAnd,
OperatorMethodConditionalOr = BinaryOperandsKind.OperatorMethod | SimpleBinaryOperationKind.ConditionalOr,
IntegerAdd = BinaryOperandsKind.Integer | SimpleBinaryOperationKind.Add,
IntegerSubtract = BinaryOperandsKind.Integer | SimpleBinaryOperationKind.Subtract,
IntegerMultiply = BinaryOperandsKind.Integer | SimpleBinaryOperationKind.Multiply,
IntegerDivide = BinaryOperandsKind.Integer | SimpleBinaryOperationKind.Divide,
IntegerRemainder = BinaryOperandsKind.Integer | SimpleBinaryOperationKind.Remainder,
IntegerLeftShift = BinaryOperandsKind.Integer | SimpleBinaryOperationKind.LeftShift,
IntegerRightShift = BinaryOperandsKind.Integer | SimpleBinaryOperationKind.RightShift,
IntegerAnd = BinaryOperandsKind.Integer | SimpleBinaryOperationKind.And,
IntegerOr = BinaryOperandsKind.Integer | SimpleBinaryOperationKind.Or,
IntegerExclusiveOr = BinaryOperandsKind.Integer | SimpleBinaryOperationKind.ExclusiveOr,
UnsignedAdd = BinaryOperandsKind.Unsigned | SimpleBinaryOperationKind.Add,
UnsignedSubtract = BinaryOperandsKind.Unsigned | SimpleBinaryOperationKind.Subtract,
UnsignedMultiply = BinaryOperandsKind.Unsigned | SimpleBinaryOperationKind.Multiply,
UnsignedDivide = BinaryOperandsKind.Unsigned | SimpleBinaryOperationKind.Divide,
UnsignedRemainder = BinaryOperandsKind.Unsigned | SimpleBinaryOperationKind.Remainder,
UnsignedLeftShift = BinaryOperandsKind.Unsigned | SimpleBinaryOperationKind.LeftShift,
UnsignedRightShift = BinaryOperandsKind.Unsigned | SimpleBinaryOperationKind.RightShift,
UnsignedAnd = BinaryOperandsKind.Unsigned | SimpleBinaryOperationKind.And,
UnsignedOr = BinaryOperandsKind.Unsigned | SimpleBinaryOperationKind.Or,
UnsignedExclusiveOr = BinaryOperandsKind.Unsigned | SimpleBinaryOperationKind.ExclusiveOr,
FloatingAdd = BinaryOperandsKind.Floating | SimpleBinaryOperationKind.Add,
FloatingSubtract = BinaryOperandsKind.Floating | SimpleBinaryOperationKind.Subtract,
FloatingMultiply = BinaryOperandsKind.Floating | SimpleBinaryOperationKind.Multiply,
FloatingDivide = BinaryOperandsKind.Floating | SimpleBinaryOperationKind.Divide,
FloatingRemainder = BinaryOperandsKind.Floating | SimpleBinaryOperationKind.Remainder,
FloatingPower = BinaryOperandsKind.Floating | SimpleBinaryOperationKind.Power,
DecimalAdd = BinaryOperandsKind.Decimal | SimpleBinaryOperationKind.Add,
DecimalSubtract = BinaryOperandsKind.Decimal | SimpleBinaryOperationKind.Subtract,
DecimalMultiply = BinaryOperandsKind.Decimal | SimpleBinaryOperationKind.Multiply,
DecimalDivide = BinaryOperandsKind.Decimal | SimpleBinaryOperationKind.Divide,
BooleanAnd = BinaryOperandsKind.Boolean | SimpleBinaryOperationKind.And,
BooleanOr = BinaryOperandsKind.Boolean | SimpleBinaryOperationKind.Or,
BooleanExclusiveOr = BinaryOperandsKind.Boolean | SimpleBinaryOperationKind.ExclusiveOr,
BooleanConditionalAnd = BinaryOperandsKind.Boolean | SimpleBinaryOperationKind.ConditionalAnd,
BooleanConditionalOr = BinaryOperandsKind.Boolean | SimpleBinaryOperationKind.ConditionalOr,
EnumAdd = BinaryOperandsKind.Enum | SimpleBinaryOperationKind.Add,
EnumSubtract = BinaryOperandsKind.Enum | SimpleBinaryOperationKind.Subtract,
EnumAnd = BinaryOperandsKind.Enum | SimpleBinaryOperationKind.And,
EnumOr = BinaryOperandsKind.Enum | SimpleBinaryOperationKind.Or,
EnumExclusiveOr = BinaryOperandsKind.Enum | SimpleBinaryOperationKind.ExclusiveOr,
PointerIntegerAdd = BinaryOperandsKind.PointerInteger | SimpleBinaryOperationKind.Add,
IntegerPointerAdd = BinaryOperandsKind.IntegerPointer | SimpleBinaryOperationKind.Add,
PointerIntegerSubtract = BinaryOperandsKind.PointerInteger | SimpleBinaryOperationKind.Subtract,
PointerSubtract = BinaryOperandsKind.Pointer | SimpleBinaryOperationKind.Subtract,
DynamicAdd = BinaryOperandsKind.Dynamic | SimpleBinaryOperationKind.Add,
DynamicSubtract = BinaryOperandsKind.Dynamic | SimpleBinaryOperationKind.Subtract,
DynamicMultiply = BinaryOperandsKind.Dynamic | SimpleBinaryOperationKind.Multiply,
DynamicDivide = BinaryOperandsKind.Dynamic | SimpleBinaryOperationKind.Divide,
DynamicRemainder = BinaryOperandsKind.Dynamic | SimpleBinaryOperationKind.Remainder,
DynamicLeftShift = BinaryOperandsKind.Dynamic | SimpleBinaryOperationKind.LeftShift,
DynamicRightShift = BinaryOperandsKind.Dynamic | SimpleBinaryOperationKind.RightShift,
DynamicAnd = BinaryOperandsKind.Dynamic | SimpleBinaryOperationKind.And,
DynamicOr = BinaryOperandsKind.Dynamic | SimpleBinaryOperationKind.Or,
DynamicExclusiveOr = BinaryOperandsKind.Dynamic | SimpleBinaryOperationKind.ExclusiveOr,
ObjectAdd = BinaryOperandsKind.Object | SimpleBinaryOperationKind.Add,
ObjectSubtract = BinaryOperandsKind.Object | SimpleBinaryOperationKind.Subtract,
ObjectMultiply = BinaryOperandsKind.Object | SimpleBinaryOperationKind.Multiply,
ObjectDivide = BinaryOperandsKind.Object | SimpleBinaryOperationKind.Divide,
ObjectIntegerDivide = BinaryOperandsKind.Object | SimpleBinaryOperationKind.IntegerDivide,
ObjectRemainder = BinaryOperandsKind.Object | SimpleBinaryOperationKind.Remainder,
ObjectPower = BinaryOperandsKind.Object | SimpleBinaryOperationKind.Power,
ObjectLeftShift = BinaryOperandsKind.Object | SimpleBinaryOperationKind.LeftShift,
ObjectRightShift = BinaryOperandsKind.Object | SimpleBinaryOperationKind.RightShift,
ObjectAnd = BinaryOperandsKind.Object | SimpleBinaryOperationKind.And,
ObjectOr = BinaryOperandsKind.Object | SimpleBinaryOperationKind.Or,
ObjectExclusiveOr = BinaryOperandsKind.Object | SimpleBinaryOperationKind.ExclusiveOr,
ObjectConditionalAnd = BinaryOperandsKind.Object | SimpleBinaryOperationKind.ConditionalAnd,
ObjectConditionalOr = BinaryOperandsKind.Object | SimpleBinaryOperationKind.ConditionalOr,
ObjectConcatenate = BinaryOperandsKind.Object | SimpleBinaryOperationKind.Concatenate,
StringConcatenate = BinaryOperandsKind.String | SimpleBinaryOperationKind.Concatenate,
// Relational operations.
OperatorMethodEquals = BinaryOperandsKind.OperatorMethod | SimpleBinaryOperationKind.Equals,
OperatorMethodNotEquals = BinaryOperandsKind.OperatorMethod | SimpleBinaryOperationKind.NotEquals,
OperatorMethodLessThan = BinaryOperandsKind.OperatorMethod | SimpleBinaryOperationKind.LessThan,
OperatorMethodLessThanOrEqual = BinaryOperandsKind.OperatorMethod | SimpleBinaryOperationKind.LessThanOrEqual,
OperatorMethodGreaterThanOrEqual = BinaryOperandsKind.OperatorMethod | SimpleBinaryOperationKind.GreaterThanOrEqual,
OperatorMethodGreaterThan = BinaryOperandsKind.OperatorMethod | SimpleBinaryOperationKind.GreaterThan,
OperatorMethodPower = BinaryOperandsKind.OperatorMethod | SimpleBinaryOperationKind.Power,
IntegerEquals = BinaryOperandsKind.Integer | SimpleBinaryOperationKind.Equals,
IntegerNotEquals = BinaryOperandsKind.Integer | SimpleBinaryOperationKind.NotEquals,
IntegerLessThan = BinaryOperandsKind.Integer | SimpleBinaryOperationKind.LessThan,
IntegerLessThanOrEqual = BinaryOperandsKind.Integer | SimpleBinaryOperationKind.LessThanOrEqual,
IntegerGreaterThanOrEqual = BinaryOperandsKind.Integer | SimpleBinaryOperationKind.GreaterThanOrEqual,
IntegerGreaterThan = BinaryOperandsKind.Integer | SimpleBinaryOperationKind.GreaterThan,
UnsignedLessThan = BinaryOperandsKind.Unsigned | SimpleBinaryOperationKind.LessThan,
UnsignedLessThanOrEqual = BinaryOperandsKind.Unsigned | SimpleBinaryOperationKind.LessThanOrEqual,
UnsignedGreaterThanOrEqual = BinaryOperandsKind.Unsigned | SimpleBinaryOperationKind.GreaterThanOrEqual,
UnsignedGreaterThan = BinaryOperandsKind.Unsigned | SimpleBinaryOperationKind.GreaterThan,
FloatingEquals = BinaryOperandsKind.Floating | SimpleBinaryOperationKind.Equals,
FloatingNotEquals = BinaryOperandsKind.Floating | SimpleBinaryOperationKind.NotEquals,
FloatingLessThan = BinaryOperandsKind.Floating | SimpleBinaryOperationKind.LessThan,
FloatingLessThanOrEqual = BinaryOperandsKind.Floating | SimpleBinaryOperationKind.LessThanOrEqual,
FloatingGreaterThanOrEqual = BinaryOperandsKind.Floating | SimpleBinaryOperationKind.GreaterThanOrEqual,
FloatingGreaterThan = BinaryOperandsKind.Floating | SimpleBinaryOperationKind.GreaterThan,
DecimalEquals = BinaryOperandsKind.Decimal | SimpleBinaryOperationKind.Equals,
DecimalNotEquals = BinaryOperandsKind.Decimal | SimpleBinaryOperationKind.NotEquals,
DecimalLessThan = BinaryOperandsKind.Decimal | SimpleBinaryOperationKind.LessThan,
DecimalLessThanOrEqual = BinaryOperandsKind.Decimal | SimpleBinaryOperationKind.LessThanOrEqual,
DecimalGreaterThanOrEqual = BinaryOperandsKind.Decimal | SimpleBinaryOperationKind.GreaterThanOrEqual,
DecimalGreaterThan = BinaryOperandsKind.Decimal | SimpleBinaryOperationKind.GreaterThan,
BooleanEquals = BinaryOperandsKind.Boolean | SimpleBinaryOperationKind.Equals,
BooleanNotEquals = BinaryOperandsKind.Boolean | SimpleBinaryOperationKind.NotEquals,
StringEquals = BinaryOperandsKind.String | SimpleBinaryOperationKind.Equals,
StringNotEquals = BinaryOperandsKind.String | SimpleBinaryOperationKind.NotEquals,
StringLike = BinaryOperandsKind.String | SimpleBinaryOperationKind.Like,
DelegateEquals = BinaryOperandsKind.Delegate | SimpleBinaryOperationKind.Equals,
DelegateNotEquals = BinaryOperandsKind.Delegate | SimpleBinaryOperationKind.NotEquals,
NullableEquals = BinaryOperandsKind.Nullable | SimpleBinaryOperationKind.Equals,
NullableNotEquals = BinaryOperandsKind.Nullable | SimpleBinaryOperationKind.NotEquals,
ObjectEquals = BinaryOperandsKind.Object | SimpleBinaryOperationKind.Equals,
ObjectNotEquals = BinaryOperandsKind.Object | SimpleBinaryOperationKind.NotEquals,
ObjectVBEquals = BinaryOperandsKind.Object | SimpleBinaryOperationKind.ObjectValueEquals,
ObjectVBNotEquals = BinaryOperandsKind.Object | SimpleBinaryOperationKind.ObjectValueNotEquals,
ObjectLike = BinaryOperandsKind.Object | SimpleBinaryOperationKind.Like,
ObjectLessThan = BinaryOperandsKind.Object | SimpleBinaryOperationKind.LessThan,
ObjectLessThanOrEqual = BinaryOperandsKind.Object | SimpleBinaryOperationKind.LessThanOrEqual,
ObjectGreaterThanOrEqual = BinaryOperandsKind.Object | SimpleBinaryOperationKind.GreaterThanOrEqual,
ObjectGreaterThan = BinaryOperandsKind.Object | SimpleBinaryOperationKind.GreaterThan,
EnumEquals = BinaryOperandsKind.Enum | SimpleBinaryOperationKind.Equals,
EnumNotEquals = BinaryOperandsKind.Enum | SimpleBinaryOperationKind.NotEquals,
EnumLessThan = BinaryOperandsKind.Enum | SimpleBinaryOperationKind.LessThan,
EnumLessThanOrEqual = BinaryOperandsKind.Enum | SimpleBinaryOperationKind.LessThanOrEqual,
EnumGreaterThanOrEqual = BinaryOperandsKind.Enum | SimpleBinaryOperationKind.GreaterThanOrEqual,
EnumGreaterThan = BinaryOperandsKind.Enum | SimpleBinaryOperationKind.GreaterThan,
PointerEquals = BinaryOperandsKind.Pointer | SimpleBinaryOperationKind.Equals,
PointerNotEquals = BinaryOperandsKind.Pointer | SimpleBinaryOperationKind.NotEquals,
PointerLessThan = BinaryOperandsKind.Pointer | SimpleBinaryOperationKind.LessThan,
PointerLessThanOrEqual = BinaryOperandsKind.Pointer | SimpleBinaryOperationKind.LessThanOrEqual,
PointerGreaterThanOrEqual = BinaryOperandsKind.Pointer | SimpleBinaryOperationKind.GreaterThanOrEqual,
PointerGreaterThan = BinaryOperandsKind.Pointer | SimpleBinaryOperationKind.GreaterThan,
DynamicEquals = BinaryOperandsKind.Dynamic | SimpleBinaryOperationKind.Equals,
DynamicNotEquals = BinaryOperandsKind.Dynamic | SimpleBinaryOperationKind.NotEquals,
DynamicLessThan = BinaryOperandsKind.Dynamic | SimpleBinaryOperationKind.LessThan,
DynamicLessThanOrEqual = BinaryOperandsKind.Dynamic | SimpleBinaryOperationKind.LessThanOrEqual,
DynamicGreaterThanOrEqual = BinaryOperandsKind.Dynamic | SimpleBinaryOperationKind.GreaterThanOrEqual,
DynamicGreaterThan = BinaryOperandsKind.Dynamic | SimpleBinaryOperationKind.GreaterThan,
Invalid = BinaryOperandsKind.Invalid | SimpleBinaryOperationKind.Invalid
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
public enum BranchKind
{
None = 0x0,
Continue = 0x1,
Break = 0x2,
GoTo = 0x3
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Kinds of cases.
/// </summary>
public enum CaseKind
{
None = 0x0,
/// <summary>
/// Indicates case x in C# or Case x in VB.
/// </summary>
SingleValue = 0x1,
/// <summary>
/// Indicates Case Is op x in VB.
/// </summary>
Relational = 0x2,
/// <summary>
/// Indicates Case x To Y in VB.
/// </summary>
Range = 0x3,
/// <summary>
/// Indicates default in C# or Case Else in VB.
/// </summary>
Default = 0x4
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Kinds of conversions.
/// </summary>
public enum ConversionKind
{
None = 0x0,
/// <summary>
/// Conversion is defined by the underlying type system and throws an exception if it fails.
/// </summary>
Cast = 0x1,
/// <summary>
/// Conversion is defined by the underlying type system and produces a null result if it fails.
/// </summary>
TryCast = 0x2,
/// <summary>
/// Conversion has VB-specific semantics.
/// </summary>
Basic = 0x3,
/// <summary>
/// Conversion has C#-specific semantics.
/// </summary>
CSharp = 0x4,
/// <summary>
/// Conversion is implemented by a conversion operator method.
/// </summary>
OperatorMethod = 0x5,
/// <summary>
/// Conversion is invalid.
/// </summary>
Invalid = 0xf
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
using System.Diagnostics;
using System.Linq;
namespace Microsoft.CodeAnalysis.Semantics
{
internal sealed class ConditionalChoice : IConditionalChoiceExpression
{
public ConditionalChoice(IOperation condition, IOperation ifTrue, IOperation ifFalse, ITypeSymbol resultType, SyntaxNode syntax)
{
this.Condition = condition;
this.IfTrueValue = ifTrue;
this.IfFalseValue = ifFalse;
this.Type = resultType;
this.Syntax = syntax;
}
public IOperation Condition { get; }
public IOperation IfTrueValue { get; }
public IOperation IfFalseValue { get; }
public ITypeSymbol Type { get; }
public SyntaxNode Syntax { get; }
public OperationKind Kind => OperationKind.ConditionalChoiceExpression;
public bool IsInvalid => Condition == null || Condition.IsInvalid || IfTrueValue == null || IfTrueValue.IsInvalid || IfFalseValue == null || IfFalseValue.IsInvalid || Type == null;
public Optional<object> ConstantValue => default(Optional<object>);
public void Accept(OperationVisitor visitor)
{
visitor.VisitConditionalChoiceExpression(this);
}
public TResult Accept<TArgument, TResult>(OperationVisitor<TArgument, TResult> visitor, TArgument argument)
{
return visitor.VisitConditionalChoiceExpression(this, argument);
}
}
internal sealed class Assignment : IExpressionStatement
{
private readonly AssignmentExpression _assignment;
public Assignment(IOperation target, IOperation value, SyntaxNode syntax)
{
_assignment = new AssignmentExpression(target, value, syntax);
this.Syntax = syntax;
}
public SyntaxNode Syntax { get; }
public OperationKind Kind => OperationKind.ExpressionStatement;
public bool IsInvalid => _assignment.IsInvalid;
public IOperation Expression => _assignment;
public ITypeSymbol Type => null;
public Optional<object> ConstantValue => default(Optional<object>);
public void Accept(OperationVisitor visitor)
{
visitor.VisitExpressionStatement(this);
}
public TResult Accept<TArgument, TResult>(OperationVisitor<TArgument, TResult> visitor, TArgument argument)
{
return visitor.VisitExpressionStatement(this, argument);
}
private sealed class AssignmentExpression : IAssignmentExpression
{
public AssignmentExpression(IOperation target, IOperation value, SyntaxNode syntax)
{
this.Value = value;
this.Target = target;
this.Syntax = syntax;
}
public IOperation Target { get; }
public IOperation Value { get; }
public SyntaxNode Syntax { get; }
public ITypeSymbol Type => this.Target.Type;
public OperationKind Kind => OperationKind.AssignmentExpression;
public bool IsInvalid => Target == null || Target.IsInvalid || Value == null || Value.IsInvalid;
public Optional<object> ConstantValue => default(Optional<object>);
public void Accept(OperationVisitor visitor)
{
visitor.VisitAssignmentExpression(this);
}
public TResult Accept<TArgument, TResult>(OperationVisitor<TArgument, TResult> visitor, TArgument argument)
{
return visitor.VisitAssignmentExpression(this, argument);
}
}
}
internal sealed class CompoundAssignment : IExpressionStatement
{
private readonly CompoundAssignmentExpression _compoundAssignment;
public CompoundAssignment(IOperation target, IOperation value, BinaryOperationKind binaryOperationKind, IMethodSymbol operatorMethod, SyntaxNode syntax)
{
_compoundAssignment = new CompoundAssignmentExpression(target, value, binaryOperationKind, operatorMethod, syntax);
this.Syntax = syntax;
}
public SyntaxNode Syntax { get; }
public OperationKind Kind => OperationKind.ExpressionStatement;
public bool IsInvalid => _compoundAssignment.IsInvalid;
public IOperation Expression => _compoundAssignment;
public ITypeSymbol Type => null;
public Optional<object> ConstantValue => default(Optional<object>);
public void Accept(OperationVisitor visitor)
{
visitor.VisitExpressionStatement(this);
}
public TResult Accept<TArgument, TResult>(OperationVisitor<TArgument, TResult> visitor, TArgument argument)
{
return visitor.VisitExpressionStatement(this, argument);
}
private sealed class CompoundAssignmentExpression : ICompoundAssignmentExpression
{
public CompoundAssignmentExpression(IOperation target, IOperation value, BinaryOperationKind binaryOperationKind, IMethodSymbol operatorMethod, SyntaxNode syntax)
{
this.Target = target;
this.Value = value;
this.BinaryOperationKind = binaryOperationKind;
this.OperatorMethod = operatorMethod;
this.Syntax = syntax;
}
public IOperation Target { get; }
public IOperation Value { get; }
public BinaryOperationKind BinaryOperationKind { get; }
public IMethodSymbol OperatorMethod { get; }
public SyntaxNode Syntax { get; }
public ITypeSymbol Type => this.Target.Type;
public OperationKind Kind => OperationKind.CompoundAssignmentExpression;
public bool IsInvalid => Target == null || Target.IsInvalid || Value == null || Value.IsInvalid;
public Optional<object> ConstantValue => default(Optional<object>);
public bool UsesOperatorMethod => this.OperatorMethod != null;
public void Accept(OperationVisitor visitor)
{
visitor.VisitCompoundAssignmentExpression(this);
}
public TResult Accept<TArgument, TResult>(OperationVisitor<TArgument, TResult> visitor, TArgument argument)
{
return visitor.VisitCompoundAssignmentExpression(this, argument);
}
}
}
internal sealed class IntegerLiteral : ILiteralExpression
{
private readonly long _value;
public IntegerLiteral(long value, ITypeSymbol resultType, SyntaxNode syntax)
{
_value = value;
this.Type = resultType;
this.Syntax = syntax;
}
public string Text => _value.ToString();
public ITypeSymbol Type { get; }
public OperationKind Kind => OperationKind.LiteralExpression;
public bool IsInvalid => false;
public Optional<object> ConstantValue => new Optional<object>(_value);
public SyntaxNode Syntax { get; }
public void Accept(OperationVisitor visitor)
{
visitor.VisitLiteralExpression(this);
}
public TResult Accept<TArgument, TResult>(OperationVisitor<TArgument, TResult> visitor, TArgument argument)
{
return visitor.VisitLiteralExpression(this, argument);
}
}
internal class Literal : ILiteralExpression
{
private readonly ConstantValue _value;
public Literal(ConstantValue value, ITypeSymbol resultType, SyntaxNode syntax)
{
Debug.Assert(value != null, "value can't be null");
_value = value;
this.Type = resultType;
this.Syntax = syntax;
}
public string Text => _value.GetValueToDisplay();
public ITypeSymbol Type { get; }
public OperationKind Kind => OperationKind.LiteralExpression;
public bool IsInvalid => _value.IsBad;
public Optional<object> ConstantValue => new Optional<object>(_value.Value);
public SyntaxNode Syntax { get; }
public void Accept(OperationVisitor visitor)
{
visitor.VisitLiteralExpression(this);
}
public TResult Accept<TArgument, TResult>(OperationVisitor<TArgument, TResult> visitor, TArgument argument)
{
return visitor.VisitLiteralExpression(this, argument);
}
}
internal sealed class Binary : IBinaryOperatorExpression
{
public Binary(BinaryOperationKind binaryOperationKind, IOperation left, IOperation right, ITypeSymbol resultType, SyntaxNode syntax)
{
this.BinaryOperationKind = binaryOperationKind;
this.LeftOperand = left;
this.RightOperand = right;
this.Type = resultType;
this.Syntax = syntax;
}
public BinaryOperationKind BinaryOperationKind { get; }
public IOperation LeftOperand { get; }
public IOperation RightOperand { get; }
public bool UsesOperatorMethod => false;
public IMethodSymbol OperatorMethod => null;
public ITypeSymbol Type { get; }
public OperationKind Kind => OperationKind.BinaryOperatorExpression;
public bool IsInvalid => LeftOperand == null
|| LeftOperand.IsInvalid
|| RightOperand == null
|| RightOperand.IsInvalid
|| BinaryOperationKind == BinaryOperationKind.Invalid
|| Type == null;
public Optional<object> ConstantValue => default(Optional<object>);
public SyntaxNode Syntax { get; }
public void Accept(OperationVisitor visitor)
{
visitor.VisitBinaryOperatorExpression(this);
}
public TResult Accept<TArgument, TResult>(OperationVisitor<TArgument, TResult> visitor, TArgument argument)
{
return visitor.VisitBinaryOperatorExpression(this, argument);
}
}
internal sealed class ArrayCreation : IArrayCreationExpression
{
private readonly IArrayTypeSymbol _arrayType;
public ArrayCreation(IArrayTypeSymbol arrayType, ImmutableArray<IOperation> elementValues, SyntaxNode syntax)
{
_arrayType = arrayType;
this.DimensionSizes = ImmutableArray.Create<IOperation>(new IntegerLiteral(elementValues.Count(), null, syntax));
this.Initializer = new ArrayInitializer(elementValues, syntax, arrayType);
this.Syntax = syntax;
}
public ITypeSymbol Type => _arrayType;
public ImmutableArray<IOperation> DimensionSizes { get; }
public ITypeSymbol ElementType => _arrayType.ElementType;
public IArrayInitializer Initializer { get; }
public SyntaxNode Syntax { get; }
public OperationKind Kind => OperationKind.ArrayCreationExpression;
public bool IsInvalid => IsInvalidInitializer(Initializer);
private static bool IsInvalidInitializer(IArrayInitializer initializer) => initializer.IsInvalid;
public void Accept(OperationVisitor visitor)
{
visitor.VisitArrayCreationExpression(this);
}
public TResult Accept<TArgument, TResult>(OperationVisitor<TArgument, TResult> visitor, TArgument argument)
{
return visitor.VisitArrayCreationExpression(this, argument);
}
public Optional<object> ConstantValue => default(Optional<object>);
private sealed class ArrayInitializer : IArrayInitializer
{
public ArrayInitializer(ImmutableArray<IOperation> elementValues, SyntaxNode syntax, ITypeSymbol arrayType)
{
ElementValues = elementValues;
Syntax = syntax;
Type = arrayType;
}
public ImmutableArray<IOperation> ElementValues { get; }
public bool IsInvalid => ElementValues.Any(v => v.IsInvalid);
public OperationKind Kind => OperationKind.ArrayInitializer;
public ITypeSymbol Type { get; }
public SyntaxNode Syntax { get; }
public Optional<object> ConstantValue => default(Optional<object>);
public void Accept(OperationVisitor visitor)
{
visitor.VisitArrayInitializer(this);
}
public TResult Accept<TArgument, TResult>(OperationVisitor<TArgument, TResult> visitor, TArgument argument)
{
return visitor.VisitArrayInitializer(this, argument);
}
}
}
internal sealed class InvalidExpression : IInvalidExpression
{
public InvalidExpression(SyntaxNode syntax)
{
this.Syntax = syntax;
}
public Optional<object> ConstantValue => default(Optional<object>);
public bool IsInvalid => true;
public OperationKind Kind => OperationKind.InvalidExpression;
public SyntaxNode Syntax { get; }
public ITypeSymbol Type => null;
public void Accept(OperationVisitor visitor)
{
visitor.VisitInvalidExpression(this);
}
public TResult Accept<TArgument, TResult>(OperationVisitor<TArgument, TResult> visitor, TArgument argument)
{
return visitor.VisitInvalidExpression(this, argument);
}
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents an expression that creates a pointer value by taking the address of a reference.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IAddressOfExpression : IOperation
{
/// <summary>
/// Addressed reference.
/// </summary>
IOperation Reference { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents an argument in a method invocation.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IArgument : IOperation
{
/// <summary>
/// Kind of argument.
/// </summary>
ArgumentKind ArgumentKind { get; }
/// <summary>
/// Parameter the argument matches.
/// </summary>
IParameterSymbol Parameter { get; }
/// <summary>
/// Value supplied for the argument.
/// </summary>
IOperation Value { get; }
/// <summary>
/// Conversion applied to the argument value passing it into the target method. Applicable only to VB Reference arguments.
/// </summary>
IOperation InConversion { get; }
/// <summary>
/// Conversion applied to the argument value after the invocation. Applicable only to VB Reference arguments.
/// </summary>
IOperation OutConversion { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents the creation of an array instance.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IArrayCreationExpression : IOperation
{
/// <summary>
/// Element type of the created array instance.
/// </summary>
ITypeSymbol ElementType { get; }
/// <summary>
/// Sizes of the dimensions of the created array instance.
/// </summary>
ImmutableArray<IOperation> DimensionSizes { get; }
/// <summary>
/// Values of elements of the created array instance.
/// </summary>
IArrayInitializer Initializer { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents a reference to an array element.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IArrayElementReferenceExpression : IOperation
{
/// <summary>
/// Array to be indexed.
/// </summary>
IOperation ArrayReference { get; }
/// <summary>
/// Indices that specify an individual element.
/// </summary>
ImmutableArray<IOperation> Indices { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents the initialization of an array instance.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IArrayInitializer : IOperation
{
/// <summary>
/// Values to initialize array elements.
/// </summary>
ImmutableArray<IOperation> ElementValues { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents an assignment expression.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IAssignmentExpression : IOperation
{
/// <summary>
/// Target of the assignment.
/// </summary>
IOperation Target { get; }
/// <summary>
/// Value to be assigned to the target of the assignment.
/// </summary>
IOperation Value { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents an await expression.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IAwaitExpression : IOperation
{
/// <summary>
/// Value to be awaited.
/// </summary>
IOperation AwaitedValue { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents an operation with two operands that produces a result with the same type as at least one of the operands.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IBinaryOperatorExpression : IHasOperatorMethodExpression
{
/// <summary>
/// Kind of binary operation.
/// </summary>
BinaryOperationKind BinaryOperationKind { get; }
/// <summary>
/// Left operand.
/// </summary>
IOperation LeftOperand { get; }
/// <summary>
/// Right operand.
/// </summary>
IOperation RightOperand { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents a block scope.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IBlockStatement : IOperation
{
/// <summary>
/// Statements contained within the block.
/// </summary>
ImmutableArray<IOperation> Statements { get; }
/// <summary>
/// Local declarations contained within the block.
/// </summary>
ImmutableArray<ILocalSymbol> Locals { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents a C# goto, break, or continue statement, or a VB GoTo, Exit ***, or Continue *** statement
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IBranchStatement : IOperation
{
/// <summary>
/// Label that is the target of the branch.
/// </summary>
ILabelSymbol Target { get; }
/// <summary>
/// Kind of the branch.
/// </summary>
BranchKind BranchKind { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents a clause of a C# case or a VB Case.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface ICaseClause : IOperation
{
/// <summary>
/// Kind of the clause.
/// </summary>
CaseKind CaseKind { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents a C# catch or VB Catch clause.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface ICatchClause : IOperation
{
/// <summary>
/// Body of the exception handler.
/// </summary>
IBlockStatement Handler { get; }
/// <summary>
/// Type of exception to be handled.
/// </summary>
ITypeSymbol CaughtType { get; }
/// <summary>
/// Filter expression to be executed to determine whether to handle the exception.
/// </summary>
IOperation Filter { get; }
/// <summary>
/// Symbol for the local catch variable bound to the caught exception.
/// </summary>
ILocalSymbol ExceptionLocal { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents an assignment expression that includes a binary operation.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface ICompoundAssignmentExpression : IAssignmentExpression, IHasOperatorMethodExpression
{
/// <summary>
/// Kind of binary operation.
/// </summary>
BinaryOperationKind BinaryOperationKind { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents an expression that includes a ? or ?. conditional access instance expression.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IConditionalAccessExpression : IOperation
{
/// <summary>
/// Expression to be evaluated if the conditional instance is non null.
/// </summary>
IOperation ConditionalValue { get; }
/// <summary>
/// Expresson that is conditionally accessed.
/// </summary>
IOperation ConditionalInstance { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents the value of a conditionally-accessed expression within an expression containing a conditional access.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IConditionalAccessInstanceExpression : IOperation
{
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents a C# ?: or VB If expression.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IConditionalChoiceExpression : IOperation
{
/// <summary>
/// Condition to be tested.
/// </summary>
IOperation Condition { get; }
/// <summary>
/// Value evaluated if the Condition is true.
/// </summary>
IOperation IfTrueValue { get; }
/// <summary>
/// Value evaluated if the Condition is false.
/// </summary>
IOperation IfFalseValue { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents a conversion operation.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IConversionExpression : IHasOperatorMethodExpression
{
/// <summary>
/// Value to be converted.
/// </summary>
IOperation Operand { get; }
/// <summary>
/// Kind of conversion.
/// </summary>
ConversionKind ConversionKind { get; }
/// <summary>
/// True if and only if the conversion is indicated explicity by a cast operation in the source code.
/// </summary>
bool IsExplicit { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IDefaultValueExpression : IOperation
{
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Reprsents an empty statement.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IEmptyStatement : IOperation
{
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents a VB End statemnt.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IEndStatement : IOperation
{
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents a binding of an event.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IEventAssignmentExpression : IOperation
{
/// <summary>
/// Event being bound.
/// </summary>
IEventSymbol Event { get; }
/// <summary>
/// Instance used to refer to the event being bound.
/// </summary>
IOperation EventInstance { get; }
/// <summary>
/// Handler supplied for the event.
/// </summary>
IOperation HandlerValue { get; }
/// <summary>
/// True for adding a binding, false for removing one.
/// </summary>
bool Adds { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents a reference to an event.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IEventReferenceExpression : IMemberReferenceExpression
{
/// <summary>
/// Referenced event.
/// </summary>
IEventSymbol Event { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents a C# or VB statement that consists solely of an expression.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IExpressionStatement : IOperation
{
/// <summary>
/// Expression of the statement.
/// </summary>
IOperation Expression { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents an initialization of a field.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IFieldInitializer : ISymbolInitializer
{
/// <summary>
/// Initialized fields. There can be multiple fields for Visual Basic fields declared with As New.
/// </summary>
ImmutableArray<IFieldSymbol> InitializedFields { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents a reference to a field.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IFieldReferenceExpression : IMemberReferenceExpression
{
/// <summary>
/// Referenced field.
/// </summary>
IFieldSymbol Field { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents a C# fixed staement.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IFixedStatement : IOperation
{
/// <summary>
/// Variables to be fixed.
/// </summary>
IVariableDeclarationStatement Variables { get; }
/// <summary>
/// Body of the fixed, over which the variables are fixed.
/// </summary>
IOperation Body { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents a C# foreach statement or a VB For Each staement.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IForEachLoopStatement : ILoopStatement
{
/// <summary>
/// Iteration variable of the loop.
/// </summary>
ILocalSymbol IterationVariable { get; }
/// <summary>
/// Collection value over which the loop iterates.
/// </summary>
IOperation Collection { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents a C# for statement or a VB For statement.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
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<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<IOperation> AtLoopBottom { get; }
/// <summary>
/// Declarations local to the loop.
/// </summary>
ImmutableArray<ILocalSymbol> Locals { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents a C# while, for, or do statement, or a VB While, For, or Do statement.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IForWhileUntilLoopStatement : ILoopStatement
{
/// <summary>
/// Condition of the loop.
/// </summary>
IOperation Condition { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IHasArgumentsExpression : IOperation
{
/// <summary>
/// Arguments of the invocation, excluding the instance argument. Arguments are in parameter order,
/// and params/ParamArray arguments have been collected into arrays. Default values are supplied for
/// optional arguments missing in source.
/// </summary>
ImmutableArray<IArgument> ArgumentsInParameterOrder { get; }
/// <summary>
/// Find the argument supplied for a given parameter of the target method.
/// </summary>
/// <param name="parameter">Parameter of the target method.</param>
/// <returns>Argument corresponding to the parameter.</returns>
IArgument GetArgumentMatchingParameter(IParameterSymbol parameter);
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents a unary, binary, relational, or conversion operation that can use an operator method.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IHasOperatorMethodExpression : IOperation
{
/// <summary>
/// True if and only if the operation is performed by an operator method.
/// </summary>
bool UsesOperatorMethod { get; }
/// <summary>
/// Operation method used by the operation, null if the operation does not use an operator method.
/// </summary>
IMethodSymbol OperatorMethod { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents an if statement in C# or an If statement in VB.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
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.
/// </summary>
IOperation Condition { get; }
/// <summary>
/// Statement executed if the condition is true.
/// </summary>
IOperation IfTrueStatement { get; }
/// <summary>
/// Statement executed if the condition is false.
/// </summary>
IOperation IfFalseStatement { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents an increment expression.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IIncrementExpression : ICompoundAssignmentExpression
{
/// <summary>
/// Kind of increment.
/// </summary>
UnaryOperationKind IncrementOperationKind { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents a reference to an indexed property.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IIndexedPropertyReferenceExpression : IPropertyReferenceExpression, IHasArgumentsExpression
{
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents a C# this or base expression, or a VB Me, MyClass, or MyBase expression.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IInstanceReferenceExpression : IOperation
{
///
/// <summary>
/// Kind of instance reference.
/// </summary>
InstanceReferenceKind InstanceReferenceKind { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IInvalidExpression : IOperation
{
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents a syntactically or semantically invalid C# or VB statement.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IInvalidStatement : IOperation
{
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents a C# or VB method invocation.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IInvocationExpression : IHasArgumentsExpression
{
/// <summary>
/// Method to be invoked.
/// </summary>
IMethodSymbol TargetMethod { get; }
/// <summary>
/// 'This' or 'Me' instance to be supplied to the method, or null if the method is static.
/// </summary>
IOperation Instance { get; }
/// <summary>
/// True if the invocation uses a virtual mechanism, and false otherwise.
/// </summary>
bool IsVirtual { get; }
/// <summary>
/// Arguments of the invocation, excluding the instance argument. Arguments are in the order specified in source,
/// and params/ParamArray arguments have been collected into arrays. Arguments are not present
/// unless supplied in source.
/// </summary>
ImmutableArray<IArgument> ArgumentsInSourceOrder { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents an expression that tests if a value is of a specific type.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IIsTypeExpression : IOperation
{
/// <summary>
/// Value to test.
/// </summary>
IOperation Operand { get; }
/// <summary>
/// Type for which to test.
/// </summary>
ITypeSymbol IsType { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents a C# or VB label statement.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface ILabelStatement : IOperation
{
/// <summary>
/// Label that can be the target of branches.
/// </summary>
ILabelSymbol Label { get; }
/// <summary>
/// Statement that has been labeled.
/// </summary>
IOperation LabeledStatement { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents a lambda expression.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface ILambdaExpression : IOperation
{
/// <summary>
/// Signature of the lambda.
/// </summary>
IMethodSymbol Signature { get; }
/// <summary>
/// Body of the lambda.
/// </summary>
IBlockStatement Body { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents a late-bound reference to a member of a class or struct.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface ILateBoundMemberReferenceExpression : IOperation
{
/// <summary>
/// Instance used to bind the member reference.
/// </summary>
IOperation Instance { get; }
/// <summary>
/// Name of the member.
/// </summary>
string MemberName { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents a textual literal numeric, string, etc. expression.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface ILiteralExpression : IOperation
{
/// <summary>
/// Textual representation of the literal.
/// </summary>
string Text { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents a reference to a declared local variable.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface ILocalReferenceExpression : IOperation
{
/// <summary>
/// Referenced local variable.
/// </summary>
ILocalSymbol Local { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents a C# lock or a VB SyncLock statement.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface ILockStatement : IOperation
{
/// <summary>
/// Value to be locked.
/// </summary>
IOperation LockedObject { get; }
/// <summary>
/// Body of the lock, to be executed while holding the lock.
/// </summary>
IOperation Body { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents a C# while, for, foreach, or do statement, or a VB While, For, For Each, or Do statement.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface ILoopStatement : IOperation
{
/// <summary>
/// Kind of the loop.
/// </summary>
LoopKind LoopKind { get; }
/// <summary>
/// Body of the loop.
/// </summary>
IOperation Body { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents a reference to a member of a class, struct, or interface.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IMemberReferenceExpression : IOperation
{
/// <summary>
/// Instance of the type. Null if the reference is to a static/shared member.
/// </summary>
IOperation Instance { get; }
/// <summary>
/// Referenced member.
/// </summary>
ISymbol Member { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents a reference to a method other than as the target of an invocation.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IMethodBindingExpression : IMemberReferenceExpression
{
/// <summary>
/// Referenced method.
/// </summary>
IMethodSymbol Method { get; }
/// <summary>
/// Indicates whether the reference uses virtual semantics.
/// </summary>
bool IsVirtual { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents a null-coalescing expression.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface INullCoalescingExpression : IOperation
{
/// <summary>
/// Value to be unconditionally evaluated.
/// </summary>
IOperation PrimaryOperand { get; }
/// <summary>
/// Value to be evaluated if Primary evaluates to null/Nothing.
/// </summary>
IOperation SecondaryOperand { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents a new/New expression.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IObjectCreationExpression : IHasArgumentsExpression
{
/// <summary>
/// Constructor to be invoked on the created instance.
/// </summary>
IMethodSymbol Constructor { get; }
/// <summary>
/// Explicitly-specified member initializers.
/// </summary>
ImmutableArray<ISymbolInitializer> MemberInitializers { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents an argument value that has been omitted in an invocation.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IOmittedArgumentExpression : IOperation
{
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Runtime.CompilerServices;
using Microsoft.CodeAnalysis.Semantics;
namespace Microsoft.CodeAnalysis
{
/// <summary>
/// Root type for representing the abstract semantics of C# and VB statements and expressions.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
[InternalImplementationOnly]
public interface IOperation
{
/// <summary>
/// Identifies the kind of the operation.
/// </summary>
OperationKind Kind { get; }
/// <summary>
/// Indicates whether the operation is invalid, either semantically or syntactically.
/// </summary>
bool IsInvalid { get; }
/// <summary>
/// Syntax that was analyzed to produce the operation.
/// </summary>
SyntaxNode Syntax { get; }
/// <summary>
/// Result type of the operation, or null if the operation does not produce a result.
/// </summary>
ITypeSymbol Type { get; }
/// <summary>
/// If the operation is an expression that evaluates to a constant value, <see cref="Optional{Object}.HasValue"/> is true and <see cref="Optional{Object}.Value"/> is the value of the expression. Otherwise, <see cref="Optional{Object}.HasValue"/> is false.
/// </summary>
Optional<object> ConstantValue { get; }
void Accept(OperationVisitor visitor);
TResult Accept<TArgument, TResult>(OperationVisitor<TArgument, TResult> visitor, TArgument argument);
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Runtime.CompilerServices;
using Microsoft.CodeAnalysis.Semantics;
namespace Microsoft.CodeAnalysis
{
/// <summary>
/// Root type for representing the abstract semantics of C# and VB statements and expressions.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
[InternalImplementationOnly]
public interface IOperation
{
/// <summary>
/// Identifies the kind of the operation.
/// </summary>
OperationKind Kind { get; }
/// <summary>
/// Indicates whether the operation is invalid, either semantically or syntactically.
/// </summary>
bool IsInvalid { get; }
/// <summary>
/// Syntax that was analyzed to produce the operation.
/// </summary>
SyntaxNode Syntax { get; }
/// <summary>
/// Result type of the operation, or null if the operation does not produce a result.
/// </summary>
ITypeSymbol Type { get; }
/// <summary>
/// If the operation is an expression that evaluates to a constant value, <see cref="Optional{Object}.HasValue"/> is true and <see cref="Optional{Object}.Value"/> is the value of the expression. Otherwise, <see cref="Optional{Object}.HasValue"/> is false.
/// </summary>
Optional<object> ConstantValue { get; }
void Accept(OperationVisitor visitor);
TResult Accept<TArgument, TResult>(OperationVisitor<TArgument, TResult> visitor, TArgument argument);
}
/// <summary>
/// All of the kinds of operations, including statements and expressions.
/// </summary>
......@@ -190,7 +149,7 @@ public enum OperationKind
/// <summary>Indicates an <see cref="IOmittedArgumentExpression"/>.</summary>
OmittedArgumentExpression = 0x300,
/// <summary>Indicates an <see cref="ILateBoundMemberReferenceExpression"/>.</summary>
LateBoundMemberReferenceExpression = 0x301,
LateBoundMemberReferenceExpression = 0x301,
/// <summary>Indicates an <see cref="IPlaceholderExpression"/>.</summary>
PlaceholderExpression = 0x302,
......@@ -208,7 +167,7 @@ public enum OperationKind
ParameterInitializerAtDeclaration = 0x404,
/// <summary>Indicates an <see cref="IArrayInitializer"/>.</summary>
ArrayInitializer = 0x405,
/// <summary>Indicates an <see cref="IVariableDeclaration"/>.</summary>
VariableDeclaration = 0x406,
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents an initialization of a parameter at the point of declaration.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IParameterInitializer : ISymbolInitializer
{
/// <summary>
/// Initialized parameter.
/// </summary>
IParameterSymbol Parameter { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents a reference to a parameter.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IParameterReferenceExpression : IOperation
{
/// <summary>
/// Referenced parameter.
/// </summary>
IParameterSymbol Parameter { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents a parenthesized expression.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IParenthesizedExpression : IOperation
{
/// <summary>
/// Operand enclosed in parentheses.
/// </summary>
IOperation Operand { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents a general placeholder when no more specific kind of placeholder is available.
/// A placeholder is an expression whose meaning is inferred from context.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IPlaceholderExpression : IOperation
{
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents a reference through a pointer.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IPointerIndirectionReferenceExpression : IOperation
{
/// <summary>
/// Pointer to be dereferenced.
/// </summary>
IOperation Pointer { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents an initialization of a property.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IPropertyInitializer : ISymbolInitializer
{
/// <summary>
/// Set method used to initialize the property.
/// </summary>
IPropertySymbol InitializedProperty { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents a reference to a property.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IPropertyReferenceExpression : IMemberReferenceExpression
{
/// <summary>
/// Referenced property.
/// </summary>
IPropertySymbol Property { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents Case x To y in VB.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IRangeCaseClause : ICaseClause
{
/// <summary>
/// Minimum value of the case range.
/// </summary>
IOperation MinimumValue { get; }
/// <summary>
/// Maximum value of the case range.
/// </summary>
IOperation MaximumValue { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents Case Is op x in VB.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IRelationalCaseClause : ICaseClause
{
/// <summary>
/// Case value.
/// </summary>
IOperation Value { get; }
/// <summary>
/// Relational operator used to compare the switch value with the case value.
/// </summary>
BinaryOperationKind Relation { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents a C# return or a VB Return statement.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IReturnStatement : IOperation
{
/// <summary>
/// Value to be returned.
/// </summary>
IOperation ReturnedValue { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents case x in C# or Case x in VB.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface ISingleValueCaseClause : ICaseClause
{
/// <summary>
/// Case value.
/// </summary>
IOperation Value { get; }
/// <summary>
/// Relational operator used to compare the switch value with the case value.
/// </summary>
BinaryOperationKind Equality { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents a SizeOf expression.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface ISizeOfExpression : ITypeOperationExpression
{
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents a VB Stop statement.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface IStopStatement : IOperation
{
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents a C# case or VB Case statement.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface ISwitchCase : IOperation
{
/// <summary>
/// Clauses of the case. For C# there is one clause per case, but for VB there can be multiple.
/// </summary>
ImmutableArray<ICaseClause> Clauses { get; }
/// <summary>
/// Statements of the case.
/// </summary>
ImmutableArray<IOperation> Body { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents a C# switch or VB Select Case statement.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface ISwitchStatement : IOperation
{
/// <summary>
/// Value to be switched upon.
/// </summary>
IOperation Value { get; }
/// <summary>
/// Cases of the switch.
/// </summary>
ImmutableArray<ISwitchCase> Cases { get; }
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Immutable;
namespace Microsoft.CodeAnalysis.Semantics
{
/// <summary>
/// Represents an initializer for a field, property, or parameter.
/// </summary>
/// <remarks>
/// This interface is reserved for implementation by its associated APIs. We reserve the right to
/// change it in the future.
/// </remarks>
public interface ISymbolInitializer : IOperation
{
IOperation Value { get; }
}
}
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册