diff --git a/src/Compilers/CSharp/Portable/Binder/Binder_Query.cs b/src/Compilers/CSharp/Portable/Binder/Binder_Query.cs index 29b23a81c57a9852c153cdeef5747e2b2e0313fc..d084d71dee0bbf570b6794da290f42f716b71531 100644 --- a/src/Compilers/CSharp/Portable/Binder/Binder_Query.cs +++ b/src/Compilers/CSharp/Portable/Binder/Binder_Query.cs @@ -522,7 +522,7 @@ private static BoundExpression ExtractCastInvocation(BoundCall invocation) private UnboundLambda MakePairLambda(CSharpSyntaxNode node, QueryTranslationState state, RangeVariableSymbol x1, RangeVariableSymbol x2) { - Debug.Assert(SyntaxUtilities.IsQueryPairLambda(node)); + Debug.Assert(LambdaUtilities.IsQueryPairLambda(node)); LambdaBodyFactory bodyFactory = (LambdaSymbol lambdaSymbol, ref Binder lambdaBodyBinder, DiagnosticBag d) => { @@ -683,7 +683,7 @@ private UnboundLambda MakeQueryUnboundLambda(RangeVariableMap qvm, ImmutableArra private UnboundLambda MakeQueryUnboundLambda(CSharpSyntaxNode node, QueryUnboundLambdaState state) { - Debug.Assert(node is ExpressionSyntax || SyntaxUtilities.IsQueryPairLambda(node)); + Debug.Assert(node is ExpressionSyntax || LambdaUtilities.IsQueryPairLambda(node)); var lambda = new UnboundLambda(node, state, hasErrors: false) { WasCompilerGenerated = true }; state.SetUnboundLambda(lambda); return lambda; diff --git a/src/Compilers/CSharp/Portable/BoundTree/UnboundLambda.cs b/src/Compilers/CSharp/Portable/BoundTree/UnboundLambda.cs index 7874313a118551b8591bf6e8dad4110ff5174eca..b1ba43e75d5f230eaebcc9418fd87de51479a40e 100644 --- a/src/Compilers/CSharp/Portable/BoundTree/UnboundLambda.cs +++ b/src/Compilers/CSharp/Portable/BoundTree/UnboundLambda.cs @@ -49,7 +49,7 @@ public BoundLambda(CSharpSyntaxNode syntax, BoundBlock body, ImmutableArray - + @@ -893,4 +893,4 @@ - + \ No newline at end of file diff --git a/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/LambdaFrame.cs b/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/LambdaFrame.cs index ed52b534827616ba73f4bbc4aa5f7a69b6db2f28..5e0c68696acc30e4445fa00c8dff078bdf268404 100644 --- a/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/LambdaFrame.cs +++ b/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/LambdaFrame.cs @@ -82,7 +82,7 @@ private static void AssertIsClosureScopeSyntax(CSharpSyntaxNode syntaxOpt) return; } - if (SyntaxUtilities.IsClosureScope(syntaxOpt)) + if (LambdaUtilities.IsClosureScope(syntaxOpt)) { return; } diff --git a/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/LambdaRewriter.cs b/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/LambdaRewriter.cs index 1bf2e7fdba74a6fe1893ffdce24f4e6d1eeaff75..fd2ceeecb57745b5dce60730515c40fcaf58fd42 100644 --- a/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/LambdaRewriter.cs +++ b/src/Compilers/CSharp/Portable/Lowering/LambdaRewriter/LambdaRewriter.cs @@ -924,7 +924,7 @@ private void GetLambdaId(SyntaxNode syntax, ClosureKind closureKind, int closure lambdaOrLambdaBodySyntax = anonymousFunction.Body; isLambdaBody = true; } - else if (SyntaxUtilities.IsQueryPairLambda(syntax)) + else if (LambdaUtilities.IsQueryPairLambda(syntax)) { // "pair" query lambdas lambdaOrLambdaBodySyntax = syntax; @@ -938,7 +938,7 @@ private void GetLambdaId(SyntaxNode syntax, ClosureKind closureKind, int closure isLambdaBody = true; } - Debug.Assert(!isLambdaBody || SyntaxUtilities.IsLambdaBody(lambdaOrLambdaBodySyntax)); + Debug.Assert(!isLambdaBody || LambdaUtilities.IsLambdaBody(lambdaOrLambdaBodySyntax)); // determine lambda ordinal and calculate syntax offset: lambdaOrdinal = _lambdaDebugInfoBuilder.Count; diff --git a/src/Compilers/CSharp/Portable/Syntax/CSharpSyntaxNode.cs b/src/Compilers/CSharp/Portable/Syntax/CSharpSyntaxNode.cs index d3cdd9b970a3fdacbe4acecf520a1f1c9a8ff4b2..0224345ec64cefdbb56f00680f56645d1b5441ae 100644 --- a/src/Compilers/CSharp/Portable/Syntax/CSharpSyntaxNode.cs +++ b/src/Compilers/CSharp/Portable/Syntax/CSharpSyntaxNode.cs @@ -443,12 +443,12 @@ public new IEnumerable GetDiagnostics() internal sealed override SyntaxNode GetCorrespondingLambdaBody(SyntaxNode body) { - return SyntaxUtilities.GetCorrespondingLambdaBody(body, this); + return LambdaUtilities.GetCorrespondingLambdaBody(body, this); } internal override SyntaxNode GetLambda() { - return SyntaxUtilities.GetLambda(this); + return LambdaUtilities.GetLambda(this); } #region Directives diff --git a/src/Compilers/CSharp/Portable/Syntax/SyntaxUtilities.cs b/src/Compilers/CSharp/Portable/Syntax/LambdaUtilities.cs similarity index 99% rename from src/Compilers/CSharp/Portable/Syntax/SyntaxUtilities.cs rename to src/Compilers/CSharp/Portable/Syntax/LambdaUtilities.cs index fbbc9b84a64de1b45522bb07ed97cf9ab90daecc..ab6f0ec425ac4f80e2cc36aaef6d849360b4639c 100644 --- a/src/Compilers/CSharp/Portable/Syntax/SyntaxUtilities.cs +++ b/src/Compilers/CSharp/Portable/Syntax/LambdaUtilities.cs @@ -6,7 +6,7 @@ namespace Microsoft.CodeAnalysis.CSharp { - internal partial class SyntaxUtilities + internal static class LambdaUtilities { /// /// Returns true if the specified node represents a lambda. diff --git a/src/Compilers/CSharp/Portable/Syntax/SyntaxFacts.cs b/src/Compilers/CSharp/Portable/Syntax/SyntaxFacts.cs index 430ad0af7ca4406eb6ea18429ed2030cc9cac2b6..734470c21b54413b202815b3c27dabc2cd847567 100644 --- a/src/Compilers/CSharp/Portable/Syntax/SyntaxFacts.cs +++ b/src/Compilers/CSharp/Portable/Syntax/SyntaxFacts.cs @@ -371,7 +371,7 @@ internal static bool IsStatementExpression(CSharpSyntaxNode syntax) /// public static bool IsLambdaBody(SyntaxNode node) { - return SyntaxUtilities.IsLambdaBody(node); + return LambdaUtilities.IsLambdaBody(node); } } } \ No newline at end of file diff --git a/src/Compilers/VisualBasic/Portable/BasicCodeAnalysis.vbproj b/src/Compilers/VisualBasic/Portable/BasicCodeAnalysis.vbproj index db37caa6fd16d06b8b2e60ee4b924209339db485..f1a3c165a1b859f2acb87fe338a1c99f0ced168e 100644 --- a/src/Compilers/VisualBasic/Portable/BasicCodeAnalysis.vbproj +++ b/src/Compilers/VisualBasic/Portable/BasicCodeAnalysis.vbproj @@ -921,7 +921,7 @@ - + diff --git a/src/Compilers/VisualBasic/Portable/Binding/Binder_Query.vb b/src/Compilers/VisualBasic/Portable/Binding/Binder_Query.vb index fa888c7e2ad8e3d9a40a6af789ec67d0b4512e48..5f26ecfcde4041e10f8c29325e6a90e6b2cfcd47 100644 --- a/src/Compilers/VisualBasic/Portable/Binding/Binder_Query.vb +++ b/src/Compilers/VisualBasic/Portable/Binding/Binder_Query.vb @@ -307,7 +307,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic aggregate, source.RangeVariables) ' The lambda that will contain the nested query. - Dim letSelectorLambdaSymbol = Me.CreateQueryLambdaSymbol(SyntaxUtilities.GetAggregateLambdaBody(aggregate), + Dim letSelectorLambdaSymbol = Me.CreateQueryLambdaSymbol(LambdaUtilities.GetAggregateLambdaBody(aggregate), SynthesizedLambdaKind.AggregateQueryLambda, ImmutableArray.Create(letSelectorParam)) @@ -432,7 +432,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic aggregate, letOperator.RangeVariables) ' This lambda only contains non-user code. We associate it with the aggregate clause itself. - Debug.Assert(SyntaxUtilities.IsNonUserCodeQueryLambda(aggregate)) + Debug.Assert(LambdaUtilities.IsNonUserCodeQueryLambda(aggregate)) Dim selectSelectorLambdaSymbol = Me.CreateQueryLambdaSymbol(aggregate, SynthesizedLambdaKind.AggregateNonUserCodeQueryLambda, ImmutableArray.Create(selectSelectorParam)) @@ -603,7 +603,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic fromClauseSyntax, source.RangeVariables) ' An implicit selector is an identity (x => x) function that doesn't contain any user code. - SyntaxUtilities.IsNonUserCodeQueryLambda(fromClauseSyntax) + LambdaUtilities.IsNonUserCodeQueryLambda(fromClauseSyntax) Dim lambdaSymbol = Me.CreateQueryLambdaSymbol(fromClauseSyntax, SynthesizedLambdaKind.FromNonUserCodeQueryLambda, ImmutableArray.Create(param)) @@ -675,7 +675,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic source.CompoundVariableType, clauseSyntax, source.RangeVariables) - Dim lambdaSymbol = Me.CreateQueryLambdaSymbol(SyntaxUtilities.GetSelectLambdaBody(clauseSyntax), + Dim lambdaSymbol = Me.CreateQueryLambdaSymbol(LambdaUtilities.GetSelectLambdaBody(clauseSyntax), SynthesizedLambdaKind.SelectQueryLambda, ImmutableArray.Create(param)) @@ -821,7 +821,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic source.CompoundVariableType, variable, source.RangeVariables) - Dim lambdaSymbol = Me.CreateQueryLambdaSymbol(SyntaxUtilities.GetLetVariableLambdaBody(variable), + Dim lambdaSymbol = Me.CreateQueryLambdaSymbol(LambdaUtilities.GetLetVariableLambdaBody(variable), SynthesizedLambdaKind.LetVariableQueryLambda, ImmutableArray.Create(param)) @@ -1053,7 +1053,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic source.CompoundVariableType, variable, source.RangeVariables) - Dim manySelectorLambdaSymbol = Me.CreateQueryLambdaSymbol(SyntaxUtilities.GetFromOrAggregateVariableLambdaBody(variable), + Dim manySelectorLambdaSymbol = Me.CreateQueryLambdaSymbol(LambdaUtilities.GetFromOrAggregateVariableLambdaBody(variable), SynthesizedLambdaKind.FromOrAggregateVariableQueryLambda, ImmutableArray.Create(manySelectorParam)) @@ -1248,29 +1248,29 @@ Namespace Microsoft.CodeAnalysis.VisualBasic End Select lambdaSyntax = clauseSyntax - Debug.Assert(SyntaxUtilities.IsNonUserCodeQueryLambda(lambdaSyntax)) + Debug.Assert(LambdaUtilities.IsNonUserCodeQueryLambda(lambdaSyntax)) Else Select Case absorbNextOperator.Kind Case SyntaxKind.AggregateClause Dim firstVariable = DirectCast(absorbNextOperator, AggregateClauseSyntax).Variables.First - lambdaSyntax = SyntaxUtilities.GetFromOrAggregateVariableLambdaBody(firstVariable) + lambdaSyntax = LambdaUtilities.GetFromOrAggregateVariableLambdaBody(firstVariable) lambdaKind = SynthesizedLambdaKind.AggregateQueryLambda Case SyntaxKind.LetClause Dim firstVariable = DirectCast(absorbNextOperator, LetClauseSyntax).Variables.First - lambdaSyntax = SyntaxUtilities.GetLetVariableLambdaBody(firstVariable) + lambdaSyntax = LambdaUtilities.GetLetVariableLambdaBody(firstVariable) lambdaKind = SynthesizedLambdaKind.LetVariableQueryLambda Case SyntaxKind.SelectClause Dim selectClause = DirectCast(absorbNextOperator, SelectClauseSyntax) - lambdaSyntax = SyntaxUtilities.GetSelectLambdaBody(selectClause) + lambdaSyntax = LambdaUtilities.GetSelectLambdaBody(selectClause) lambdaKind = SynthesizedLambdaKind.SelectQueryLambda Case Else Throw ExceptionUtilities.UnexpectedValue(absorbNextOperator.Kind) End Select - Debug.Assert(SyntaxUtilities.IsLambdaBody(lambdaSyntax)) + Debug.Assert(LambdaUtilities.IsLambdaBody(lambdaSyntax)) End If End Sub @@ -1920,7 +1920,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic source.CompoundVariableType, groupBy, source.RangeVariables) - Dim itemsLambdaSymbol = Me.CreateQueryLambdaSymbol(SyntaxUtilities.GetGroupByItemsLambdaBody(groupBy), + Dim itemsLambdaSymbol = Me.CreateQueryLambdaSymbol(LambdaUtilities.GetGroupByItemsLambdaBody(groupBy), SynthesizedLambdaKind.GroupByItemsQueryLambda, ImmutableArray.Create(itemsParam)) @@ -1964,7 +1964,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic source.CompoundVariableType, groupBy, source.RangeVariables) - Dim keysLambdaSymbol = Me.CreateQueryLambdaSymbol(SyntaxUtilities.GetGroupByKeysLambdaBody(groupBy), + Dim keysLambdaSymbol = Me.CreateQueryLambdaSymbol(LambdaUtilities.GetGroupByKeysLambdaBody(groupBy), SynthesizedLambdaKind.GroupByKeysQueryLambda, ImmutableArray.Create(keysParam)) @@ -2171,7 +2171,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Dim groupParam As BoundLambdaParameterSymbol = CreateQueryLambdaParameterSymbol(StringConstants.ItAnonymous, 1, groupType, clauseSyntax) - Debug.Assert(SyntaxUtilities.IsNonUserCodeQueryLambda(clauseSyntax)) + Debug.Assert(LambdaUtilities.IsNonUserCodeQueryLambda(clauseSyntax)) Dim intoLambdaSymbol = Me.CreateQueryLambdaSymbol(clauseSyntax, SynthesizedLambdaKind.GroupNonUserCodeQueryLambda, ImmutableArray.Create(keyParam, groupParam)) @@ -2370,7 +2370,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic source.CompoundVariableType, condition, source.RangeVariables) - Debug.Assert(SyntaxUtilities.IsLambdaBody(condition)) + Debug.Assert(LambdaUtilities.IsLambdaBody(condition)) Dim lambdaSymbol = Me.CreateQueryLambdaSymbol(condition, SynthesizedLambdaKind.FilterConditionQueryLambda, ImmutableArray.Create(param)) @@ -2621,7 +2621,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic source.CompoundVariableType, ordering.Expression, source.RangeVariables) - Dim lambdaSymbol = Me.CreateQueryLambdaSymbol(SyntaxUtilities.GetOrderingLambdaBody(ordering), + Dim lambdaSymbol = Me.CreateQueryLambdaSymbol(LambdaUtilities.GetOrderingLambdaBody(ordering), SynthesizedLambdaKind.OrderingQueryLambda, ImmutableArray.Create(param)) @@ -3340,7 +3340,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic outer.CompoundVariableType, join, outer.RangeVariables) - Dim outerKeyLambdaSymbol = parentBinder.CreateQueryLambdaSymbol(SyntaxUtilities.GetJoinLeftLambdaBody(join), + Dim outerKeyLambdaSymbol = parentBinder.CreateQueryLambdaSymbol(LambdaUtilities.GetJoinLeftLambdaBody(join), SynthesizedLambdaKind.JoinLeftQueryLambda, ImmutableArray.Create(outerKeyParam)) outerKeyBinder = New QueryLambdaBinder(outerKeyLambdaSymbol, joinSelectorRangeVariables) @@ -3350,7 +3350,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic inner.CompoundVariableType, join, inner.RangeVariables) - Dim innerKeyLambdaSymbol = parentBinder.CreateQueryLambdaSymbol(SyntaxUtilities.GetJoinRightLambdaBody(join), + Dim innerKeyLambdaSymbol = parentBinder.CreateQueryLambdaSymbol(LambdaUtilities.GetJoinRightLambdaBody(join), SynthesizedLambdaKind.JoinRightQueryLambda, ImmutableArray.Create(innerKeyParam)) @@ -3995,7 +3995,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic ' its special binding and Lookup/LookupNames behavior. Dim aggregationLambdaSymbol = Me.ContainingBinder.CreateQueryLambdaSymbol( - If(SyntaxUtilities.GetAggregationLambdaBody(functionAggregationSyntax), functionAggregationSyntax), + If(LambdaUtilities.GetAggregationLambdaBody(functionAggregationSyntax), functionAggregationSyntax), SynthesizedLambdaKind.AggregationQueryLambda, ImmutableArray.Create(aggregationParam)) @@ -4342,7 +4342,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic variableType, syntax.AsClause) - Debug.Assert(SyntaxUtilities.IsNonUserCodeQueryLambda(syntax.AsClause)) + Debug.Assert(LambdaUtilities.IsNonUserCodeQueryLambda(syntax.AsClause)) Dim lambdaSymbol = Me.CreateQueryLambdaSymbol(syntax.AsClause, SynthesizedLambdaKind.ConversionNonUserCodeQueryLambda, ImmutableArray.Create(param)) diff --git a/src/Compilers/VisualBasic/Portable/BoundTree/BoundLambda.vb b/src/Compilers/VisualBasic/Portable/BoundTree/BoundLambda.vb index 694ac8e0b4ebacf5488868a49ba28e2be0998aed..c38efce9a16dca02f8a003e514ad07414a1e16a1 100644 --- a/src/Compilers/VisualBasic/Portable/BoundTree/BoundLambda.vb +++ b/src/Compilers/VisualBasic/Portable/BoundTree/BoundLambda.vb @@ -36,9 +36,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Debug.Assert( TypeOf Syntax Is LambdaExpressionSyntax OrElse - SyntaxUtilities.IsLambdaBody(Syntax) OrElse + LambdaUtilities.IsLambdaBody(Syntax) OrElse Syntax.IsKind(SyntaxKind.AddressOfExpression) OrElse - SyntaxUtilities.IsNonUserCodeQueryLambda(Syntax) OrElse + LambdaUtilities.IsNonUserCodeQueryLambda(Syntax) OrElse (DelegateRelaxation And ConversionKind.DelegateRelaxationLevelMask) <> ConversionKind.DelegateRelaxationLevelNone) End Sub #End If diff --git a/src/Compilers/VisualBasic/Portable/Lowering/LambdaRewriter/LambdaFrame.vb b/src/Compilers/VisualBasic/Portable/Lowering/LambdaRewriter/LambdaFrame.vb index 22267542a5a0d6ea4ebdace0a8aafd838027f739..e5788afec09717d4c974343f45c6abbaebcd5c6a 100644 --- a/src/Compilers/VisualBasic/Portable/Lowering/LambdaRewriter/LambdaFrame.vb +++ b/src/Compilers/VisualBasic/Portable/Lowering/LambdaRewriter/LambdaFrame.vb @@ -114,7 +114,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Return End If - If SyntaxUtilities.IsClosureScope(syntaxOpt) Then + If LambdaUtilities.IsClosureScope(syntaxOpt) Then Return End If diff --git a/src/Compilers/VisualBasic/Portable/Lowering/LambdaRewriter/LambdaRewriter.vb b/src/Compilers/VisualBasic/Portable/Lowering/LambdaRewriter/LambdaRewriter.vb index 316f92192a18d98b456b88fe1fe0e51209681f19..e2a7ab15c18b6b5c6a007533064e0f88946b320d 100644 --- a/src/Compilers/VisualBasic/Portable/Lowering/LambdaRewriter/LambdaRewriter.vb +++ b/src/Compilers/VisualBasic/Portable/Lowering/LambdaRewriter/LambdaRewriter.vb @@ -926,14 +926,14 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Dim lambdaExpression = TryCast(syntax, LambdaExpressionSyntax) If lambdaExpression IsNot Nothing Then - lambdaOrLambdaBodySyntax = SyntaxUtilities.GetLambdaExpressionLambdaBody(lambdaExpression) + lambdaOrLambdaBodySyntax = LambdaUtilities.GetLambdaExpressionLambdaBody(lambdaExpression) isLambdaBody = True ElseIf syntax.IsKind(SyntaxKind.AddressOfExpression) Then ' Late-bound AddressOf operator creates a display class, unlike delegate relaxations. ' EnC is not supported in this case. lambdaOrLambdaBodySyntax = syntax isLambdaBody = False - ElseIf SyntaxUtilities.IsNonUserCodeQueryLambda(syntax) + ElseIf LambdaUtilities.IsNonUserCodeQueryLambda(syntax) lambdaOrLambdaBodySyntax = syntax isLambdaBody = False Else @@ -942,7 +942,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic isLambdaBody = True End If - Debug.Assert(Not isLambdaBody OrElse SyntaxUtilities.IsLambdaBody(lambdaOrLambdaBodySyntax)) + Debug.Assert(Not isLambdaBody OrElse LambdaUtilities.IsLambdaBody(lambdaOrLambdaBodySyntax)) ' determine lambda ordinal and calculate syntax offset lambdaOrdinal = _lambdaDebugInfoBuilder.Count diff --git a/src/Compilers/VisualBasic/Portable/Syntax/SyntaxUtilities.vb b/src/Compilers/VisualBasic/Portable/Syntax/LambdaUtilities.vb similarity index 99% rename from src/Compilers/VisualBasic/Portable/Syntax/SyntaxUtilities.vb rename to src/Compilers/VisualBasic/Portable/Syntax/LambdaUtilities.vb index 3daf85d526872f17194a005a9f566f7b588cf7af..42ca18cb3a0b5b268785a71aeb9907a0e7f372e6 100644 --- a/src/Compilers/VisualBasic/Portable/Syntax/SyntaxUtilities.vb +++ b/src/Compilers/VisualBasic/Portable/Syntax/LambdaUtilities.vb @@ -5,7 +5,7 @@ Imports System.Runtime.InteropServices Namespace Microsoft.CodeAnalysis.VisualBasic - Friend NotInheritable Class SyntaxUtilities + Friend NotInheritable Class LambdaUtilities ''' ''' Returns true if the specified node represents a lambda. diff --git a/src/Compilers/VisualBasic/Portable/Syntax/VisualBasicSyntaxNode.vb b/src/Compilers/VisualBasic/Portable/Syntax/VisualBasicSyntaxNode.vb index 19312f27d17868d82a3bb0f945303d43115d6771..5d8468f760e898e9cd84909db2ca2717f9d70ffd 100644 --- a/src/Compilers/VisualBasic/Portable/Syntax/VisualBasicSyntaxNode.vb +++ b/src/Compilers/VisualBasic/Portable/Syntax/VisualBasicSyntaxNode.vb @@ -678,11 +678,11 @@ Namespace Microsoft.CodeAnalysis.VisualBasic End Function Friend Overrides Function GetCorrespondingLambdaBody(body As SyntaxNode) As SyntaxNode - Return SyntaxUtilities.GetCorrespondingLambdaBody(body, Me) + Return LambdaUtilities.GetCorrespondingLambdaBody(body, Me) End Function Friend Overrides Function GetLambda() As SyntaxNode - Return SyntaxUtilities.GetLambda(Me) + Return LambdaUtilities.GetLambda(Me) End Function End Class End Namespace diff --git a/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinueClosureTests.vb b/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinueClosureTests.vb index 81bcdf4fe34bf4e5bbaa8c0dde938454f8359277..1186b289dc8fee3e9c983b4ee6ee94b67fba7f68 100644 --- a/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinueClosureTests.vb +++ b/src/Compilers/VisualBasic/Test/Emit/Emit/EditAndContinueClosureTests.vb @@ -766,7 +766,7 @@ End Class ''' of the same kind is mapped to a new node that belongs to the lambda body but is ''' different from the one that represents the new body. ''' - ''' This handling is done in + ''' This handling is done in ''' Public Sub SelectClauseCrossMatch() @@ -829,7 +829,7 @@ End Class ''' of the same kind is mapped to a new node that belongs to the lambda body but is ''' different from the one that represents the new body. ''' - ''' This handling is done in + ''' This handling is done in ''' Public Sub JoinClauseCrossMatch() diff --git a/src/Features/CSharp/CSharpFeatures.csproj b/src/Features/CSharp/CSharpFeatures.csproj index 0000f7ce7dcd138d78fc49d51d7e92ea6b401da0..b7066620eb0146b81a00f35971b558bf4e2f007b 100644 --- a/src/Features/CSharp/CSharpFeatures.csproj +++ b/src/Features/CSharp/CSharpFeatures.csproj @@ -84,8 +84,8 @@ - - InternalUtilities\SyntaxUtilities.cs + + InternalUtilities\LambdaUtilities.cs diff --git a/src/Features/CSharp/EditAndContinue/CSharpEditAndContinueAnalyzer.cs b/src/Features/CSharp/EditAndContinue/CSharpEditAndContinueAnalyzer.cs index 2df2dcbc1914080a22180ffac52d27fcbcbbd65f..f2d6dac31d93e505765e2cd32e1b75bfb0544ae1 100644 --- a/src/Features/CSharp/EditAndContinue/CSharpEditAndContinueAnalyzer.cs +++ b/src/Features/CSharp/EditAndContinue/CSharpEditAndContinueAnalyzer.cs @@ -16,7 +16,6 @@ using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Text; using Roslyn.Utilities; -using CompilerSyntaxUtilities = Microsoft.CodeAnalysis.CSharp.SyntaxUtilities; namespace Microsoft.CodeAnalysis.CSharp.EditAndContinue { @@ -290,7 +289,7 @@ protected override SyntaxNode FindStatementAndPartner(SyntaxNode declarationBody partnerOpt = null; } - while (node != declarationBody && !StatementSyntaxComparer.HasLabel(node) && !CompilerSyntaxUtilities.IsLambdaBodyStatementOrExpression(node)) + while (node != declarationBody && !StatementSyntaxComparer.HasLabel(node) && !LambdaUtilities.IsLambdaBodyStatementOrExpression(node)) { node = node.Parent; if (partnerOpt != null) @@ -389,7 +388,7 @@ private static TextSpan GetActiveSpan(ForEachStatementSyntax node, ForEachPart p internal override bool IsClosureScope(SyntaxNode node) { - return CompilerSyntaxUtilities.IsClosureScope(node); + return LambdaUtilities.IsClosureScope(node); } protected override SyntaxNode FindEnclosingLambdaBody(SyntaxNode containerOpt, SyntaxNode node) @@ -399,7 +398,7 @@ protected override SyntaxNode FindEnclosingLambdaBody(SyntaxNode containerOpt, S while (node != root) { SyntaxNode body; - if (CompilerSyntaxUtilities.IsLambdaBodyStatementOrExpression(node, out body)) + if (LambdaUtilities.IsLambdaBodyStatementOrExpression(node, out body)) { return body; } @@ -417,7 +416,7 @@ protected override SyntaxList GetLambdaBodyExpressionsAndStatements( protected override SyntaxNode GetPartnerLambdaBody(SyntaxNode oldBody, SyntaxNode newLambda) { - return CompilerSyntaxUtilities.GetCorrespondingLambdaBody(oldBody, newLambda); + return LambdaUtilities.GetCorrespondingLambdaBody(oldBody, newLambda); } protected override Match ComputeTopLevelMatch(SyntaxNode oldCompilationUnit, SyntaxNode newCompilationUnit) @@ -880,22 +879,22 @@ private static bool IsGetterToExpressionBodyTransformation(EditKind editKind, Sy internal override bool ContainsLambda(SyntaxNode declaration) { - return declaration.DescendantNodes().Any(CompilerSyntaxUtilities.IsLambda); + return declaration.DescendantNodes().Any(LambdaUtilities.IsLambda); } internal override bool IsLambda(SyntaxNode node) { - return CompilerSyntaxUtilities.IsLambda(node); + return LambdaUtilities.IsLambda(node); } internal override bool TryGetLambdaBodies(SyntaxNode node, out SyntaxNode body1, out SyntaxNode body2) { - return CompilerSyntaxUtilities.TryGetLambdaBodies(node, out body1, out body2); + return LambdaUtilities.TryGetLambdaBodies(node, out body1, out body2); } internal override SyntaxNode GetLambda(SyntaxNode lambdaBody) { - return CompilerSyntaxUtilities.GetLambda(lambdaBody); + return LambdaUtilities.GetLambda(lambdaBody); } #endregion @@ -2613,7 +2612,7 @@ protected override List GetExceptionHandlingAncestors(SyntaxNode nod } // stop at lambda: - if (CompilerSyntaxUtilities.IsLambda(node)) + if (LambdaUtilities.IsLambda(node)) { return result; } @@ -2776,7 +2775,7 @@ private static SyntaxNode FindContainingStatementPart(SyntaxNode node) return node; } - if (CompilerSyntaxUtilities.IsLambdaBodyStatementOrExpression(node)) + if (LambdaUtilities.IsLambdaBodyStatementOrExpression(node)) { return node; } diff --git a/src/Features/CSharp/EditAndContinue/StatementSyntaxComparer.cs b/src/Features/CSharp/EditAndContinue/StatementSyntaxComparer.cs index 749b2abf1797671ef64ba9f08bad176c3512e8c1..50064d1941b364ac6258a8b9f80308213ed3b69b 100644 --- a/src/Features/CSharp/EditAndContinue/StatementSyntaxComparer.cs +++ b/src/Features/CSharp/EditAndContinue/StatementSyntaxComparer.cs @@ -5,7 +5,6 @@ using System.Diagnostics; using Microsoft.CodeAnalysis.CSharp.Syntax; using Roslyn.Utilities; -using CompilerSyntaxUtilities = Microsoft.CodeAnalysis.CSharp.SyntaxUtilities; namespace Microsoft.CodeAnalysis.CSharp.EditAndContinue { @@ -59,7 +58,7 @@ private IEnumerable EnumerateNonRootChildren(SyntaxNode node) { foreach (var child in node.ChildNodes()) { - if (CompilerSyntaxUtilities.IsLambdaBodyStatementOrExpression(child)) + if (LambdaUtilities.IsLambdaBodyStatementOrExpression(child)) { continue; } @@ -105,7 +104,7 @@ private IEnumerable EnumerateRootChildren(SyntaxNode root) private bool DescendIntoChildren(SyntaxNode node) { - return !CompilerSyntaxUtilities.IsLambdaBodyStatementOrExpression(node) && !HasLabel(node); + return !LambdaUtilities.IsLambdaBodyStatementOrExpression(node) && !HasLabel(node); } protected internal sealed override IEnumerable GetDescendants(SyntaxNode node) @@ -125,9 +124,9 @@ protected internal sealed override IEnumerable GetDescendants(Syntax } // TODO: avoid allocation of closure - foreach (var descendant in node.DescendantNodes(descendIntoChildren: c => !IsLeaf(c) && (c == node || !CompilerSyntaxUtilities.IsLambdaBodyStatementOrExpression(c)))) + foreach (var descendant in node.DescendantNodes(descendIntoChildren: c => !IsLeaf(c) && (c == node || !LambdaUtilities.IsLambdaBodyStatementOrExpression(c)))) { - if (!CompilerSyntaxUtilities.IsLambdaBodyStatementOrExpression(descendant) && HasLabel(descendant)) + if (!LambdaUtilities.IsLambdaBodyStatementOrExpression(descendant) && HasLabel(descendant)) { yield return descendant; } diff --git a/src/Features/CSharp/EditAndContinue/SyntaxUtilities.cs b/src/Features/CSharp/EditAndContinue/SyntaxUtilities.cs index 9d856cc370ca43bfe83fac16207764487a5161b8..f63cf2cc288d58cc3c4419c068b2d35e4a4d224f 100644 --- a/src/Features/CSharp/EditAndContinue/SyntaxUtilities.cs +++ b/src/Features/CSharp/EditAndContinue/SyntaxUtilities.cs @@ -6,7 +6,6 @@ using Microsoft.CodeAnalysis.CSharp.Extensions; using Microsoft.CodeAnalysis.CSharp.Syntax; using Roslyn.Utilities; -using CompilerSyntaxUtilities = Microsoft.CodeAnalysis.CSharp.SyntaxUtilities; namespace Microsoft.CodeAnalysis.CSharp.EditAndContinue { @@ -274,7 +273,7 @@ public static bool IsAsyncMethodOrLambda(SyntaxNode declaration) public static ImmutableArray GetAwaitExpressions(SyntaxNode body) { // skip lambda bodies: - return ImmutableArray.CreateRange(body.DescendantNodesAndSelf(CompilerSyntaxUtilities.IsNotLambda).Where(n => n.IsKind(SyntaxKind.AwaitExpression))); + return ImmutableArray.CreateRange(body.DescendantNodesAndSelf(LambdaUtilities.IsNotLambda).Where(n => n.IsKind(SyntaxKind.AwaitExpression))); } public static ImmutableArray GetYieldStatements(SyntaxNode body) diff --git a/src/Features/VisualBasic/BasicFeatures.vbproj b/src/Features/VisualBasic/BasicFeatures.vbproj index d4462279f79a2617dad805263b813d2cfe00bf7f..fdc35865c0efd8b0d30b111bd108a1b8aa5fb812 100644 --- a/src/Features/VisualBasic/BasicFeatures.vbproj +++ b/src/Features/VisualBasic/BasicFeatures.vbproj @@ -118,8 +118,8 @@ - - InternalUtilities\SyntaxUtilities.vb + + InternalUtilities\LambdaUtilities.vb diff --git a/src/Features/VisualBasic/EditAndContinue/StatementSyntaxComparer.vb b/src/Features/VisualBasic/EditAndContinue/StatementSyntaxComparer.vb index 5b9280469bb8f10a5417d9307cc2f3f10f0dd460..e2e8908bb1889fac5ce3d0e79b4313d4acf72f6f 100644 --- a/src/Features/VisualBasic/EditAndContinue/StatementSyntaxComparer.vb +++ b/src/Features/VisualBasic/EditAndContinue/StatementSyntaxComparer.vb @@ -2,7 +2,6 @@ Imports System.Runtime.InteropServices Imports Microsoft.CodeAnalysis.VisualBasic.Syntax -Imports CompilerSyntaxUtilities = Microsoft.CodeAnalysis.VisualBasic.SyntaxUtilities Namespace Microsoft.CodeAnalysis.VisualBasic.EditAndContinue @@ -75,7 +74,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.EditAndContinue For Each child In node.ChildNodes() - If CompilerSyntaxUtilities.IsLambdaBodyStatementOrExpression(child) Then + If LambdaUtilities.IsLambdaBodyStatementOrExpression(child) Then Continue For End If @@ -103,17 +102,17 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.EditAndContinue End If ' TODO: avoid allocation of closure - For Each descendant In rootChild.DescendantNodes(descendIntoChildren:=Function(c) Not IsLeaf(c) AndAlso (c Is rootChild OrElse Not CompilerSyntaxUtilities.IsLambdaBodyStatementOrExpression(c))) - If Not CompilerSyntaxUtilities.IsLambdaBodyStatementOrExpression(descendant) AndAlso HasLabel(descendant) Then + For Each descendant In rootChild.DescendantNodes(descendIntoChildren:=Function(c) Not IsLeaf(c) AndAlso (c Is rootChild OrElse Not LambdaUtilities.IsLambdaBodyStatementOrExpression(c))) + If Not LambdaUtilities.IsLambdaBodyStatementOrExpression(descendant) AndAlso HasLabel(descendant) Then Yield descendant End If Next Next Else ' TODO: avoid allocation of closure - Dim descendants = node.DescendantNodes(descendIntoChildren:=Function(c) Not IsLeaf(c) AndAlso (c Is node OrElse Not CompilerSyntaxUtilities.IsLambdaBodyStatementOrExpression(c))) + Dim descendants = node.DescendantNodes(descendIntoChildren:=Function(c) Not IsLeaf(c) AndAlso (c Is node OrElse Not LambdaUtilities.IsLambdaBodyStatementOrExpression(c))) For Each descendant In descendants - If Not CompilerSyntaxUtilities.IsLambdaBodyStatementOrExpression(descendant) AndAlso HasLabel(descendant) Then + If Not LambdaUtilities.IsLambdaBodyStatementOrExpression(descendant) AndAlso HasLabel(descendant) Then Yield descendant End If Next @@ -121,7 +120,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.EditAndContinue End Function Private Function DescendIntoChildren(node As SyntaxNode) As Boolean - Return Not CompilerSyntaxUtilities.IsLambdaBodyStatementOrExpression(node) AndAlso Not HasLabel(node) + Return Not LambdaUtilities.IsLambdaBodyStatementOrExpression(node) AndAlso Not HasLabel(node) End Function #End Region diff --git a/src/Features/VisualBasic/EditAndContinue/SyntaxUtilities.vb b/src/Features/VisualBasic/EditAndContinue/SyntaxUtilities.vb index 3c3682401cc8da604ffc93d28c3943158827eb6f..282796affcf0c2f4fa10f4a240febacbfc3f100f 100644 --- a/src/Features/VisualBasic/EditAndContinue/SyntaxUtilities.vb +++ b/src/Features/VisualBasic/EditAndContinue/SyntaxUtilities.vb @@ -4,14 +4,13 @@ Imports System.Collections.Immutable Imports System.Runtime.CompilerServices Imports System.Runtime.InteropServices Imports Microsoft.CodeAnalysis.VisualBasic.Syntax -Imports CompilerSyntaxUtilities = Microsoft.CodeAnalysis.VisualBasic.SyntaxUtilities Namespace Microsoft.CodeAnalysis.VisualBasic.EditAndContinue Friend NotInheritable Class SyntaxUtilities Public Shared Sub AssertIsBody(syntax As SyntaxNode, allowLambda As Boolean) ' lambda/query - If CompilerSyntaxUtilities.IsLambdaBody(syntax) Then + If LambdaUtilities.IsLambdaBody(syntax) Then Debug.Assert(allowLambda) Debug.Assert(TypeOf syntax Is ExpressionSyntax OrElse TypeOf syntax Is LambdaHeaderSyntax) Return @@ -152,7 +151,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.EditAndContinue Public Shared Function GetAwaitExpressions(body As SyntaxNode) As ImmutableArray(Of SyntaxNode) ' skip lambda bodies - Return ImmutableArray.CreateRange(body.DescendantNodes(AddressOf CompilerSyntaxUtilities.IsNotLambda). + Return ImmutableArray.CreateRange(body.DescendantNodes(AddressOf LambdaUtilities.IsNotLambda). Where(Function(n) n.IsKind(SyntaxKind.AwaitExpression))) End Function diff --git a/src/Features/VisualBasic/EditAndContinue/VisualBasicEditAndContinueAnalyzer.vb b/src/Features/VisualBasic/EditAndContinue/VisualBasicEditAndContinueAnalyzer.vb index 638fda8b3bc4805f679251864c08ff47b65917c3..02873cab2f6a2ad074fcbf4acc93f8e0b1967ddd 100644 --- a/src/Features/VisualBasic/EditAndContinue/VisualBasicEditAndContinueAnalyzer.vb +++ b/src/Features/VisualBasic/EditAndContinue/VisualBasicEditAndContinueAnalyzer.vb @@ -10,7 +10,6 @@ Imports Microsoft.CodeAnalysis.Host Imports Microsoft.CodeAnalysis.Host.Mef Imports Microsoft.CodeAnalysis.Text Imports Microsoft.CodeAnalysis.VisualBasic.Syntax -Imports CompilerSyntaxUtilities = Microsoft.CodeAnalysis.VisualBasic.SyntaxUtilities Namespace Microsoft.CodeAnalysis.VisualBasic.EditAndContinue @@ -423,7 +422,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.EditAndContinue While node IsNot declarationBody AndAlso Not StatementSyntaxComparer.HasLabel(node) AndAlso - Not CompilerSyntaxUtilities.IsLambdaBodyStatementOrExpression(node) + Not LambdaUtilities.IsLambdaBodyStatementOrExpression(node) node = node.Parent If partnerOpt IsNot Nothing Then @@ -449,7 +448,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.EditAndContinue End Function Friend Overrides Function IsClosureScope(node As SyntaxNode) As Boolean - Return CompilerSyntaxUtilities.IsClosureScope(node) + Return LambdaUtilities.IsClosureScope(node) End Function Protected Overrides Function FindEnclosingLambdaBody(containerOpt As SyntaxNode, node As SyntaxNode) As SyntaxNode @@ -457,7 +456,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.EditAndContinue While node IsNot root Dim body As SyntaxNode = Nothing - If CompilerSyntaxUtilities.IsLambdaBodyStatementOrExpression(node, body) Then + If LambdaUtilities.IsLambdaBodyStatementOrExpression(node, body) Then Return body End If @@ -468,7 +467,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.EditAndContinue End Function Protected Overrides Function GetPartnerLambdaBody(oldBody As SyntaxNode, newLambda As SyntaxNode) As SyntaxNode - Return CompilerSyntaxUtilities.GetCorrespondingLambdaBody(oldBody, newLambda) + Return LambdaUtilities.GetCorrespondingLambdaBody(oldBody, newLambda) End Function Protected Overrides Function ComputeTopLevelMatch(oldCompilationUnit As SyntaxNode, newCompilationUnit As SyntaxNode) As Match(Of SyntaxNode) @@ -931,23 +930,23 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.EditAndContinue End Function Friend Overrides Function ContainsLambda(declaration As SyntaxNode) As Boolean - Return declaration.DescendantNodes().Any(AddressOf CompilerSyntaxUtilities.IsLambda) + Return declaration.DescendantNodes().Any(AddressOf LambdaUtilities.IsLambda) End Function Friend Overrides Function IsLambda(node As SyntaxNode) As Boolean - Return CompilerSyntaxUtilities.IsLambda(node) + Return LambdaUtilities.IsLambda(node) End Function Friend Overrides Function TryGetLambdaBodies(node As SyntaxNode, ByRef body1 As SyntaxNode, ByRef body2 As SyntaxNode) As Boolean - Return CompilerSyntaxUtilities.TryGetLambdaBodies(node, body1, body2) + Return LambdaUtilities.TryGetLambdaBodies(node, body1, body2) End Function Friend Overrides Function GetLambda(lambdaBody As SyntaxNode) As SyntaxNode - Return CompilerSyntaxUtilities.GetLambda(lambdaBody) + Return LambdaUtilities.GetLambda(lambdaBody) End Function Protected Overrides Function GetLambdaBodyExpressionsAndStatements(lambdaBody As SyntaxNode) As SyntaxList(Of SyntaxNode) - Return CompilerSyntaxUtilities.GetLambdaBodyExpressionsAndStatements(lambdaBody) + Return LambdaUtilities.GetLambdaBodyExpressionsAndStatements(lambdaBody) End Function #End Region @@ -2694,7 +2693,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.EditAndContinue End Select ' stop at lambda - If CompilerSyntaxUtilities.IsLambda(node) Then + If LambdaUtilities.IsLambda(node) Then Exit While End If @@ -2813,7 +2812,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.EditAndContinue Return node End Select - If CompilerSyntaxUtilities.IsLambdaBodyStatementOrExpression(node) Then + If LambdaUtilities.IsLambdaBodyStatementOrExpression(node) Then Return node End If