From 9bd67ccc52816668127addcd2f7479ad3943b7b8 Mon Sep 17 00:00:00 2001 From: Manish Vasani Date: Mon, 3 Jul 2017 10:42:11 -0700 Subject: [PATCH] Address some more review feedback and fix one more break. --- .../CSharpOperationFactory_Methods.cs | 3 +- .../Semantic/FlowAnalysis/FlowTestBase.cs | 8 ++--- .../Test/Utilities/CSharp/CSharpTestBase.cs | 32 ++++++++++++++----- 3 files changed, 30 insertions(+), 13 deletions(-) diff --git a/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory_Methods.cs b/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory_Methods.cs index 83ab6572650..b02a1ceb0e4 100644 --- a/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory_Methods.cs +++ b/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory_Methods.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using System; using System.Collections.Immutable; using System.Diagnostics; using System.Linq; @@ -113,7 +114,7 @@ private ImmutableArray GetAnonymousObjectCreationInitializers(BoundA SyntaxNode syntax = value.Syntax?.Parent ?? expression.Syntax; ITypeSymbol type = target.Type; Optional constantValue = value.ConstantValue; - var assignment = new AssignmentExpression(target, value, isInvalid, syntax, type, constantValue); + var assignment = new SimpleAssignmentExpression(target, value, isInvalid, syntax, type, constantValue); builder.Add(assignment); } diff --git a/src/Compilers/CSharp/Test/Semantic/FlowAnalysis/FlowTestBase.cs b/src/Compilers/CSharp/Test/Semantic/FlowAnalysis/FlowTestBase.cs index cae1140266a..4681d698a4c 100644 --- a/src/Compilers/CSharp/Test/Semantic/FlowAnalysis/FlowTestBase.cs +++ b/src/Compilers/CSharp/Test/Semantic/FlowAnalysis/FlowTestBase.cs @@ -93,8 +93,8 @@ protected T CompileAndGetModelAndExpression(string program, Func()) { @@ -114,8 +114,8 @@ protected T CompileAndGetModelAndStatements(string program, Func()) { diff --git a/src/Compilers/Test/Utilities/CSharp/CSharpTestBase.cs b/src/Compilers/Test/Utilities/CSharp/CSharpTestBase.cs index 62728284016..124d3e02830 100644 --- a/src/Compilers/Test/Utilities/CSharp/CSharpTestBase.cs +++ b/src/Compilers/Test/Utilities/CSharp/CSharpTestBase.cs @@ -731,8 +731,8 @@ protected static SyntaxNode GetSyntaxNodeForBinding(List synList) return GetSyntaxNodeOfTypeForBinding(synList); } - protected const string startString = "/**/"; - protected const string endString = "/**/"; + protected const string StartString = "/**/"; + protected const string EndString = "/**/"; protected static TNode GetSyntaxNodeOfTypeForBinding(List synList) where TNode : SyntaxNode { @@ -741,26 +741,42 @@ protected static SyntaxNode GetSyntaxNodeForBinding(List synList) string exprFullText = node.ToFullString(); exprFullText = exprFullText.Trim(); - if (exprFullText.StartsWith(startString, StringComparison.Ordinal)) + if (exprFullText.StartsWith(StartString, StringComparison.Ordinal)) { - if (exprFullText.Contains(endString)) - if (exprFullText.EndsWith(endString, StringComparison.Ordinal)) + if (exprFullText.Contains(EndString)) + { + if (exprFullText.EndsWith(EndString, StringComparison.Ordinal)) + { return node; + } else + { continue; + } + } else + { return node; + } } - if (exprFullText.EndsWith(endString, StringComparison.Ordinal)) + if (exprFullText.EndsWith(EndString, StringComparison.Ordinal)) { - if (exprFullText.Contains(startString)) - if (exprFullText.StartsWith(startString, StringComparison.Ordinal)) + if (exprFullText.Contains(StartString)) + { + if (exprFullText.StartsWith(StartString, StringComparison.Ordinal)) + { return node; + } else + { continue; + } + } else + { return node; + } } } -- GitLab