Moved VB to consolidate the BoundNode stored in the operation.

上级 2d5d9cff
......@@ -6,6 +6,7 @@ Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Namespace Microsoft.CodeAnalysis.VisualBasic
Partial Friend Class BoundCall
Implements IBoundInvocable
Public Sub New(
syntax As SyntaxNode,
......@@ -67,6 +68,18 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End Get
End Property
Private ReadOnly Property IBoundInvocable_Call As BoundCall Implements IBoundInvocable.CallOpt
Get
Return Me
End Get
End Property
Private ReadOnly Property IBoundInvocable_InstanceOpt As BoundExpression Implements IBoundInvocable.InstanceOpt
Get
Return If(ReceiverOpt, MethodGroupOpt?.ReceiverOpt)
End Get
End Property
#If DEBUG Then
Private Sub Validate()
' if method group is specified it should not have receiver if it was moved to a bound call
......
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Collections.Immutable
Namespace Microsoft.CodeAnalysis.VisualBasic
Partial Friend Class BoundDimStatement
Implements IBoundLocalDeclarations
Private ReadOnly Property IBoundLocalDeclarations_Declarations As ImmutableArray(Of BoundLocalDeclarationBase) Implements IBoundLocalDeclarations.Declarations
Get
Return Me.LocalDeclarations
End Get
End Property
End Class
End Namespace
......@@ -5,6 +5,7 @@ Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic
Friend Partial Class BoundDoLoopStatement
Implements IBoundConditionalLoop
''' <summary>
''' Gets a value indicating whether this do loop is a DoTopLoop or not. In syntax error cases
......@@ -56,5 +57,26 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End Get
End Property
Private ReadOnly Property IBoundConditionalLoop_Condition As BoundExpression Implements IBoundConditionalLoop.Condition
Get
Return ConditionOpt
End Get
End Property
Private ReadOnly Property IBoundConditionalLoop_IgnoredCondition As BoundExpression Implements IBoundConditionalLoop.IgnoredCondition
Get
If TopConditionOpt IsNot Nothing AndAlso BottomConditionOpt IsNot Nothing Then
Return BottomConditionOpt
Else
Return Nothing
End If
End Get
End Property
Private ReadOnly Property IBoundConditionalLoop_Body As BoundNode Implements IBoundConditionalLoop.Body
Get
Return Body
End Get
End Property
End Class
End Namespace
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Namespace Microsoft.CodeAnalysis.VisualBasic
Partial Friend Class BoundIfStatement
Implements IBoundConditional
Private ReadOnly Property IBoundConditional_WhenTrue As BoundNode Implements IBoundConditional.WhenTrue
Get
Return Me.Consequence
End Get
End Property
Private ReadOnly Property IBoundConditional_WhenFalseOpt As BoundNode Implements IBoundConditional.WhenFalseOpt
Get
Return Me.AlternativeOpt
End Get
End Property
Private ReadOnly Property IBoundConditional_Condition As BoundExpression Implements IBoundConditional.Condition
Get
Return Me.Condition
End Get
End Property
End Class
End Namespace
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Collections.Immutable
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic
Friend Partial Class BoundLocalDeclaration
Implements IBoundLocalDeclarations
Public Sub New(syntax As SyntaxNode, localSymbol As LocalSymbol, initializerOpt As BoundExpression)
MyClass.New(syntax, localSymbol, initializerOpt, Nothing, False, False)
......@@ -17,6 +19,12 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End Get
End Property
Private ReadOnly Property IBoundLocalDeclarations_Declarations As ImmutableArray(Of BoundLocalDeclarationBase) Implements IBoundLocalDeclarations.Declarations
Get
Return ImmutableArray.Create(Of BoundLocalDeclarationBase)(Me)
End Get
End Property
#If DEBUG Then
Private Sub Validate()
If InitializerOpt IsNot Nothing Then
......
......@@ -7,6 +7,19 @@ Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic
Friend Partial Class BoundNullableIsTrueOperator
Implements IBoundInvocable
Private ReadOnly Property IBoundInvocable_CallOpt As BoundCall Implements IBoundInvocable.CallOpt
Get
Return Nothing
End Get
End Property
Private ReadOnly Property IBoundInvocable_InstanceOpt As BoundExpression Implements IBoundInvocable.InstanceOpt
Get
Return Me.Operand
End Get
End Property
#If DEBUG Then
Private Sub Validate()
......
......@@ -7,6 +7,25 @@ Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic
Friend Partial Class BoundTernaryConditionalExpression
Implements IBoundConditional
Private ReadOnly Property IBoundConditional_Condition As BoundExpression Implements IBoundConditional.Condition
Get
Return Me.Condition
End Get
End Property
Private ReadOnly Property IBoundConditional_WhenTrue As BoundNode Implements IBoundConditional.WhenTrue
Get
Return Me.WhenTrue
End Get
End Property
Private ReadOnly Property IBoundConditional_WhenFalseOpt As BoundNode Implements IBoundConditional.WhenFalseOpt
Get
Return Me.WhenFalse
End Get
End Property
#If DEBUG Then
Private Sub Validate()
......
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Namespace Microsoft.CodeAnalysis.VisualBasic
Partial Friend Class BoundWhileStatement
Implements IBoundConditionalLoop
Private ReadOnly Property IBoundConditionalLoop_Condition As BoundExpression Implements IBoundConditionalLoop.Condition
Get
Return Condition
End Get
End Property
Private ReadOnly Property IBoundConditionalLoop_IgnoredCondition As BoundExpression Implements IBoundConditionalLoop.IgnoredCondition
Get
Return Nothing
End Get
End Property
Private ReadOnly Property IBoundConditionalLoop_Body As BoundNode Implements IBoundConditionalLoop.Body
Get
Return Body
End Get
End Property
End Class
End Namespace
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Namespace Microsoft.CodeAnalysis.VisualBasic
Friend Interface IBoundConditional
ReadOnly Property Condition As BoundExpression
ReadOnly Property WhenTrue As BoundNode
ReadOnly Property WhenFalseOpt As BoundNode
End Interface
End Namespace
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Namespace Microsoft.CodeAnalysis.VisualBasic
Friend Interface IBoundConditionalLoop
ReadOnly Property Condition As BoundExpression
ReadOnly Property IgnoredCondition As BoundExpression
ReadOnly Property Body As BoundNode
End Interface
End Namespace
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Namespace Microsoft.CodeAnalysis.VisualBasic
Friend Interface IBoundInvocable
ReadOnly Property CallOpt As BoundCall
ReadOnly Property InstanceOpt As BoundExpression
End Interface
End Namespace
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Collections.Immutable
Namespace Microsoft.CodeAnalysis.VisualBasic
Friend Interface IBoundLocalDeclarations
ReadOnly Property Declarations As ImmutableArray(Of BoundLocalDeclarationBase)
End Interface
End Namespace
......@@ -61,6 +61,14 @@ Namespace Microsoft.CodeAnalysis.VisualBasic
End Property
End Class
Partial Friend Class BoundRaiseEventStatement
Protected Overrides ReadOnly Property Children As ImmutableArray(Of BoundNode)
Get
Return ImmutableArray.Create(Of BoundNode)(Me.EventInvocation)
End Get
End Property
End Class
Partial Friend Class BoundResumeStatement
Protected Overrides ReadOnly Property Children As ImmutableArray(Of BoundNode)
Get
......
......@@ -379,13 +379,11 @@ Namespace Microsoft.CodeAnalysis.Operations
Return CreateCompoundAssignment(boundAssignmentOperator)
Else
Dim isImplicit As Boolean = boundAssignmentOperator.WasCompilerGenerated
Dim target As BoundNode = boundAssignmentOperator.Left
Dim value As BoundNode = boundAssignmentOperator.Right
Dim isRef As Boolean = False
Dim syntax As SyntaxNode = boundAssignmentOperator.Syntax
Dim type As ITypeSymbol = boundAssignmentOperator.Type
Dim constantValue As [Optional](Of Object) = ConvertToOptional(boundAssignmentOperator.ConstantValueOpt)
Return New VisualBasicLazySimpleAssignmentOperation(Me, target, value, isRef, _semanticModel, syntax, type, constantValue, isImplicit)
Return New VisualBasicLazySimpleAssignmentOperation(Me, boundAssignmentOperator, isRef, _semanticModel, syntax, type, constantValue, isImplicit)
End If
End Function
......@@ -455,7 +453,6 @@ Namespace Microsoft.CodeAnalysis.Operations
Private Function CreateBoundCallOperation(boundCall As BoundCall) As IInvocationOperation
Dim targetMethod As IMethodSymbol = boundCall.Method
Dim instance As BoundNode = If(boundCall.ReceiverOpt, boundCall.MethodGroupOpt?.ReceiverOpt)
Dim isVirtual As Boolean =
targetMethod IsNot Nothing AndAlso
(targetMethod.IsVirtual OrElse targetMethod.IsAbstract OrElse targetMethod.IsOverride) AndAlso
......@@ -466,7 +463,7 @@ Namespace Microsoft.CodeAnalysis.Operations
Dim type As ITypeSymbol = boundCall.Type
Dim constantValue As [Optional](Of Object) = ConvertToOptional(boundCall.ConstantValueOpt)
Dim isImplicit As Boolean = boundCall.WasCompilerGenerated
Return New VisualBasicLazyInvocationOperation(Me, instance, boundCall, targetMethod, isVirtual, _semanticModel, syntax, type, constantValue, isImplicit)
Return New VisualBasicLazyInvocationOperation(Me, boundCall, targetMethod, isVirtual, _semanticModel, syntax, type, constantValue, isImplicit)
End Function
Private Function CreateBoundOmittedArgumentOperation(boundOmittedArgument As BoundOmittedArgument) As IOmittedArgumentOperation
......@@ -487,13 +484,11 @@ Namespace Microsoft.CodeAnalysis.Operations
End Function
Private Function CreateBoundArrayAccessOperation(boundArrayAccess As BoundArrayAccess) As IArrayElementReferenceOperation
Dim arrayReference As BoundNode = boundArrayAccess.Expression
Dim indices As ImmutableArray(Of BoundExpression) = boundArrayAccess.Indices
Dim syntax As SyntaxNode = boundArrayAccess.Syntax
Dim type As ITypeSymbol = boundArrayAccess.Type
Dim constantValue As [Optional](Of Object) = ConvertToOptional(boundArrayAccess.ConstantValueOpt)
Dim isImplicit As Boolean = boundArrayAccess.WasCompilerGenerated
Return New VisualBasicLazyArrayElementReferenceOperation(Me, arrayReference, indices, _semanticModel, syntax, type, constantValue, isImplicit)
Return New VisualBasicLazyArrayElementReferenceOperation(Me, boundArrayAccess, _semanticModel, syntax, type, constantValue, isImplicit)
End Function
Friend Function CreateBoundUnaryOperatorChild(boundOperator As BoundExpression) As IOperation
......@@ -588,8 +583,6 @@ Namespace Microsoft.CodeAnalysis.Operations
End Function
Private Function CreateBoundBinaryConditionalExpressionOperation(boundBinaryConditionalExpression As BoundBinaryConditionalExpression) As ICoalesceOperation
Dim expression As BoundNode = boundBinaryConditionalExpression.TestExpression
Dim whenNull As BoundNode = boundBinaryConditionalExpression.ElseExpression
Dim syntax As SyntaxNode = boundBinaryConditionalExpression.Syntax
Dim type As ITypeSymbol = boundBinaryConditionalExpression.Type
Dim constantValue As [Optional](Of Object) = ConvertToOptional(boundBinaryConditionalExpression.ConstantValueOpt)
......@@ -609,7 +602,7 @@ Namespace Microsoft.CodeAnalysis.Operations
End If
End If
Return New VisualBasicLazyCoalesceOperation(Me, expression, whenNull, valueConversion, _semanticModel, syntax, type, constantValue, isImplicit)
Return New VisualBasicLazyCoalesceOperation(Me, boundBinaryConditionalExpression, valueConversion, _semanticModel, syntax, type, constantValue, isImplicit)
End Function
Private Function CreateBoundUserDefinedShortCircuitingOperatorOperation(boundUserDefinedShortCircuitingOperator As BoundUserDefinedShortCircuitingOperator) As IBinaryOperation
......@@ -638,7 +631,6 @@ Namespace Microsoft.CodeAnalysis.Operations
End Function
Private Function CreateBoundBadExpressionOperation(boundBadExpression As BoundBadExpression) As IInvalidOperation
Dim children As ImmutableArray(Of BoundNode) = boundBadExpression.ChildBoundNodes.CastArray(Of BoundNode)
Dim syntax As SyntaxNode = boundBadExpression.Syntax
' We match semantic model here: If the Then expression IsMissing, we have a null type, rather than the ErrorType Of the bound node.
Dim type As ITypeSymbol = If(syntax.IsMissing, Nothing, boundBadExpression.Type)
......@@ -646,7 +638,7 @@ Namespace Microsoft.CodeAnalysis.Operations
' if child has syntax node point to same syntax node as bad expression, then this invalid expression Is implicit
Dim isImplicit = boundBadExpression.WasCompilerGenerated OrElse boundBadExpression.ChildBoundNodes.Any(Function(e) e?.Syntax Is boundBadExpression.Syntax)
Return New VisualBasicLazyInvalidOperation(Me, children, _semanticModel, syntax, type, constantValue, isImplicit)
Return New VisualBasicLazyInvalidOperation(Me, boundBadExpression, _semanticModel, syntax, type, constantValue, isImplicit)
End Function
Private Function CreateBoundTryCastOperation(boundTryCast As BoundTryCast) As IOperation
......@@ -733,15 +725,12 @@ Namespace Microsoft.CodeAnalysis.Operations
End Function
Private Function CreateBoundTernaryConditionalExpressionOperation(boundTernaryConditionalExpression As BoundTernaryConditionalExpression) As IConditionalOperation
Dim condition As BoundNode = boundTernaryConditionalExpression.Condition
Dim whenTrue = boundTernaryConditionalExpression.WhenTrue
Dim whenFalse = boundTernaryConditionalExpression.WhenFalse
Dim syntax As SyntaxNode = boundTernaryConditionalExpression.Syntax
Dim type As ITypeSymbol = boundTernaryConditionalExpression.Type
Dim constantValue As [Optional](Of Object) = ConvertToOptional(boundTernaryConditionalExpression.ConstantValueOpt)
Dim isImplicit As Boolean = boundTernaryConditionalExpression.WasCompilerGenerated
Dim isRef As Boolean = False
Return New VisualBasicLazyConditionalOperation(Me, condition, whenTrue, whenFalse, isRef, _semanticModel, syntax, type, constantValue, isImplicit)
Return New VisualBasicLazyConditionalOperation(Me, boundTernaryConditionalExpression, isRef, _semanticModel, syntax, type, constantValue, isImplicit)
End Function
Private Function CreateBoundTypeOfOperation(boundTypeOf As BoundTypeOf) As IIsTypeOperation
......@@ -765,15 +754,13 @@ Namespace Microsoft.CodeAnalysis.Operations
End Function
Private Function CreateBoundLateInvocationOperation(boundLateInvocation As BoundLateInvocation) As IOperation
Dim expression As BoundNode = boundLateInvocation.Member
Dim arguments As ImmutableArray(Of BoundExpression) = If(boundLateInvocation.ArgumentsOpt.IsDefault, ImmutableArray(Of BoundExpression).Empty, boundLateInvocation.ArgumentsOpt)
Dim argumentNames As ImmutableArray(Of String) = boundLateInvocation.ArgumentNamesOpt
Dim argumentRefKinds As ImmutableArray(Of RefKind) = Nothing
Dim syntax As SyntaxNode = boundLateInvocation.Syntax
Dim type As ITypeSymbol = boundLateInvocation.Type
Dim constantValue As [Optional](Of Object) = ConvertToOptional(boundLateInvocation.ConstantValueOpt)
Dim isImplicit As Boolean = boundLateInvocation.WasCompilerGenerated
Return New VisualBasicLazyDynamicInvocationOperation(Me, expression, arguments, argumentNames, argumentRefKinds, _semanticModel, syntax, type, constantValue, isImplicit)
Return New VisualBasicLazyDynamicInvocationOperation(Me, boundLateInvocation, argumentNames, argumentRefKinds, _semanticModel, syntax, type, constantValue, isImplicit)
End Function
Private Function CreateBoundObjectCreationExpressionOperation(boundObjectCreationExpression As BoundObjectCreationExpression) As IObjectCreationOperation
......@@ -788,21 +775,19 @@ Namespace Microsoft.CodeAnalysis.Operations
End Function
Private Function CreateBoundObjectInitializerExpressionOperation(boundObjectInitializerExpression As BoundObjectInitializerExpression) As IObjectOrCollectionInitializerOperation
Dim initializers As ImmutableArray(Of BoundExpression) = boundObjectInitializerExpression.Initializers
Dim syntax As SyntaxNode = boundObjectInitializerExpression.Syntax
Dim type As ITypeSymbol = boundObjectInitializerExpression.Type
Dim constantValue As [Optional](Of Object) = ConvertToOptional(boundObjectInitializerExpression.ConstantValueOpt)
Dim isImplicit As Boolean = boundObjectInitializerExpression.WasCompilerGenerated
Return New VisualBasicLazyObjectOrCollectionInitializerOperation(Me, initializers, _semanticModel, syntax, type, constantValue, isImplicit)
Return New VisualBasicLazyObjectOrCollectionInitializerOperation(Me, boundObjectInitializerExpression, _semanticModel, syntax, type, constantValue, isImplicit)
End Function
Private Function CreateBoundCollectionInitializerExpressionOperation(boundCollectionInitializerExpression As BoundCollectionInitializerExpression) As IObjectOrCollectionInitializerOperation
Dim initializers As ImmutableArray(Of BoundExpression) = boundCollectionInitializerExpression.Initializers
Dim syntax As SyntaxNode = boundCollectionInitializerExpression.Syntax
Dim type As ITypeSymbol = boundCollectionInitializerExpression.Type
Dim constantValue As [Optional](Of Object) = ConvertToOptional(boundCollectionInitializerExpression.ConstantValueOpt)
Dim isImplicit As Boolean = boundCollectionInitializerExpression.WasCompilerGenerated
Return New VisualBasicLazyObjectOrCollectionInitializerOperation(Me, initializers, _semanticModel, syntax, type, constantValue, isImplicit)
Return New VisualBasicLazyObjectOrCollectionInitializerOperation(Me, boundCollectionInitializerExpression, _semanticModel, syntax, type, constantValue, isImplicit)
End Function
Private Function CreateBoundNewTOperation(boundNewT As BoundNewT) As ITypeParameterObjectCreationOperation
......@@ -824,32 +809,28 @@ Namespace Microsoft.CodeAnalysis.Operations
End Function
Private Function CreateBoundArrayCreationOperation(boundArrayCreation As BoundArrayCreation) As IArrayCreationOperation
Dim dimensionSizes As ImmutableArray(Of BoundExpression) = boundArrayCreation.Bounds
Dim initializer As BoundNode = boundArrayCreation.InitializerOpt
Dim syntax As SyntaxNode = boundArrayCreation.Syntax
Dim type As ITypeSymbol = boundArrayCreation.Type
Dim constantValue As [Optional](Of Object) = ConvertToOptional(boundArrayCreation.ConstantValueOpt)
Dim isImplicit As Boolean = boundArrayCreation.WasCompilerGenerated
Return New VisualBasicLazyArrayCreationOperation(Me, dimensionSizes, initializer, _semanticModel, syntax, type, constantValue, isImplicit)
Return New VisualBasicLazyArrayCreationOperation(Me, boundArrayCreation, _semanticModel, syntax, type, constantValue, isImplicit)
End Function
Private Function CreateBoundArrayInitializationOperation(boundArrayInitialization As BoundArrayInitialization) As IArrayInitializerOperation
Dim elementValues = boundArrayInitialization.Initializers
Dim syntax As SyntaxNode = boundArrayInitialization.Syntax
Dim constantValue As [Optional](Of Object) = ConvertToOptional(boundArrayInitialization.ConstantValueOpt)
Dim isImplicit As Boolean = boundArrayInitialization.WasCompilerGenerated
Return New VisualBasicLazyArrayInitializerOperation(Me, elementValues, _semanticModel, syntax, constantValue, isImplicit)
Return New VisualBasicLazyArrayInitializerOperation(Me, boundArrayInitialization, _semanticModel, syntax, constantValue, isImplicit)
End Function
Private Function CreateBoundPropertyAccessOperation(boundPropertyAccess As BoundPropertyAccess) As IPropertyReferenceOperation
Dim [property] As IPropertySymbol = boundPropertyAccess.PropertySymbol
Dim instance As BoundNode = If(boundPropertyAccess.ReceiverOpt, boundPropertyAccess.PropertyGroupOpt?.ReceiverOpt)
Dim syntax As SyntaxNode = boundPropertyAccess.Syntax
Dim type As ITypeSymbol = boundPropertyAccess.Type
Dim constantValue As [Optional](Of Object) = ConvertToOptional(boundPropertyAccess.ConstantValueOpt)
Dim isImplicit As Boolean = boundPropertyAccess.WasCompilerGenerated
Return New VisualBasicLazyPropertyReferenceOperation(Me, instance, boundPropertyAccess, [property], _semanticModel, syntax, type, constantValue, isImplicit)
Return New VisualBasicLazyPropertyReferenceOperation(Me, boundPropertyAccess, [property], _semanticModel, syntax, type, constantValue, isImplicit)
End Function
Private Function CreateBoundWithLValueExpressionPlaceholder(boundWithLValueExpressionPlaceholder As BoundWithLValueExpressionPlaceholder) As IInstanceReferenceOperation
......@@ -895,13 +876,11 @@ Namespace Microsoft.CodeAnalysis.Operations
Private Function CreateBoundConditionalAccessOperation(boundConditionalAccess As BoundConditionalAccess) As IConditionalAccessOperation
RecordParent(boundConditionalAccess.Placeholder, boundConditionalAccess)
Dim whenNotNull As BoundNode = boundConditionalAccess.AccessExpression
Dim expression As BoundNode = boundConditionalAccess.Receiver
Dim syntax As SyntaxNode = boundConditionalAccess.Syntax
Dim type As ITypeSymbol = boundConditionalAccess.Type
Dim constantValue As [Optional](Of Object) = ConvertToOptional(boundConditionalAccess.ConstantValueOpt)
Dim isImplicit As Boolean = boundConditionalAccess.WasCompilerGenerated
Return New VisualBasicLazyConditionalAccessOperation(Me, expression, whenNotNull, _semanticModel, syntax, type, constantValue, isImplicit)
Return New VisualBasicLazyConditionalAccessOperation(Me, boundConditionalAccess, _semanticModel, syntax, type, constantValue, isImplicit)
End Function
Private Function CreateBoundConditionalAccessReceiverPlaceholderOperation(boundConditionalAccessReceiverPlaceholder As BoundConditionalAccessReceiverPlaceholder) As IConditionalAccessInstanceOperation
......@@ -1038,27 +1017,22 @@ Namespace Microsoft.CodeAnalysis.Operations
End Function
Private Function CreateBoundIfStatementOperation(boundIfStatement As BoundIfStatement) As IConditionalOperation
Dim condition As BoundNode = boundIfStatement.Condition
Dim ifTrueStatement As BoundNode = boundIfStatement.Consequence
Dim ifFalseStatement As BoundNode = boundIfStatement.AlternativeOpt
Dim syntax As SyntaxNode = boundIfStatement.Syntax
Dim type As ITypeSymbol = Nothing
Dim constantValue As [Optional](Of Object) = New [Optional](Of Object)()
Dim isImplicit As Boolean = boundIfStatement.WasCompilerGenerated
Dim isRef As Boolean = False
Return New VisualBasicLazyConditionalOperation(Me, condition, ifTrueStatement, ifFalseStatement, isRef, _semanticModel, syntax, type, constantValue, isImplicit)
Return New VisualBasicLazyConditionalOperation(Me, boundIfStatement, isRef, _semanticModel, syntax, type, constantValue, isImplicit)
End Function
Private Function CreateBoundSelectStatementOperation(boundSelectStatement As BoundSelectStatement) As ISwitchOperation
RecordParent(boundSelectStatement.ExprPlaceholderOpt, boundSelectStatement)
Dim value As BoundNode = boundSelectStatement.ExpressionStatement.Expression
Dim cases As ImmutableArray(Of BoundCaseBlock) = boundSelectStatement.CaseBlocks
Dim exitLabel As ILabelSymbol = boundSelectStatement.ExitLabel
Dim syntax As SyntaxNode = boundSelectStatement.Syntax
Dim type As ITypeSymbol = Nothing
Dim constantValue As [Optional](Of Object) = New [Optional](Of Object)()
Dim isImplicit As Boolean = boundSelectStatement.WasCompilerGenerated
Return New VisualBasicLazySwitchOperation(Me, value, cases, ImmutableArray(Of ILocalSymbol).Empty, exitLabel, _semanticModel, syntax, type, constantValue, isImplicit)
Return New VisualBasicLazySwitchOperation(Me, boundSelectStatement, ImmutableArray(Of ILocalSymbol).Empty, exitLabel, _semanticModel, syntax, type, constantValue, isImplicit)
End Function
Friend Function CreateBoundCaseBlockClauses(boundCaseBlock As BoundCaseBlock) As ImmutableArray(Of ICaseClauseOperation)
......@@ -1114,13 +1088,11 @@ Namespace Microsoft.CodeAnalysis.Operations
End Function
Private Function CreateBoundRangeCaseClauseOperation(boundRangeCaseClause As BoundRangeCaseClause) As IRangeCaseClauseOperation
Dim minimumValue As BoundNode = GetCaseClauseValue(boundRangeCaseClause.LowerBoundOpt, boundRangeCaseClause.LowerBoundConditionOpt)
Dim maximumValue As BoundNode = GetCaseClauseValue(boundRangeCaseClause.UpperBoundOpt, boundRangeCaseClause.UpperBoundConditionOpt)
Dim syntax As SyntaxNode = boundRangeCaseClause.Syntax
Dim type As ITypeSymbol = Nothing
Dim constantValue As [Optional](Of Object) = New [Optional](Of Object)()
Dim isImplicit As Boolean = boundRangeCaseClause.WasCompilerGenerated
Return New VisualBasicLazyRangeCaseClauseOperation(Me, minimumValue, maximumValue, _semanticModel, syntax, type, constantValue, isImplicit)
Return New VisualBasicLazyRangeCaseClauseOperation(Me, boundRangeCaseClause, _semanticModel, syntax, type, constantValue, isImplicit)
End Function
Private Function CreateBoundRelationalCaseClauseOperation(boundRelationalCaseClause As BoundRelationalCaseClause) As IRelationalCaseClauseOperation
......@@ -1134,13 +1106,6 @@ Namespace Microsoft.CodeAnalysis.Operations
End Function
Private Function CreateBoundDoLoopStatementOperation(boundDoLoopStatement As BoundDoLoopStatement) As IWhileLoopOperation
Dim condition As BoundNode = boundDoLoopStatement.ConditionOpt
Dim body As BoundNode = boundDoLoopStatement.Body
Dim ignoredConditionOpt As BoundNode = Nothing
If boundDoLoopStatement.TopConditionOpt IsNot Nothing AndAlso boundDoLoopStatement.BottomConditionOpt IsNot Nothing Then
Debug.Assert(boundDoLoopStatement.ConditionOpt Is boundDoLoopStatement.TopConditionOpt)
ignoredConditionOpt = boundDoLoopStatement.BottomConditionOpt
End If
Dim locals As ImmutableArray(Of ILocalSymbol) = ImmutableArray(Of ILocalSymbol).Empty
Dim continueLabel As ILabelSymbol = boundDoLoopStatement.ContinueLabel
Dim exitLabel As ILabelSymbol = boundDoLoopStatement.ExitLabel
......@@ -1150,7 +1115,7 @@ Namespace Microsoft.CodeAnalysis.Operations
Dim type As ITypeSymbol = Nothing
Dim constantValue As [Optional](Of Object) = New [Optional](Of Object)()
Dim isImplicit As Boolean = boundDoLoopStatement.WasCompilerGenerated
Return New VisualBasicLazyWhileLoopOperation(Me, condition, body, ignoredConditionOpt, locals, continueLabel, exitLabel, conditionIsTop, conditionIsUntil, _semanticModel, syntax, type, constantValue, isImplicit)
Return New VisualBasicLazyWhileLoopOperation(Me, boundDoLoopStatement, locals, continueLabel, exitLabel, conditionIsTop, conditionIsUntil, _semanticModel, syntax, type, constantValue, isImplicit)
End Function
Private Function CreateBoundForToStatementOperation(boundForToStatement As BoundForToStatement) As IForToLoopOperation
......@@ -1249,15 +1214,12 @@ Namespace Microsoft.CodeAnalysis.Operations
End Function
Private Function CreateBoundTryStatementOperation(boundTryStatement As BoundTryStatement) As ITryOperation
Dim body As BoundNode = boundTryStatement.TryBlock
Dim catches As ImmutableArray(Of BoundCatchBlock) = boundTryStatement.CatchBlocks
Dim finallyHandler As BoundNode = boundTryStatement.FinallyBlockOpt
Dim exitLabel As ILabelSymbol = boundTryStatement.ExitLabelOpt
Dim syntax As SyntaxNode = boundTryStatement.Syntax
Dim type As ITypeSymbol = Nothing
Dim constantValue As [Optional](Of Object) = New [Optional](Of Object)()
Dim isImplicit As Boolean = boundTryStatement.WasCompilerGenerated
Return New VisualBasicLazyTryOperation(Me, body, catches, finallyHandler, exitLabel, _semanticModel, syntax, type, constantValue, isImplicit)
Return New VisualBasicLazyTryOperation(Me, boundTryStatement, exitLabel, _semanticModel, syntax, type, constantValue, isImplicit)
End Function
Friend Function CreateBoundCatchBlockExceptionDeclarationOrExpression(boundCatchBlock As BoundCatchBlock) As IOperation
......@@ -1283,24 +1245,30 @@ Namespace Microsoft.CodeAnalysis.Operations
End Function
Private Function CreateBoundBlockOperation(boundBlock As BoundBlock) As IBlockOperation
Dim statements As ImmutableArray(Of BoundStatement) = boundBlock.Statements
Dim locals As ImmutableArray(Of ILocalSymbol) = boundBlock.Locals.As(Of ILocalSymbol)()
Dim syntax As SyntaxNode = boundBlock.Syntax
Dim type As ITypeSymbol = Nothing
Dim constantValue As [Optional](Of Object) = New [Optional](Of Object)()
Dim isImplicit As Boolean = boundBlock.WasCompilerGenerated
Return New VisualBasicLazyBlockOperation(Me, statements, locals, _semanticModel, syntax, type, constantValue, isImplicit)
Return New VisualBasicLazyBlockOperation(Me, boundBlock, locals, _semanticModel, syntax, type, constantValue, isImplicit)
End Function
Private Function CreateBoundBadStatementOperation(boundBadStatement As BoundBadStatement) As IInvalidOperation
Dim children As ImmutableArray(Of BoundNode) = boundBadStatement.ChildBoundNodes
Dim syntax As SyntaxNode = boundBadStatement.Syntax
Dim type As ITypeSymbol = Nothing
Dim constantValue As [Optional](Of Object) = New [Optional](Of Object)()
' if child has syntax node point to same syntax node as bad statement, then this invalid statement is implicit
Dim isImplicit = boundBadStatement.WasCompilerGenerated OrElse boundBadStatement.ChildBoundNodes.Any(Function(e) e?.Syntax Is boundBadStatement.Syntax)
Return New VisualBasicLazyInvalidOperation(Me, children, _semanticModel, syntax, type, constantValue, isImplicit)
Dim isImplicit = boundBadStatement.WasCompilerGenerated
If Not isImplicit Then
For Each child In boundBadStatement.ChildBoundNodes
If child?.Syntax Is boundBadStatement.Syntax Then
isImplicit = True
Exit For
End If
Next
End If
Return New VisualBasicLazyInvalidOperation(Me, boundBadStatement, _semanticModel, syntax, type, constantValue, isImplicit)
End Function
Private Function CreateBoundReturnStatementOperation(boundReturnStatement As BoundReturnStatement) As IReturnOperation
......@@ -1327,9 +1295,6 @@ Namespace Microsoft.CodeAnalysis.Operations
End Function
Private Function CreateBoundWhileStatementOperation(boundWhileStatement As BoundWhileStatement) As IWhileLoopOperation
Dim condition As BoundNode = boundWhileStatement.Condition
Dim body As BoundNode = boundWhileStatement.Body
Dim ignoredCondition As BoundNode = Nothing
Dim locals As ImmutableArray(Of ILocalSymbol) = ImmutableArray(Of ILocalSymbol).Empty
Dim continueLabel As ILabelSymbol = boundWhileStatement.ContinueLabel
Dim exitLabel As ILabelSymbol = boundWhileStatement.ExitLabel
......@@ -1339,26 +1304,24 @@ Namespace Microsoft.CodeAnalysis.Operations
Dim type As ITypeSymbol = Nothing
Dim constantValue As [Optional](Of Object) = New [Optional](Of Object)()
Dim isImplicit As Boolean = boundWhileStatement.WasCompilerGenerated
Return New VisualBasicLazyWhileLoopOperation(Me, condition, body, ignoredCondition, locals, continueLabel, exitLabel, conditionIsTop, conditionIsUntil, _semanticModel, syntax, type, constantValue, isImplicit)
Return New VisualBasicLazyWhileLoopOperation(Me, boundWhileStatement, locals, continueLabel, exitLabel, conditionIsTop, conditionIsUntil, _semanticModel, syntax, type, constantValue, isImplicit)
End Function
Private Function CreateBoundDimStatementOperation(boundDimStatement As BoundDimStatement) As IVariableDeclarationGroupOperation
Dim declarations As ImmutableArray(Of BoundLocalDeclarationBase) = boundDimStatement.LocalDeclarations
Dim syntax As SyntaxNode = boundDimStatement.Syntax
Dim type As ITypeSymbol = Nothing
Dim constantValue As [Optional](Of Object) = New [Optional](Of Object)()
Dim isImplicit As Boolean = boundDimStatement.WasCompilerGenerated
Return New VisualBasicLazyVariableDeclarationGroupOperation(Me, declarations, _semanticModel, syntax, type, constantValue, isImplicit)
Return New VisualBasicLazyVariableDeclarationGroupOperation(Me, boundDimStatement, _semanticModel, syntax, type, constantValue, isImplicit)
End Function
Private Function CreateBoundLocalDeclarationOperation(boundLocalDeclaration As BoundLocalDeclaration) As IVariableDeclarationGroupOperation
Dim declarations As ImmutableArray(Of BoundLocalDeclarationBase) = ImmutableArray.Create(Of BoundLocalDeclarationBase)(boundLocalDeclaration)
Dim syntax As SyntaxNode = boundLocalDeclaration.Syntax
Dim type As ITypeSymbol = Nothing
Dim constantValue As [Optional](Of Object) = New [Optional](Of Object)()
Debug.Assert(boundLocalDeclaration.WasCompilerGenerated)
Dim isImplicit As Boolean = True
Return New VisualBasicLazyVariableDeclarationGroupOperation(Me, declarations, _semanticModel, syntax, type, constantValue, isImplicit)
Return New VisualBasicLazyVariableDeclarationGroupOperation(Me, boundLocalDeclaration, _semanticModel, syntax, type, constantValue, isImplicit)
End Function
Private Function CreateBoundYieldStatementOperation(boundYieldStatement As BoundYieldStatement) As IReturnOperation
......@@ -1411,8 +1374,6 @@ Namespace Microsoft.CodeAnalysis.Operations
End Function
Private Function CreateBoundSyncLockStatementOperation(boundSyncLockStatement As BoundSyncLockStatement) As ILockOperation
Dim expression As BoundNode = boundSyncLockStatement.LockExpression
Dim body As BoundNode = boundSyncLockStatement.Body
Dim legacyMode = _semanticModel.Compilation.CommonGetWellKnownTypeMember(WellKnownMember.System_Threading_Monitor__Enter2) Is Nothing
Dim lockTakenSymbol As ILocalSymbol =
If(legacyMode, Nothing,
......@@ -1424,7 +1385,7 @@ Namespace Microsoft.CodeAnalysis.Operations
Dim type As ITypeSymbol = Nothing
Dim constantValue As [Optional](Of Object) = New [Optional](Of Object)()
Dim isImplicit As Boolean = boundSyncLockStatement.WasCompilerGenerated
Return New VisualBasicLazyLockOperation(Me, expression, body, lockTakenSymbol, _semanticModel, syntax, type, constantValue, isImplicit)
Return New VisualBasicLazyLockOperation(Me, boundSyncLockStatement, lockTakenSymbol, _semanticModel, syntax, type, constantValue, isImplicit)
End Function
Private Function CreateBoundNoOpStatementOperation(boundNoOpStatement As BoundNoOpStatement) As IEmptyOperation
......@@ -1452,13 +1413,11 @@ Namespace Microsoft.CodeAnalysis.Operations
End Function
Private Function CreateBoundWithStatementOperation(boundWithStatement As BoundWithStatement) As IWithOperation
Dim body As BoundNode = boundWithStatement.Body
Dim value As BoundNode = boundWithStatement.OriginalExpression
Dim syntax As SyntaxNode = boundWithStatement.Syntax
Dim type As ITypeSymbol = Nothing
Dim constantValue As [Optional](Of Object) = New [Optional](Of Object)()
Dim isImplicit As Boolean = boundWithStatement.WasCompilerGenerated
Return New VisualBasicLazyWithOperation(Me, body, value, _semanticModel, syntax, type, constantValue, isImplicit)
Return New VisualBasicLazyWithOperation(Me, boundWithStatement, _semanticModel, syntax, type, constantValue, isImplicit)
End Function
Friend Function CreateBoundUsingStatementResources(boundUsingStatement As BoundUsingStatement) As IOperation
......@@ -1530,8 +1489,7 @@ Namespace Microsoft.CodeAnalysis.Operations
' Return an invalid statement for invalid raise event statement
If eventInvocation Is Nothing OrElse (eventInvocation.ReceiverOpt Is Nothing AndAlso Not eventSymbol.IsShared) Then
Debug.Assert(boundRaiseEventStatement.HasErrors)
Dim children As ImmutableArray(Of BoundNode) = ImmutableArray.Create(Of BoundNode)(boundRaiseEventStatement.EventInvocation)
Return New VisualBasicLazyInvalidOperation(Me, children, _semanticModel, syntax, type, constantValue, isImplicit)
Return New VisualBasicLazyInvalidOperation(Me, boundRaiseEventStatement, _semanticModel, syntax, type, constantValue, isImplicit)
End If
Return New VisualBasicLazyRaiseEventOperation(Me, boundRaiseEventStatement, _semanticModel, syntax, type, constantValue, isImplicit)
......@@ -1564,21 +1522,19 @@ Namespace Microsoft.CodeAnalysis.Operations
End Function
Private Function CreateTupleOperation(boundTupleExpression As BoundTupleExpression, naturalType As ITypeSymbol) As ITupleOperation
Dim elements As ImmutableArray(Of BoundExpression) = boundTupleExpression.Arguments
Dim syntax As SyntaxNode = boundTupleExpression.Syntax
Dim type As ITypeSymbol = boundTupleExpression.Type
Dim constantValue As [Optional](Of Object) = Nothing
Dim isImplicit As Boolean = boundTupleExpression.WasCompilerGenerated
Return New VisualBasicLazyTupleOperation(Me, elements, _semanticModel, syntax, type, naturalType, constantValue, isImplicit)
Return New VisualBasicLazyTupleOperation(Me, boundTupleExpression, _semanticModel, syntax, type, naturalType, constantValue, isImplicit)
End Function
Private Function CreateBoundInterpolatedStringExpressionOperation(boundInterpolatedString As BoundInterpolatedStringExpression) As IInterpolatedStringOperation
Dim parts As ImmutableArray(Of BoundNode) = boundInterpolatedString.Contents
Dim syntax As SyntaxNode = boundInterpolatedString.Syntax
Dim type As ITypeSymbol = boundInterpolatedString.Type
Dim constantValue As [Optional](Of Object) = ConvertToOptional(boundInterpolatedString.ConstantValueOpt)
Dim isImplicit As Boolean = boundInterpolatedString.WasCompilerGenerated
Return New VisualBasicLazyInterpolatedStringOperation(Me, parts, _semanticModel, syntax, type, constantValue, isImplicit)
Return New VisualBasicLazyInterpolatedStringOperation(Me, boundInterpolatedString, _semanticModel, syntax, type, constantValue, isImplicit)
End Function
Friend Function CreateBoundInterpolatedStringContentOperation(parts As ImmutableArray(Of BoundNode)) As ImmutableArray(Of IInterpolatedStringContentOperation)
......@@ -1594,14 +1550,11 @@ Namespace Microsoft.CodeAnalysis.Operations
End Function
Private Function CreateBoundInterpolationOperation(boundInterpolation As BoundInterpolation) As IInterpolationOperation
Dim expression As BoundNode = boundInterpolation.Expression
Dim alignment As BoundNode = boundInterpolation.AlignmentOpt
Dim format As BoundNode = boundInterpolation.FormatStringOpt
Dim syntax As SyntaxNode = boundInterpolation.Syntax
Dim type As ITypeSymbol = Nothing
Dim constantValue As [Optional](Of Object) = Nothing
Dim isImplicit As Boolean = boundInterpolation.WasCompilerGenerated
Return New VisualBasicLazyInterpolationOperation(Me, expression, alignment, format, _semanticModel, syntax, type, constantValue, isImplicit)
Return New VisualBasicLazyInterpolationOperation(Me, boundInterpolation, _semanticModel, syntax, type, constantValue, isImplicit)
End Function
Private Function CreateBoundInterpolatedStringTextOperation(boundLiteral As BoundLiteral) As IInterpolatedStringTextOperation
......@@ -1661,17 +1614,14 @@ Namespace Microsoft.CodeAnalysis.Operations
Debug.Assert(boundAggregateClause.GroupPlaceholderOpt IsNot Nothing)
RecordParent(boundAggregateClause.GroupPlaceholderOpt, boundAggregateClause)
Dim group As BoundNode = boundAggregateClause.CapturedGroupOpt
Dim aggregation As BoundNode = boundAggregateClause.UnderlyingExpression
Dim syntax As SyntaxNode = boundAggregateClause.Syntax
Dim type As ITypeSymbol = boundAggregateClause.Type
Dim constantValue As [Optional](Of Object) = ConvertToOptional(boundAggregateClause.ConstantValueOpt)
Dim isImplicit As Boolean = boundAggregateClause.WasCompilerGenerated
Return New VisualBasicLazyAggregateQueryOperation(Me, group, aggregation, _semanticModel, syntax, type, constantValue, isImplicit)
Return New VisualBasicLazyAggregateQueryOperation(Me, boundAggregateClause, _semanticModel, syntax, type, constantValue, isImplicit)
End Function
Private Function CreateBoundNullableIsTrueOperator(boundNullableIsTrueOperator As BoundNullableIsTrueOperator) As IOperation
Dim operand As BoundNode = boundNullableIsTrueOperator.Operand
Dim syntax As SyntaxNode = boundNullableIsTrueOperator.Syntax
Dim type As ITypeSymbol = boundNullableIsTrueOperator.Type
Dim constantValue As [Optional](Of Object) = ConvertToOptional(boundNullableIsTrueOperator.ConstantValueOpt)
......@@ -1684,8 +1634,7 @@ Namespace Microsoft.CodeAnalysis.Operations
If method IsNot Nothing Then
Return New VisualBasicLazyInvocationOperation(Me,
operand,
boundCall:=Nothing,
boundNullableIsTrueOperator,
method.AsMember(DirectCast(boundNullableIsTrueOperator.Operand.Type, NamedTypeSymbol)),
isVirtual:=False,
semanticModel:=_semanticModel,
......@@ -1694,16 +1643,14 @@ Namespace Microsoft.CodeAnalysis.Operations
constantValue,
isImplicit)
Else
Dim children = ImmutableArray.Create(Of BoundNode)(operand)
Return New VisualBasicLazyInvalidOperation(Me, children, _semanticModel, syntax, type, constantValue, isImplicit)
Return New VisualBasicLazyInvalidOperation(Me, boundNullableIsTrueOperator, _semanticModel, syntax, type, constantValue, isImplicit)
End If
End Function
Private Function CreateBoundReDimOperation(boundRedimStatement As BoundRedimStatement) As IReDimOperation
Dim preserve As Boolean = boundRedimStatement.Syntax.Kind = SyntaxKind.ReDimPreserveStatement
Dim clauses As ImmutableArray(Of BoundRedimClause) = boundRedimStatement.Clauses
#If DEBUG Then
For Each clause In clauses
For Each clause In boundRedimStatement.Clauses
Debug.Assert(preserve = clause.Preserve)
Next
#End If
......@@ -1711,17 +1658,15 @@ Namespace Microsoft.CodeAnalysis.Operations
Dim type As ITypeSymbol = Nothing
Dim constantValue As [Optional](Of Object) = Nothing
Dim isImplicit As Boolean = boundRedimStatement.WasCompilerGenerated
Return New VisualBasicLazyReDimOperation(Me, clauses, preserve, _semanticModel, syntax, type, constantValue, isImplicit)
Return New VisualBasicLazyReDimOperation(Me, boundRedimStatement, preserve, _semanticModel, syntax, type, constantValue, isImplicit)
End Function
Private Function CreateBoundReDimClauseOperation(boundRedimClause As BoundRedimClause) As IReDimClauseOperation
Dim operand As BoundNode = boundRedimClause.Operand
Dim dimensionSizes As ImmutableArray(Of BoundExpression) = boundRedimClause.Indices
Dim syntax As SyntaxNode = boundRedimClause.Syntax
Dim type As ITypeSymbol = Nothing
Dim constantValue As [Optional](Of Object) = Nothing
Dim isImplicit As Boolean = boundRedimClause.WasCompilerGenerated
Return New VisualBasicLazyReDimClauseOperation(Me, operand, dimensionSizes, _semanticModel, syntax, type, constantValue, isImplicit)
Return New VisualBasicLazyReDimClauseOperation(Me, boundRedimClause, _semanticModel, syntax, type, constantValue, isImplicit)
End Function
End Class
End Namespace
......
......@@ -254,17 +254,35 @@ Namespace Microsoft.CodeAnalysis.Operations
' put argument syntax to argument operation
Dim argument = If(valueNode.Syntax.Kind = SyntaxKind.OmittedArgument, valueNode.Syntax, TryCast(valueNode.Syntax?.Parent, ArgumentSyntax))
' if argument syntax doesn't exist, then this operation is implicit
Return New VisualBasicLazyArgumentOperation(
Me,
valueNode,
kind,
inConversion,
outConversion,
parameter,
semanticModel:=_semanticModel,
syntax:=If(argument, valueNode.Syntax),
isImplicit:=isImplicit OrElse argument Is Nothing)
If argument Is Nothing Then
' We don't create this lazily because, in the case of query nodes we may want to skip intermediate nodes and then
' use the same syntax as the underlying value for the containing Argument. So we need to actually create the child
' node to determine the correct syntax
Dim value = Create(valueNode)
Return New ArgumentOperation(
value,
kind,
parameter,
inConversion,
outConversion,
semanticModel:=_semanticModel,
syntax:=value.Syntax,
isImplicit:=True)
Else
Debug.Assert(argument IsNot valueNode.Syntax OrElse valueNode.Syntax Is CreateInternal(valueNode).Syntax)
Return New VisualBasicLazyArgumentOperation(
Me,
valueNode,
kind,
inConversion,
outConversion,
parameter,
semanticModel:=_semanticModel,
syntax:=argument,
isImplicit:=isImplicit)
End If
End Function
Friend Function CreateReceiverOperation(node As BoundNode, symbol As ISymbol) As IOperation
......@@ -364,7 +382,7 @@ Namespace Microsoft.CodeAnalysis.Operations
Return GetCaseClauseValue(clause.ValueOpt, clause.ConditionOpt)
End Function
Private Shared Function GetCaseClauseValue(valueOpt As BoundExpression, conditionOpt As BoundExpression) As BoundExpression
Friend Shared Function GetCaseClauseValue(valueOpt As BoundExpression, conditionOpt As BoundExpression) As BoundExpression
If valueOpt IsNot Nothing Then
Return valueOpt
End If
......@@ -477,11 +495,9 @@ Namespace Microsoft.CodeAnalysis.Operations
End Function
Friend Function GetAddRemoveHandlerStatementExpression(statement As BoundAddRemoveHandlerStatement) As IOperation
Dim eventAccess As BoundNode = statement.EventAccess
Dim handler As BoundNode = statement.Handler
Dim adds = statement.Kind = BoundKind.AddHandlerStatement
Return New VisualBasicLazyEventAssignmentOperation(
Me, eventAccess, handler, adds:=adds, semanticModel:=_semanticModel, syntax:=statement.Syntax, type:=Nothing, constantValue:=Nothing, isImplicit:=True)
Me, statement, adds:=adds, semanticModel:=_semanticModel, syntax:=statement.Syntax, type:=Nothing, constantValue:=Nothing, isImplicit:=True)
End Function
#Region "Conversions"
......
......@@ -60,22 +60,20 @@ Namespace Microsoft.CodeAnalysis.Operations
Inherits LazyArrayCreationOperation
Private ReadOnly _operationFactory As VisualBasicOperationFactory
Private ReadOnly _dimensionSizes As ImmutableArray(Of BoundExpression)
Private ReadOnly _initializer As BoundNode
Private ReadOnly _arrayCreation As BoundArrayCreation
Friend Sub New(operationFactory As VisualBasicOperationFactory, dimensionSizes As ImmutableArray(Of BoundExpression), initializer As BoundNode, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
Friend Sub New(operationFactory As VisualBasicOperationFactory, arrayCreation As BoundArrayCreation, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
MyBase.New(semanticModel, syntax, type, constantValue, isImplicit)
_operationFactory = operationFactory
_dimensionSizes = dimensionSizes
_initializer = initializer
_arrayCreation = arrayCreation
End Sub
Protected Overrides Function CreateDimensionSizes() As ImmutableArray(Of IOperation)
Return _operationFactory.CreateFromArray(Of BoundExpression, IOperation)(_dimensionSizes)
Return _operationFactory.CreateFromArray(Of BoundExpression, IOperation)(_arrayCreation.Bounds)
End Function
Protected Overrides Function CreateInitializer() As IArrayInitializerOperation
Return DirectCast(_operationFactory.Create(_initializer), IArrayInitializerOperation)
Return DirectCast(_operationFactory.Create(_arrayCreation.InitializerOpt), IArrayInitializerOperation)
End Function
End Class
......@@ -83,22 +81,20 @@ Namespace Microsoft.CodeAnalysis.Operations
Inherits LazyArrayElementReferenceOperation
Private ReadOnly _operationFactory As VisualBasicOperationFactory
Private ReadOnly _arrayReference As BoundNode
Private ReadOnly _indices As ImmutableArray(Of BoundExpression)
Private ReadOnly _arrayAccess As BoundArrayAccess
Friend Sub New(operationFactory As VisualBasicOperationFactory, arrayReference As BoundNode, indices As ImmutableArray(Of BoundExpression), semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
Friend Sub New(operationFactory As VisualBasicOperationFactory, arrayAccess As BoundArrayAccess, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
MyBase.New(semanticModel, syntax, type, constantValue, isImplicit)
_operationFactory = operationFactory
_arrayReference = arrayReference
_indices = indices
_arrayAccess = arrayAccess
End Sub
Protected Overrides Function CreateArrayReference() As IOperation
Return _operationFactory.Create(_arrayReference)
Return _operationFactory.Create(_arrayAccess.Expression)
End Function
Protected Overrides Function CreateIndices() As ImmutableArray(Of IOperation)
Return _operationFactory.CreateFromArray(Of BoundExpression, IOperation)(_indices)
Return _operationFactory.CreateFromArray(Of BoundExpression, IOperation)(_arrayAccess.Indices)
End Function
End Class
......@@ -106,16 +102,16 @@ Namespace Microsoft.CodeAnalysis.Operations
Inherits LazyArrayInitializerOperation
Private ReadOnly _operationFactory As VisualBasicOperationFactory
Private ReadOnly _elementValues As ImmutableArray(Of BoundExpression)
Private ReadOnly _arrayInitialization As BoundArrayInitialization
Friend Sub New(operationFactory As VisualBasicOperationFactory, elementValues As ImmutableArray(Of BoundExpression), semanticModel As SemanticModel, syntax As SyntaxNode, constantValue As [Optional](Of Object), isImplicit As Boolean)
Friend Sub New(operationFactory As VisualBasicOperationFactory, arrayInitialization As BoundArrayInitialization, semanticModel As SemanticModel, syntax As SyntaxNode, constantValue As [Optional](Of Object), isImplicit As Boolean)
MyBase.New(semanticModel, syntax, constantValue, isImplicit)
_operationFactory = operationFactory
_elementValues = elementValues
_arrayInitialization = arrayInitialization
End Sub
Protected Overrides Function CreateElementValues() As ImmutableArray(Of IOperation)
Return _operationFactory.CreateFromArray(Of BoundExpression, IOperation)(_elementValues)
Return _operationFactory.CreateFromArray(Of BoundExpression, IOperation)(_arrayInitialization.Initializers)
End Function
End Class
......@@ -123,22 +119,20 @@ Namespace Microsoft.CodeAnalysis.Operations
Inherits LazySimpleAssignmentOperation
Private ReadOnly _operationFactory As VisualBasicOperationFactory
Private ReadOnly _target As BoundNode
Private ReadOnly _value As BoundNode
Private ReadOnly _assignment As BoundAssignmentOperator
Friend Sub New(operationFactory As VisualBasicOperationFactory, target As BoundNode, value As BoundNode, isRef As Boolean, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
Friend Sub New(operationFactory As VisualBasicOperationFactory, assignment As BoundAssignmentOperator, isRef As Boolean, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
MyBase.New(isRef, semanticModel, syntax, type, constantValue, isImplicit)
_operationFactory = operationFactory
_target = target
_value = value
_assignment = assignment
End Sub
Protected Overrides Function CreateTarget() As IOperation
Return _operationFactory.Create(_target)
Return _operationFactory.Create(_assignment.Left)
End Function
Protected Overrides Function CreateValue() As IOperation
Return _operationFactory.Create(_value)
Return _operationFactory.Create(_assignment.Right)
End Function
End Class
......@@ -184,16 +178,16 @@ Namespace Microsoft.CodeAnalysis.Operations
Inherits LazyBlockOperation
Private ReadOnly _operationFactory As VisualBasicOperationFactory
Private ReadOnly _operations As ImmutableArray(Of BoundStatement)
Private ReadOnly _block As BoundBlock
Friend Sub New(operationFactory As VisualBasicOperationFactory, operations As ImmutableArray(Of BoundStatement), locals As ImmutableArray(Of ILocalSymbol), semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
Friend Sub New(operationFactory As VisualBasicOperationFactory, block As BoundBlock, locals As ImmutableArray(Of ILocalSymbol), semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
MyBase.New(locals, semanticModel, syntax, type, constantValue, isImplicit)
_operationFactory = operationFactory
_operations = operations
_block = block
End Sub
Protected Overrides Function CreateOperations() As ImmutableArray(Of IOperation)
Return _operationFactory.CreateFromArray(Of BoundStatement, IOperation)(_operations)
Return _operationFactory.CreateFromArray(Of BoundStatement, IOperation)(_block.Statements)
End Function
End Class
......@@ -247,22 +241,20 @@ Namespace Microsoft.CodeAnalysis.Operations
Inherits LazyConditionalAccessOperation
Private ReadOnly _operationFactory As VisualBasicOperationFactory
Private ReadOnly _operation As BoundNode
Private ReadOnly _whenNotNull As BoundNode
Private ReadOnly _conditionalAccess As BoundConditionalAccess
Friend Sub New(operationFactory As VisualBasicOperationFactory, operation As BoundNode, whenNotNull As BoundNode, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
Friend Sub New(operationFactory As VisualBasicOperationFactory, conditionalAccess As BoundConditionalAccess, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
MyBase.New(semanticModel, syntax, type, constantValue, isImplicit)
_operationFactory = operationFactory
_operation = operation
_whenNotNull = whenNotNull
_conditionalAccess = conditionalAccess
End Sub
Protected Overrides Function CreateOperation() As IOperation
Return _operationFactory.Create(_operation)
Return _operationFactory.Create(_conditionalAccess.Receiver)
End Function
Protected Overrides Function CreateWhenNotNull() As IOperation
Return _operationFactory.Create(_whenNotNull)
Return _operationFactory.Create(_conditionalAccess.AccessExpression)
End Function
End Class
......@@ -270,28 +262,24 @@ Namespace Microsoft.CodeAnalysis.Operations
Inherits LazyConditionalOperation
Private ReadOnly _operationFactory As VisualBasicOperationFactory
Private ReadOnly _condition As BoundNode
Private ReadOnly _whenTrue As BoundNode
Private ReadOnly _whenFalse As BoundNode
Private ReadOnly _conditional As IBoundConditional
Friend Sub New(operationFactory As VisualBasicOperationFactory, condition As BoundNode, whenTrue As BoundNode, whenFalse As BoundNode, isRef As Boolean, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
Friend Sub New(operationFactory As VisualBasicOperationFactory, conditional As IBoundConditional, isRef As Boolean, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
MyBase.New(isRef, semanticModel, syntax, type, constantValue, isImplicit)
_operationFactory = operationFactory
_condition = condition
_whenTrue = whenTrue
_whenFalse = whenFalse
_conditional = conditional
End Sub
Protected Overrides Function CreateCondition() As IOperation
Return _operationFactory.Create(_condition)
Return _operationFactory.Create(_conditional.Condition)
End Function
Protected Overrides Function CreateWhenTrue() As IOperation
Return _operationFactory.Create(_whenTrue)
Return _operationFactory.Create(_conditional.WhenTrue)
End Function
Protected Overrides Function CreateWhenFalse() As IOperation
Return _operationFactory.Create(_whenFalse)
Return _operationFactory.Create(_conditional.WhenFalseOpt)
End Function
End Class
......@@ -299,22 +287,20 @@ Namespace Microsoft.CodeAnalysis.Operations
Inherits LazyEventAssignmentOperation
Private ReadOnly _operationFactory As VisualBasicOperationFactory
Private ReadOnly _eventReference As BoundNode
Private ReadOnly _handlerValue As BoundNode
Private ReadOnly _addRemoveHandlerStatement As BoundAddRemoveHandlerStatement
Friend Sub New(operationFactory As VisualBasicOperationFactory, eventReference As BoundNode, handlerValue As BoundNode, adds As Boolean, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
Friend Sub New(operationFactory As VisualBasicOperationFactory, addRemoveHandlerStatement As BoundAddRemoveHandlerStatement, adds As Boolean, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
MyBase.New(adds, semanticModel, syntax, type, constantValue, isImplicit)
_operationFactory = operationFactory
_eventReference = eventReference
_handlerValue = handlerValue
_addRemoveHandlerStatement = addRemoveHandlerStatement
End Sub
Protected Overrides Function CreateEventReference() As IOperation
Return _operationFactory.Create(_eventReference)
Return _operationFactory.Create(_addRemoveHandlerStatement.EventAccess)
End Function
Protected Overrides Function CreateHandlerValue() As IOperation
Return _operationFactory.Create(_handlerValue)
Return _operationFactory.Create(_addRemoveHandlerStatement.Handler)
End Function
End Class
......@@ -479,16 +465,16 @@ _operationFactory.CreateFromArray(Of BoundExpression, IOperation)(_boundForToLoo
Inherits LazyInterpolatedStringOperation
Private ReadOnly _operationFactory As VisualBasicOperationFactory
Private ReadOnly _parts As ImmutableArray(Of BoundNode)
Private ReadOnly _interpolatedStringExpression As BoundInterpolatedStringExpression
Friend Sub New(operationFactory As VisualBasicOperationFactory, parts As ImmutableArray(Of BoundNode), semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
Friend Sub New(operationFactory As VisualBasicOperationFactory, interpolatedStringExpression As BoundInterpolatedStringExpression, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
MyBase.New(semanticModel, syntax, type, constantValue, isImplicit)
_operationFactory = operationFactory
_parts = parts
_interpolatedStringExpression = interpolatedStringExpression
End Sub
Protected Overrides Function CreateParts() As ImmutableArray(Of IInterpolatedStringContentOperation)
Return _operationFactory.CreateBoundInterpolatedStringContentOperation(_parts)
Return _operationFactory.CreateBoundInterpolatedStringContentOperation(_interpolatedStringExpression.Contents)
End Function
End Class
......@@ -513,28 +499,24 @@ _operationFactory.CreateFromArray(Of BoundExpression, IOperation)(_boundForToLoo
Inherits LazyInterpolationOperation
Private ReadOnly _operationFactory As VisualBasicOperationFactory
Private ReadOnly _expression As BoundNode
Private ReadOnly _alignment As BoundNode
Private ReadOnly _formatString As BoundNode
Private ReadOnly _interpolation As BoundInterpolation
Friend Sub New(operationFactory As VisualBasicOperationFactory, expression As BoundNode, alignment As BoundNode, formatString As BoundNode, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
Friend Sub New(operationFactory As VisualBasicOperationFactory, interpolation As BoundInterpolation, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
MyBase.New(semanticModel, syntax, type, constantValue, isImplicit)
_operationFactory = operationFactory
_expression = expression
_alignment = alignment
_formatString = formatString
_interpolation = interpolation
End Sub
Protected Overrides Function CreateExpression() As IOperation
Return _operationFactory.Create(_expression)
Return _operationFactory.Create(_interpolation.Expression)
End Function
Protected Overrides Function CreateAlignment() As IOperation
Return _operationFactory.Create(_alignment)
Return _operationFactory.Create(_interpolation.AlignmentOpt)
End Function
Protected Overrides Function CreateFormatString() As IOperation
Return _operationFactory.Create(_formatString)
Return _operationFactory.Create(_interpolation.FormatStringOpt)
End Function
End Class
......@@ -542,16 +524,16 @@ _operationFactory.CreateFromArray(Of BoundExpression, IOperation)(_boundForToLoo
Inherits LazyInvalidOperation
Private ReadOnly _operationFactory As VisualBasicOperationFactory
Private ReadOnly _children As ImmutableArray(Of BoundNode)
Private ReadOnly _originalNode As IBoundNodeWithIOperationChildren
Friend Sub New(operationFactory As VisualBasicOperationFactory, children As ImmutableArray(Of BoundNode), semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
Friend Sub New(operationFactory As VisualBasicOperationFactory, originalNode As IBoundNodeWithIOperationChildren, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
MyBase.New(semanticModel, syntax, type, constantValue, isImplicit)
_operationFactory = operationFactory
_children = children
_originalNode = originalNode
End Sub
Protected Overrides Function CreateChildren() As ImmutableArray(Of IOperation)
Return _operationFactory.CreateFromArray(Of BoundNode, IOperation)(_children)
Return _operationFactory.CreateFromArray(Of BoundNode, IOperation)(_originalNode.Children)
End Function
End Class
......@@ -559,22 +541,20 @@ _operationFactory.CreateFromArray(Of BoundExpression, IOperation)(_boundForToLoo
Inherits LazyInvocationOperation
Private ReadOnly _operationFactory As VisualBasicOperationFactory
Private ReadOnly _boundCall As BoundCall
Private ReadOnly _instance As BoundNode
Private ReadOnly _invocable As IBoundInvocable
Friend Sub New(operationFactory As VisualBasicOperationFactory, instance As BoundNode, boundCall As BoundCall, targetMethod As IMethodSymbol, isVirtual As Boolean, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
Friend Sub New(operationFactory As VisualBasicOperationFactory, invocable As IBoundInvocable, targetMethod As IMethodSymbol, isVirtual As Boolean, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
MyBase.New(targetMethod, isVirtual, semanticModel, syntax, type, constantValue, isImplicit)
_operationFactory = operationFactory
_instance = instance
_boundCall = boundCall
_invocable = invocable
End Sub
Protected Overrides Function CreateInstance() As IOperation
Return _operationFactory.CreateReceiverOperation(_instance, TargetMethod)
Return _operationFactory.CreateReceiverOperation(_invocable.InstanceOpt, TargetMethod)
End Function
Protected Overrides Function CreateArguments() As ImmutableArray(Of IArgumentOperation)
Return If(_boundCall IsNot Nothing, _operationFactory.DeriveArguments(_boundCall), ImmutableArray(Of IArgumentOperation).Empty)
Return If(_invocable.CallOpt IsNot Nothing, _operationFactory.DeriveArguments(_invocable.CallOpt), ImmutableArray(Of IArgumentOperation).Empty)
End Function
End Class
......@@ -688,22 +668,20 @@ _operationFactory.CreateFromArray(Of BoundExpression, IOperation)(_boundForToLoo
Inherits LazyLockOperation
Private ReadOnly _operationFactory As VisualBasicOperationFactory
Private ReadOnly _lockedValue As BoundNode
Private ReadOnly _body As BoundNode
Private ReadOnly _lockStatement As BoundSyncLockStatement
Friend Sub New(operationFactory As VisualBasicOperationFactory, lockedValue As BoundNode, body As BoundNode, lockTakenSymbol As ILocalSymbol, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
Friend Sub New(operationFactory As VisualBasicOperationFactory, lockStatement As BoundSyncLockStatement, lockTakenSymbol As ILocalSymbol, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
MyBase.New(lockTakenSymbol, semanticModel, syntax, type, constantValue, isImplicit)
_operationFactory = operationFactory
_lockedValue = lockedValue
_body = body
_lockStatement = lockStatement
End Sub
Protected Overrides Function CreateLockedValue() As IOperation
Return _operationFactory.Create(_lockedValue)
Return _operationFactory.Create(_lockStatement.LockExpression)
End Function
Protected Overrides Function CreateBody() As IOperation
Return _operationFactory.Create(_body)
Return _operationFactory.Create(_lockStatement.Body)
End Function
End Class
......@@ -728,22 +706,20 @@ _operationFactory.CreateFromArray(Of BoundExpression, IOperation)(_boundForToLoo
Inherits LazyCoalesceOperation
Private ReadOnly _operationFactory As VisualBasicOperationFactory
Private ReadOnly _value As BoundNode
Private ReadOnly _whenNull As BoundNode
Private ReadOnly _conditionalExpression As BoundBinaryConditionalExpression
Friend Sub New(operationFactory As VisualBasicOperationFactory, value As BoundNode, whenNull As BoundNode, convertibleValueConversion As IConvertibleConversion, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
Friend Sub New(operationFactory As VisualBasicOperationFactory, conditionalExpression As BoundBinaryConditionalExpression, convertibleValueConversion As IConvertibleConversion, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
MyBase.New(convertibleValueConversion, semanticModel, syntax, type, constantValue, isImplicit)
_operationFactory = operationFactory
_value = value
_whenNull = whenNull
_conditionalExpression = conditionalExpression
End Sub
Protected Overrides Function CreateValue() As IOperation
Return _operationFactory.Create(_value)
Return _operationFactory.Create(_conditionalExpression.TestExpression)
End Function
Protected Overrides Function CreateWhenNull() As IOperation
Return _operationFactory.Create(_whenNull)
Return _operationFactory.Create(_conditionalExpression.ElseExpression)
End Function
End Class
......@@ -840,18 +816,18 @@ _operationFactory.CreateFromArray(Of BoundExpression, IOperation)(_boundForToLoo
Inherits LazyPropertyReferenceOperation
Private ReadOnly _operationFactory As VisualBasicOperationFactory
Private ReadOnly _instance As BoundNode
Private ReadOnly _boundProperty As BoundPropertyAccess
Friend Sub New(operationFactory As VisualBasicOperationFactory, instance As BoundNode, boundProperty As BoundPropertyAccess, [property] As IPropertySymbol, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
Friend Sub New(operationFactory As VisualBasicOperationFactory, boundProperty As BoundPropertyAccess, [property] As IPropertySymbol, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
MyBase.New([property], semanticModel, syntax, type, constantValue, isImplicit)
_operationFactory = operationFactory
_instance = instance
_boundProperty = boundProperty
End Sub
Protected Overrides Function CreateInstance() As IOperation
Return _operationFactory.CreateReceiverOperation(_instance, [Property])
Return _operationFactory.CreateReceiverOperation(
If(_boundProperty.ReceiverOpt, _boundProperty.PropertyGroupOpt?.ReceiverOpt),
[Property])
End Function
Protected Overrides Function CreateArguments() As ImmutableArray(Of IArgumentOperation)
......@@ -863,22 +839,20 @@ _operationFactory.CreateFromArray(Of BoundExpression, IOperation)(_boundForToLoo
Inherits LazyRangeCaseClauseOperation
Private ReadOnly _operationFactory As VisualBasicOperationFactory
Private ReadOnly _minimumValue As BoundNode
Private ReadOnly _maximumValue As BoundNode
Private ReadOnly _rangeCaseClause As BoundRangeCaseClause
Friend Sub New(operationFactory As VisualBasicOperationFactory, minimumValue As BoundNode, maximumValue As BoundNode, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
Friend Sub New(operationFactory As VisualBasicOperationFactory, rangeCaseClause As BoundRangeCaseClause, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
MyBase.New(semanticModel, syntax, type, constantValue, isImplicit)
_operationFactory = operationFactory
_minimumValue = minimumValue
_maximumValue = maximumValue
_rangeCaseClause = rangeCaseClause
End Sub
Protected Overrides Function CreateMinimumValue() As IOperation
Return _operationFactory.Create(_minimumValue)
Return _operationFactory.Create(VisualBasicOperationFactory.GetCaseClauseValue(_rangeCaseClause.LowerBoundOpt, _rangeCaseClause.LowerBoundConditionOpt))
End Function
Protected Overrides Function CreateMaximumValue() As IOperation
Return _operationFactory.Create(_maximumValue)
Return _operationFactory.Create(VisualBasicOperationFactory.GetCaseClauseValue(_rangeCaseClause.UpperBoundOpt, _rangeCaseClause.UpperBoundConditionOpt))
End Function
End Class
......@@ -962,22 +936,20 @@ _operationFactory.CreateFromArray(Of BoundExpression, IOperation)(_boundForToLoo
Inherits LazySwitchOperation
Private ReadOnly _operationFactory As VisualBasicOperationFactory
Private ReadOnly _value As BoundNode
Private ReadOnly _cases As ImmutableArray(Of BoundCaseBlock)
Private ReadOnly _selectStatement As BoundSelectStatement
Friend Sub New(operationFactory As VisualBasicOperationFactory, value As BoundNode, cases As ImmutableArray(Of BoundCaseBlock), locals As ImmutableArray(Of ILocalSymbol), exitLabel As ILabelSymbol, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
Friend Sub New(operationFactory As VisualBasicOperationFactory, selectStatement As BoundSelectStatement, locals As ImmutableArray(Of ILocalSymbol), exitLabel As ILabelSymbol, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
MyBase.New(locals, exitLabel, semanticModel, syntax, type, constantValue, isImplicit)
_operationFactory = operationFactory
_value = value
_cases = cases
_selectStatement = selectStatement
End Sub
Protected Overrides Function CreateValue() As IOperation
Return _operationFactory.Create(_value)
Return _operationFactory.Create(_selectStatement.ExpressionStatement.Expression)
End Function
Protected Overrides Function CreateCases() As ImmutableArray(Of ISwitchCaseOperation)
Return _operationFactory.CreateFromArray(Of BoundCaseBlock, ISwitchCaseOperation)(_cases)
Return _operationFactory.CreateFromArray(Of BoundCaseBlock, ISwitchCaseOperation)(_selectStatement.CaseBlocks)
End Function
End Class
......@@ -985,28 +957,24 @@ _operationFactory.CreateFromArray(Of BoundExpression, IOperation)(_boundForToLoo
Inherits LazyTryOperation
Private ReadOnly _operationFactory As VisualBasicOperationFactory
Private ReadOnly _body As BoundNode
Private ReadOnly _catches As ImmutableArray(Of BoundCatchBlock)
Private ReadOnly _finally As BoundNode
Private ReadOnly _tryStatement As BoundTryStatement
Friend Sub New(operationFactory As VisualBasicOperationFactory, body As BoundNode, catches As ImmutableArray(Of BoundCatchBlock), [finally] As BoundNode, exitLabel As ILabelSymbol, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
Friend Sub New(operationFactory As VisualBasicOperationFactory, tryStatement As BoundTryStatement, exitLabel As ILabelSymbol, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
MyBase.New(exitLabel, semanticModel, syntax, type, constantValue, isImplicit)
_operationFactory = operationFactory
_body = body
_catches = catches
_finally = [finally]
_tryStatement = tryStatement
End Sub
Protected Overrides Function CreateBody() As IBlockOperation
Return DirectCast(_operationFactory.Create(_body), IBlockOperation)
Return DirectCast(_operationFactory.Create(_tryStatement.TryBlock), IBlockOperation)
End Function
Protected Overrides Function CreateCatches() As ImmutableArray(Of ICatchClauseOperation)
Return _operationFactory.CreateFromArray(Of BoundCatchBlock, ICatchClauseOperation)(_catches)
Return _operationFactory.CreateFromArray(Of BoundCatchBlock, ICatchClauseOperation)(_tryStatement.CatchBlocks)
End Function
Protected Overrides Function CreateFinally() As IBlockOperation
Return DirectCast(_operationFactory.Create(_finally), IBlockOperation)
Return DirectCast(_operationFactory.Create(_tryStatement.FinallyBlockOpt), IBlockOperation)
End Function
End Class
......@@ -1014,16 +982,16 @@ _operationFactory.CreateFromArray(Of BoundExpression, IOperation)(_boundForToLoo
Inherits LazyTupleOperation
Private ReadOnly _operationFactory As VisualBasicOperationFactory
Private ReadOnly _elements As ImmutableArray(Of BoundExpression)
Private ReadOnly _tupleExpression As BoundTupleExpression
Friend Sub New(operationFactory As VisualBasicOperationFactory, elements As ImmutableArray(Of BoundExpression), semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, naturalType As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
Friend Sub New(operationFactory As VisualBasicOperationFactory, tupleExpression As BoundTupleExpression, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, naturalType As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
MyBase.New(semanticModel, syntax, type, naturalType, constantValue, isImplicit)
_operationFactory = operationFactory
_elements = elements
_tupleExpression = tupleExpression
End Sub
Protected Overrides Function CreateElements() As ImmutableArray(Of IOperation)
Return SetParentOperation(_operationFactory.CreateFromArray(Of BoundExpression, IOperation)(_elements), Me)
Return _operationFactory.CreateFromArray(Of BoundExpression, IOperation)(_tupleExpression.Arguments)
End Function
End Class
......@@ -1048,22 +1016,20 @@ _operationFactory.CreateFromArray(Of BoundExpression, IOperation)(_boundForToLoo
Inherits LazyDynamicInvocationOperation
Private ReadOnly _operationFactory As VisualBasicOperationFactory
Private ReadOnly _operation As BoundNode
Private ReadOnly _arguments As ImmutableArray(Of BoundExpression)
Private ReadOnly _lateInvocation As BoundLateInvocation
Friend Sub New(operationFactory As VisualBasicOperationFactory, operation As BoundNode, arguments As ImmutableArray(Of BoundExpression), argumentNames As ImmutableArray(Of String), argumentRefKinds As ImmutableArray(Of RefKind), semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
Friend Sub New(operationFactory As VisualBasicOperationFactory, lateInvocation As BoundLateInvocation, argumentNames As ImmutableArray(Of String), argumentRefKinds As ImmutableArray(Of RefKind), semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
MyBase.New(argumentNames, argumentRefKinds, semanticModel, syntax, type, constantValue, isImplicit)
_operationFactory = operationFactory
_operation = operation
_arguments = arguments
_lateInvocation = lateInvocation
End Sub
Protected Overrides Function CreateOperation() As IOperation
Return _operationFactory.Create(_operation)
Return _operationFactory.Create(_lateInvocation.Member)
End Function
Protected Overrides Function CreateArguments() As ImmutableArray(Of IOperation)
Return _operationFactory.CreateFromArray(Of BoundExpression, IOperation)(_arguments)
Return _operationFactory.CreateFromArray(Of BoundExpression, IOperation)(_lateInvocation.ArgumentsOpt)
End Function
End Class
......@@ -1109,16 +1075,16 @@ _operationFactory.CreateFromArray(Of BoundExpression, IOperation)(_boundForToLoo
Inherits LazyVariableDeclarationGroupOperation
Private ReadOnly _operationFactory As VisualBasicOperationFactory
Private ReadOnly _declarations As ImmutableArray(Of BoundLocalDeclarationBase)
Private ReadOnly _localDeclarations As IBoundLocalDeclarations
Friend Sub New(operationFactory As VisualBasicOperationFactory, declarations As ImmutableArray(Of BoundLocalDeclarationBase), semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
Friend Sub New(operationFactory As VisualBasicOperationFactory, localDeclarations As IBoundLocalDeclarations, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
MyBase.New(semanticModel, syntax, type, constantValue, isImplicit)
_operationFactory = operationFactory
_declarations = declarations
_localDeclarations = localDeclarations
End Sub
Protected Overrides Function CreateDeclarations() As ImmutableArray(Of IVariableDeclarationOperation)
Return _operationFactory.GetVariableDeclarationStatementVariables(_declarations)
Return _operationFactory.GetVariableDeclarationStatementVariables(_localDeclarations.Declarations)
End Function
End Class
......@@ -1126,28 +1092,24 @@ _operationFactory.CreateFromArray(Of BoundExpression, IOperation)(_boundForToLoo
Inherits LazyWhileLoopOperation
Private ReadOnly _operationFactory As VisualBasicOperationFactory
Private ReadOnly _condition As BoundNode
Private ReadOnly _body As BoundNode
Private ReadOnly _ignoredCondition As BoundNode
Private ReadOnly _conditionalLoop As IBoundConditionalLoop
Friend Sub New(operationFactory As VisualBasicOperationFactory, condition As BoundNode, body As BoundNode, ignoredCondition As BoundNode, locals As ImmutableArray(Of ILocalSymbol), continueLabel As ILabelSymbol, exitLabel As ILabelSymbol, conditionIsTop As Boolean, conditionIsUntil As Boolean, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
Friend Sub New(operationFactory As VisualBasicOperationFactory, conditionalLoop As IBoundConditionalLoop, locals As ImmutableArray(Of ILocalSymbol), continueLabel As ILabelSymbol, exitLabel As ILabelSymbol, conditionIsTop As Boolean, conditionIsUntil As Boolean, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
MyBase.New(locals, continueLabel, exitLabel, conditionIsTop, conditionIsUntil, semanticModel, syntax, type, constantValue, isImplicit)
_operationFactory = operationFactory
_condition = condition
_body = body
_ignoredCondition = ignoredCondition
_conditionalLoop = conditionalLoop
End Sub
Protected Overrides Function CreateCondition() As IOperation
Return _operationFactory.Create(_condition)
Return _operationFactory.Create(_conditionalLoop.Condition)
End Function
Protected Overrides Function CreateBody() As IOperation
Return _operationFactory.Create(_body)
Return _operationFactory.Create(_conditionalLoop.Body)
End Function
Protected Overrides Function CreateIgnoredCondition() As IOperation
Return _operationFactory.Create(_ignoredCondition)
Return _operationFactory.Create(_conditionalLoop.IgnoredCondition)
End Function
End Class
......@@ -1155,45 +1117,20 @@ _operationFactory.CreateFromArray(Of BoundExpression, IOperation)(_boundForToLoo
Inherits LazyWithOperation
Private ReadOnly _operationFactory As VisualBasicOperationFactory
Private ReadOnly _body As BoundNode
Private ReadOnly _value As BoundNode
Private ReadOnly _withStatement As BoundWithStatement
Friend Sub New(operationFactory As VisualBasicOperationFactory, body As BoundNode, value As BoundNode, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
Friend Sub New(operationFactory As VisualBasicOperationFactory, withStatement As BoundWithStatement, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
MyBase.New(semanticModel, syntax, type, constantValue, isImplicit)
_operationFactory = operationFactory
_body = body
_value = value
_withStatement = withStatement
End Sub
Protected Overrides Function CreateBody() As IOperation
Return _operationFactory.Create(_body)
Return _operationFactory.Create(_withStatement.Body)
End Function
Protected Overrides Function CreateValue() As IOperation
Return _operationFactory.Create(_value)
End Function
End Class
Friend NotInheritable Class VisualBasicLazyLocalFunctionOperation
Inherits LazyLocalFunctionOperation
Private ReadOnly _operationFactory As VisualBasicOperationFactory
Private ReadOnly _body As BoundNode
Private ReadOnly _ignoredBody As BoundNode
Friend Sub New(operationFactory As VisualBasicOperationFactory, body As BoundNode, ignoredBody As BoundNode, symbol As IMethodSymbol, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
MyBase.New(symbol, semanticModel, syntax, type, constantValue, isImplicit)
_operationFactory = operationFactory
_body = body
_ignoredBody = ignoredBody
End Sub
Protected Overrides Function CreateBody() As IBlockOperation
Return DirectCast(_operationFactory.Create(_body), IBlockOperation)
End Function
Protected Overrides Function CreateIgnoredBody() As IBlockOperation
Return DirectCast(_operationFactory.Create(_ignoredBody), IBlockOperation)
Return _operationFactory.Create(_withStatement.OriginalExpression)
End Function
End Class
......@@ -1201,16 +1138,16 @@ _operationFactory.CreateFromArray(Of BoundExpression, IOperation)(_boundForToLoo
Inherits LazyObjectOrCollectionInitializerOperation
Private ReadOnly _operationFactory As VisualBasicOperationFactory
Private ReadOnly _initializers As ImmutableArray(Of BoundExpression)
Private ReadOnly _objectOrCollectionInitializer As BoundObjectInitializerExpressionBase
Friend Sub New(operationFactory As VisualBasicOperationFactory, initializers As ImmutableArray(Of BoundExpression), semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
Friend Sub New(operationFactory As VisualBasicOperationFactory, objectOrCollectionInitializer As BoundObjectInitializerExpressionBase, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
MyBase.New(semanticModel, syntax, type, constantValue, isImplicit)
_operationFactory = operationFactory
_initializers = initializers
_objectOrCollectionInitializer = objectOrCollectionInitializer
End Sub
Protected Overrides Function CreateInitializers() As ImmutableArray(Of IOperation)
Return _operationFactory.CreateFromArray(Of BoundExpression, IOperation)(_initializers)
Return _operationFactory.CreateFromArray(Of BoundExpression, IOperation)(_objectOrCollectionInitializer.Initializers)
End Function
End Class
......@@ -1235,22 +1172,20 @@ _operationFactory.CreateFromArray(Of BoundExpression, IOperation)(_boundForToLoo
Inherits LazyAggregateQueryOperation
Private ReadOnly _operationFactory As VisualBasicOperationFactory
Private ReadOnly _group As BoundNode
Private ReadOnly _aggregation As BoundNode
Private ReadOnly _aggregateClause As BoundAggregateClause
Friend Sub New(operationFactory As VisualBasicOperationFactory, group As BoundNode, aggregation As BoundNode, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
Friend Sub New(operationFactory As VisualBasicOperationFactory, aggregateClause As BoundAggregateClause, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
MyBase.New(semanticModel, syntax, type, constantValue, isImplicit)
_operationFactory = operationFactory
_group = group
_aggregation = aggregation
_aggregateClause = aggregateClause
End Sub
Protected Overrides Function CreateGroup() As IOperation
Return _operationFactory.Create(_group)
Return _operationFactory.Create(_aggregateClause.CapturedGroupOpt)
End Function
Protected Overrides Function CreateAggregation() As IOperation
Return _operationFactory.Create(_aggregation)
Return _operationFactory.Create(_aggregateClause.UnderlyingExpression)
End Function
End Class
......@@ -1275,16 +1210,16 @@ _operationFactory.CreateFromArray(Of BoundExpression, IOperation)(_boundForToLoo
Inherits LazyReDimOperation
Private ReadOnly _operationFactory As VisualBasicOperationFactory
Private ReadOnly _clauses As ImmutableArray(Of BoundRedimClause)
Private ReadOnly _redimStatement As BoundRedimStatement
Friend Sub New(operationFactory As VisualBasicOperationFactory, clauses As ImmutableArray(Of BoundRedimClause), preserve As Boolean, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
Friend Sub New(operationFactory As VisualBasicOperationFactory, redimStatement As BoundRedimStatement, preserve As Boolean, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
MyBase.New(preserve, semanticModel, syntax, type, constantValue, isImplicit)
_operationFactory = operationFactory
_clauses = clauses
_redimStatement = redimStatement
End Sub
Protected Overrides Function CreateClauses() As ImmutableArray(Of IReDimClauseOperation)
Return _operationFactory.CreateFromArray(Of BoundRedimClause, IReDimClauseOperation)(_clauses)
Return _operationFactory.CreateFromArray(Of BoundRedimClause, IReDimClauseOperation)(_redimStatement.Clauses)
End Function
End Class
......@@ -1292,22 +1227,20 @@ _operationFactory.CreateFromArray(Of BoundExpression, IOperation)(_boundForToLoo
Inherits LazyReDimClauseOperation
Private ReadOnly _operationFactory As VisualBasicOperationFactory
Private ReadOnly _operand As BoundNode
Private ReadOnly _dimensionSizes As ImmutableArray(Of BoundExpression)
Private ReadOnly _redimClause As BoundRedimClause
Friend Sub New(operationFactory As VisualBasicOperationFactory, operand As BoundNode, dimensionSizes As ImmutableArray(Of BoundExpression), semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
Friend Sub New(operationFactory As VisualBasicOperationFactory, redimClause As BoundRedimClause, semanticModel As SemanticModel, syntax As SyntaxNode, type As ITypeSymbol, constantValue As [Optional](Of Object), isImplicit As Boolean)
MyBase.New(semanticModel, syntax, type, constantValue, isImplicit)
_operationFactory = operationFactory
_operand = operand
_dimensionSizes = dimensionSizes
_redimClause = redimClause
End Sub
Protected Overrides Function CreateOperand() As IOperation
Return _operationFactory.Create(_operand)
Return _operationFactory.Create(_redimClause.Operand)
End Function
Protected Overrides Function CreateDimensionSizes() As ImmutableArray(Of IOperation)
Return _operationFactory.CreateFromArray(Of BoundExpression, IOperation)(_dimensionSizes)
Return _operationFactory.CreateFromArray(Of BoundExpression, IOperation)(_redimClause.Indices)
End Function
End Class
End Namespace
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册