private Task CheckResultAsync( string text, int position, bool absent, CSharpParseOptions options, int?matchPriority ) { var tree = SyntaxFactory.ParseSyntaxTree(text, options: options); var compilation = CSharpCompilation.Create( "test", syntaxTrees: new[] { tree }, references: new[] { TestMetadata.Net451.mscorlib } ); if (tree.IsInNonUserCode(position, CancellationToken.None) && !absent) { Assert.False(true, "Wanted keyword, but in non-user code position: " + keywordText); } var semanticModel = compilation.GetSemanticModel(tree); var context = CSharpSyntaxContext.CreateContext_Test( semanticModel, position, CancellationToken.None ); return(CheckResultAsync(absent, position, context, matchPriority)); }
private void CheckResult(string text, int position, bool absent, CSharpParseOptions options) { var tree = SyntaxFactory.ParseSyntaxTree(text, options: options); var compilation = CSharpCompilation.Create( "test", syntaxTrees: new[] { tree }, references: new[] { TestReferences.NetFx.v4_0_30319.mscorlib }); if (tree.IsInNonUserCode(position, CancellationToken.None) && !absent) { Assert.False(true, "Wanted keyword, but in non-user code position: " + keywordText); } var semanticModel = compilation.GetSemanticModel(tree); var context = CSharpSyntaxContext.CreateContext_Test(semanticModel, position, CancellationToken.None); CheckResult(absent, position, context, semanticModel); }