提交 1d8c2c8f 编写于 作者: E Evan Hauck

Enable feature flag for local functions

上级 2d0272a0
...@@ -8999,6 +8999,15 @@ internal class CSharpResources { ...@@ -8999,6 +8999,15 @@ internal class CSharpResources {
} }
} }
/// <summary>
/// Looks up a localized string similar to local functions.
/// </summary>
internal static string IDS_FeatureLocalFunctions {
get {
return ResourceManager.GetString("IDS_FeatureLocalFunctions", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to module as an attribute target specifier. /// Looks up a localized string similar to module as an attribute target specifier.
/// </summary> /// </summary>
......
...@@ -4599,6 +4599,9 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ ...@@ -4599,6 +4599,9 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ
<data name="IDS_AwaitInCatchAndFinally" xml:space="preserve"> <data name="IDS_AwaitInCatchAndFinally" xml:space="preserve">
<value>await in catch blocks and finally blocks</value> <value>await in catch blocks and finally blocks</value>
</data> </data>
<data name="IDS_FeatureLocalFunctions" xml:space="preserve">
<value>local functions</value>
</data>
<data name="ERR_UnescapedCurly" xml:space="preserve"> <data name="ERR_UnescapedCurly" xml:space="preserve">
<value>A '{0}' character must be escaped (by doubling) in an interpolated string.</value> <value>A '{0}' character must be escaped (by doubling) in an interpolated string.</value>
</data> </data>
......
...@@ -112,6 +112,7 @@ internal enum MessageID ...@@ -112,6 +112,7 @@ internal enum MessageID
IDS_OperationCausedStackOverflow = MessageBase + 12703, IDS_OperationCausedStackOverflow = MessageBase + 12703,
IDS_AwaitInCatchAndFinally = MessageBase + 12704, IDS_AwaitInCatchAndFinally = MessageBase + 12704,
IDS_FeatureLocalFunctions = MessageBase + 12705,
} }
// Message IDs may refer to strings that need to be localized. // Message IDs may refer to strings that need to be localized.
...@@ -149,6 +150,9 @@ internal static string RequiredFeature(this MessageID feature) ...@@ -149,6 +150,9 @@ internal static string RequiredFeature(this MessageID feature)
{ {
switch (feature) switch (feature)
{ {
case MessageID.IDS_FeatureLocalFunctions:
return "localFunctions";
default: default:
return null; return null;
} }
......
...@@ -7938,8 +7938,9 @@ private StatementSyntax ParseLocalDeclarationStatement() ...@@ -7938,8 +7938,9 @@ private StatementSyntax ParseLocalDeclarationStatement()
try try
{ {
this.ParseDeclarationModifiers(mods); this.ParseDeclarationModifiers(mods);
var allowLocalFunctions = IsFeatureEnabled(MessageID.IDS_FeatureLocalFunctions);
LocalFunctionStatementSyntax localFunction; LocalFunctionStatementSyntax localFunction;
this.ParseDeclaration(out type, variables, true, mods.ToTokenList(), out localFunction); this.ParseDeclaration(out type, variables, allowLocalFunctions, mods.ToTokenList(), out localFunction);
if (localFunction != null) if (localFunction != null)
{ {
Debug.Assert(variables.Count == 0); Debug.Assert(variables.Count == 0);
......
...@@ -26,7 +26,7 @@ public void DiagnosticAnalyzerAllInOne() ...@@ -26,7 +26,7 @@ public void DiagnosticAnalyzerAllInOne()
symbolKindsWithNoCodeBlocks.Add(SymbolKind.NamedType); symbolKindsWithNoCodeBlocks.Add(SymbolKind.NamedType);
var analyzer = new CSharpTrackingDiagnosticAnalyzer(); var analyzer = new CSharpTrackingDiagnosticAnalyzer();
CreateCompilationWithMscorlib45(source, parseOptions: TestOptions.Regular).VerifyAnalyzerDiagnostics(new[] { analyzer }); CreateExperimentalCompilationWithMscorlib45(source).VerifyAnalyzerDiagnostics(new[] { analyzer });
analyzer.VerifyAllAnalyzerMembersWereCalled(); analyzer.VerifyAllAnalyzerMembersWereCalled();
analyzer.VerifyAnalyzeSymbolCalledForAllSymbolKinds(); analyzer.VerifyAnalyzeSymbolCalledForAllSymbolKinds();
analyzer.VerifyAnalyzeNodeCalledForAllSyntaxKinds(); analyzer.VerifyAnalyzeNodeCalledForAllSyntaxKinds();
...@@ -85,7 +85,7 @@ public class C ...@@ -85,7 +85,7 @@ public class C
[WorkItem(759)] [WorkItem(759)]
public void AnalyzerDriverIsSafeAgainstAnalyzerExceptions() public void AnalyzerDriverIsSafeAgainstAnalyzerExceptions()
{ {
var compilation = CreateCompilationWithMscorlib45(TestResource.AllInOneCSharpCode, parseOptions: TestOptions.Regular); var compilation = CreateExperimentalCompilationWithMscorlib45(TestResource.AllInOneCSharpCode);
ThrowingDiagnosticAnalyzer<SyntaxKind>.VerifyAnalyzerEngineIsSafeAgainstExceptions(analyzer => ThrowingDiagnosticAnalyzer<SyntaxKind>.VerifyAnalyzerEngineIsSafeAgainstExceptions(analyzer =>
compilation.GetAnalyzerDiagnostics(new[] { analyzer }, null, logAnalyzerExceptionAsDiagnostics: true)); compilation.GetAnalyzerDiagnostics(new[] { analyzer }, null, logAnalyzerExceptionAsDiagnostics: true));
} }
...@@ -99,7 +99,7 @@ public void AnalyzerOptionsArePassedToAllAnalyzers() ...@@ -99,7 +99,7 @@ public void AnalyzerOptionsArePassedToAllAnalyzers()
new[] { new TestAdditionalText("myfilepath", text) }.ToImmutableArray<AdditionalText>() new[] { new TestAdditionalText("myfilepath", text) }.ToImmutableArray<AdditionalText>()
); );
var compilation = CreateCompilationWithMscorlib45(TestResource.AllInOneCSharpCode, parseOptions: TestOptions.Regular); var compilation = CreateExperimentalCompilationWithMscorlib45(TestResource.AllInOneCSharpCode);
var analyzer = new OptionsDiagnosticAnalyzer<SyntaxKind>(options); var analyzer = new OptionsDiagnosticAnalyzer<SyntaxKind>(options);
compilation.GetAnalyzerDiagnostics(new[] { analyzer }, options); compilation.GetAnalyzerDiagnostics(new[] { analyzer }, options);
analyzer.VerifyAnalyzerOptions(); analyzer.VerifyAnalyzerOptions();
......
...@@ -7,6 +7,8 @@ namespace Microsoft.CodeAnalysis.CSharp.UnitTests ...@@ -7,6 +7,8 @@ namespace Microsoft.CodeAnalysis.CSharp.UnitTests
{ {
public class LocalFunctionTests : CSharpTestBase public class LocalFunctionTests : CSharpTestBase
{ {
private readonly CSharpParseOptions _parseOptions = TestOptions.Regular.WithFeatures(new SmallDictionary<string, string> { { "localFunctions", "true" } });
[Fact] [Fact]
public void EndToEnd() public void EndToEnd()
{ {
...@@ -25,7 +27,8 @@ void Local() ...@@ -25,7 +27,8 @@ void Local()
} }
} }
"; ";
var comp = CompileAndVerify(source, expectedOutput: @" var comp = CreateCompilationWithMscorlib(source, options: TestOptions.ReleaseExe, parseOptions: _parseOptions);
var verify = CompileAndVerify(comp, expectedOutput: @"
Hello, world! Hello, world!
"); ");
} }
...@@ -45,7 +48,8 @@ static void Main(string[] args) ...@@ -45,7 +48,8 @@ static void Main(string[] args)
} }
} }
"; ";
var comp = CompileAndVerify(source, expectedOutput: @" var comp = CreateCompilationWithMscorlib(source, options: TestOptions.ReleaseExe, parseOptions: _parseOptions);
var verify = CompileAndVerify(comp, expectedOutput: @"
2 2
"); ");
} }
...@@ -83,7 +87,8 @@ void NamedOptional(int x = 2) ...@@ -83,7 +87,8 @@ void NamedOptional(int x = 2)
} }
} }
"; ";
var comp = CompileAndVerify(source, expectedOutput: @" var comp = CreateCompilationWithMscorlib(source, options: TestOptions.ReleaseExe, parseOptions: _parseOptions);
var verify = CompileAndVerify(comp, expectedOutput: @"
2 2
2 2
2 2
...@@ -137,7 +142,8 @@ static void Main(string[] args) ...@@ -137,7 +142,8 @@ static void Main(string[] args)
} }
} }
"; ";
var comp = CompileAndVerify(source, expectedOutput: @" var comp = CreateCompilationWithMscorlib(source, options: TestOptions.ReleaseExe, parseOptions: _parseOptions);
var verify = CompileAndVerify(comp, expectedOutput: @"
2 2
2 2
"); ");
...@@ -165,7 +171,8 @@ void Local2() ...@@ -165,7 +171,8 @@ void Local2()
} }
} }
"; ";
var comp = CompileAndVerify(source, expectedOutput: @" var comp = CreateCompilationWithMscorlib(source, options: TestOptions.ReleaseExe, parseOptions: _parseOptions);
var verify = CompileAndVerify(comp, expectedOutput: @"
2 2
2 2
"); ");
...@@ -196,7 +203,8 @@ static void Main(string[] args) ...@@ -196,7 +203,8 @@ static void Main(string[] args)
} }
} }
"; ";
var comp = CompileAndVerify(source, expectedOutput: @" var comp = CreateCompilationWithMscorlib(source, options: TestOptions.ReleaseExe, parseOptions: _parseOptions);
var verify = CompileAndVerify(comp, expectedOutput: @"
1 1
2 2
"); ");
...@@ -234,7 +242,8 @@ static void Main(string[] args) ...@@ -234,7 +242,8 @@ static void Main(string[] args)
} }
} }
"; ";
var comp = CompileAndVerify(source, expectedOutput: @" var comp = CreateCompilationWithMscorlib(source, options: TestOptions.ReleaseExe, parseOptions: _parseOptions);
var verify = CompileAndVerify(comp, expectedOutput: @"
6 6
"); ");
} }
...@@ -267,7 +276,8 @@ static void Main(string[] args) ...@@ -267,7 +276,8 @@ static void Main(string[] args)
} }
} }
"; ";
var comp = CompileAndVerify(source, expectedOutput: @" var comp = CreateCompilationWithMscorlib(source, options: TestOptions.ReleaseExe, parseOptions: _parseOptions);
var verify = CompileAndVerify(comp, expectedOutput: @"
2 2
"); ");
} }
...@@ -296,7 +306,8 @@ void Foo(int depth) ...@@ -296,7 +306,8 @@ void Foo(int depth)
} }
} }
"; ";
var comp = CompileAndVerify(source, expectedOutput: @" var comp = CreateCompilationWithMscorlib(source, options: TestOptions.ReleaseExe, parseOptions: _parseOptions);
var verify = CompileAndVerify(comp, expectedOutput: @"
2 2
"); ");
} }
...@@ -328,7 +339,8 @@ void Bar(int depth2) ...@@ -328,7 +339,8 @@ void Bar(int depth2)
} }
} }
"; ";
var comp = CompileAndVerify(source, expectedOutput: @" var comp = CreateCompilationWithMscorlib(source, options: TestOptions.ReleaseExe, parseOptions: _parseOptions);
var verify = CompileAndVerify(comp, expectedOutput: @"
2 2
"); ");
} }
...@@ -368,7 +380,8 @@ IEnumerator LocalEnumerator() ...@@ -368,7 +380,8 @@ IEnumerator LocalEnumerator()
} }
} }
"; ";
var comp = CompileAndVerify(source, expectedOutput: @" var comp = CreateCompilationWithMscorlib(source, options: TestOptions.ReleaseExe, parseOptions: _parseOptions);
var verify = CompileAndVerify(comp, expectedOutput: @"
2 2
2 2
2 2
...@@ -395,7 +408,9 @@ async Task<int> Local() ...@@ -395,7 +408,9 @@ async Task<int> Local()
} }
} }
"; ";
var compilation = CreateCompilationWithMscorlib45(source, options: new CSharpCompilationOptions(OutputKind.ConsoleApplication)); var compilation = CreateCompilationWithMscorlib45(source,
options: new CSharpCompilationOptions(OutputKind.ConsoleApplication),
parseOptions: _parseOptions);
var comp = CompileAndVerify(compilation, expectedOutput: @" var comp = CompileAndVerify(compilation, expectedOutput: @"
2 2
"); ");
...@@ -421,7 +436,9 @@ async Task<int> Local(int x) ...@@ -421,7 +436,9 @@ async Task<int> Local(int x)
} }
} }
"; ";
var compilation = CreateCompilationWithMscorlib45(source, options: new CSharpCompilationOptions(OutputKind.ConsoleApplication)); var compilation = CreateCompilationWithMscorlib45(source,
options: new CSharpCompilationOptions(OutputKind.ConsoleApplication),
parseOptions: _parseOptions);
var comp = CompileAndVerify(compilation, expectedOutput: @" var comp = CompileAndVerify(compilation, expectedOutput: @"
2 2
"); ");
...@@ -480,7 +497,8 @@ static void Main(string[] args) ...@@ -480,7 +497,8 @@ static void Main(string[] args)
} }
} }
"; ";
var comp = CompileAndVerify(source, expectedOutput: @" var comp = CreateCompilationWithMscorlib(source, options: TestOptions.ReleaseExe, parseOptions: _parseOptions);
var verify = CompileAndVerify(comp, expectedOutput: @"
2 2
"); ");
} }
...@@ -509,7 +527,8 @@ void Local() ...@@ -509,7 +527,8 @@ void Local()
} }
} }
"; ";
var comp = CompileAndVerify(source, expectedOutput: @" var comp = CreateCompilationWithMscorlib(source, options: TestOptions.ReleaseExe, parseOptions: _parseOptions);
var verify = CompileAndVerify(comp, expectedOutput: @"
2 2
"); ");
} }
...@@ -531,7 +550,7 @@ void Local1() ...@@ -531,7 +550,7 @@ void Local1()
} }
"; ";
var option = TestOptions.ReleaseExe.WithWarningLevel(0); var option = TestOptions.ReleaseExe.WithWarningLevel(0);
CreateCompilationWithMscorlibAndSystemCore(source, options: option).VerifyDiagnostics( CreateCompilationWithMscorlibAndSystemCore(source, options: option, parseOptions: _parseOptions).VerifyDiagnostics(
// (9,22): error CS1002: ; expected // (9,22): error CS1002: ; expected
// void Local1() // void Local1()
Diagnostic(ErrorCode.ERR_SemicolonExpected, "").WithLocation(9, 22), Diagnostic(ErrorCode.ERR_SemicolonExpected, "").WithLocation(9, 22),
...@@ -565,7 +584,7 @@ IEnumerable<int> Local(ref int x) ...@@ -565,7 +584,7 @@ IEnumerable<int> Local(ref int x)
} }
"; ";
var option = TestOptions.ReleaseExe.WithWarningLevel(0); var option = TestOptions.ReleaseExe.WithWarningLevel(0);
CreateCompilationWithMscorlibAndSystemCore(source, options: option).VerifyDiagnostics( CreateCompilationWithMscorlibAndSystemCore(source, options: option, parseOptions: _parseOptions).VerifyDiagnostics(
// (9,40): error CS1623: Iterators cannot have ref or out parameters // (9,40): error CS1623: Iterators cannot have ref or out parameters
// IEnumerable<int> Local(ref int x) // IEnumerable<int> Local(ref int x)
Diagnostic(ErrorCode.ERR_BadIteratorArgType, "x").WithLocation(9, 40) Diagnostic(ErrorCode.ERR_BadIteratorArgType, "x").WithLocation(9, 40)
...@@ -592,7 +611,7 @@ IEnumerable<int> Local(__arglist) ...@@ -592,7 +611,7 @@ IEnumerable<int> Local(__arglist)
} }
"; ";
var option = TestOptions.ReleaseExe.WithWarningLevel(0); var option = TestOptions.ReleaseExe.WithWarningLevel(0);
CreateCompilationWithMscorlibAndSystemCore(source, options: option).VerifyDiagnostics( CreateCompilationWithMscorlibAndSystemCore(source, options: option, parseOptions: _parseOptions).VerifyDiagnostics(
// (9,26): error CS1636: __arglist is not allowed in the parameter list of iterators // (9,26): error CS1636: __arglist is not allowed in the parameter list of iterators
// IEnumerable<int> Local(__arglist) // IEnumerable<int> Local(__arglist)
Diagnostic(ErrorCode.ERR_VarargsIterator, "Local").WithLocation(9, 26) Diagnostic(ErrorCode.ERR_VarargsIterator, "Local").WithLocation(9, 26)
...@@ -616,7 +635,7 @@ static void Main(string[] args) ...@@ -616,7 +635,7 @@ static void Main(string[] args)
} }
"; ";
var option = TestOptions.ReleaseExe.WithWarningLevel(0); var option = TestOptions.ReleaseExe.WithWarningLevel(0);
CreateCompilationWithMscorlibAndSystemCore(source, options: option).VerifyDiagnostics( CreateCompilationWithMscorlibAndSystemCore(source, options: option, parseOptions: _parseOptions).VerifyDiagnostics(
// (9,27): error CS0841: Cannot use local variable 'Local' before it is declared // (9,27): error CS0841: Cannot use local variable 'Local' before it is declared
// Console.WriteLine(Local()); // Console.WriteLine(Local());
Diagnostic(ErrorCode.ERR_VariableUsedBeforeDeclaration, "Local").WithArguments("Local").WithLocation(9, 27) Diagnostic(ErrorCode.ERR_VariableUsedBeforeDeclaration, "Local").WithArguments("Local").WithLocation(9, 27)
......
...@@ -125,7 +125,7 @@ public void TestCopyAnnotationOfZeroLengthToSyntaxTrivia() ...@@ -125,7 +125,7 @@ public void TestCopyAnnotationOfZeroLengthToSyntaxTrivia()
public void TestMissingAnnotationsOnNodesOrTokens() public void TestMissingAnnotationsOnNodesOrTokens()
{ {
SyntaxAnnotation annotation = new SyntaxAnnotation(); SyntaxAnnotation annotation = new SyntaxAnnotation();
var tree = SyntaxFactory.ParseSyntaxTree(_allInOneCSharpCode, options: Test.Utilities.TestOptions.Regular); var tree = SyntaxFactory.ParseSyntaxTree(_allInOneCSharpCode, options: Test.Utilities.TestOptions.ExperimentalParseOptions);
var matchingNodesOrTokens = tree.GetCompilationUnitRoot().GetAnnotatedNodesAndTokens(annotation); var matchingNodesOrTokens = tree.GetCompilationUnitRoot().GetAnnotatedNodesAndTokens(annotation);
Assert.Empty(matchingNodesOrTokens); Assert.Empty(matchingNodesOrTokens);
...@@ -135,7 +135,7 @@ public void TestMissingAnnotationsOnNodesOrTokens() ...@@ -135,7 +135,7 @@ public void TestMissingAnnotationsOnNodesOrTokens()
public void TestMissingAnnotationsOnTrivia() public void TestMissingAnnotationsOnTrivia()
{ {
SyntaxAnnotation annotation = new SyntaxAnnotation(); SyntaxAnnotation annotation = new SyntaxAnnotation();
var tree = SyntaxFactory.ParseSyntaxTree(_allInOneCSharpCode, options: Test.Utilities.TestOptions.Regular); var tree = SyntaxFactory.ParseSyntaxTree(_allInOneCSharpCode, options: Test.Utilities.TestOptions.ExperimentalParseOptions);
var matchingTrivia = tree.GetCompilationUnitRoot().GetAnnotatedTrivia(annotation); var matchingTrivia = tree.GetCompilationUnitRoot().GetAnnotatedTrivia(annotation);
Assert.Empty(matchingTrivia); Assert.Empty(matchingTrivia);
...@@ -298,7 +298,7 @@ public void TestIfNodeHasAnnotations() ...@@ -298,7 +298,7 @@ public void TestIfNodeHasAnnotations()
[Fact] [Fact]
public void TestCSharpAllInOne() public void TestCSharpAllInOne()
{ {
var tree = SyntaxFactory.ParseSyntaxTree(_allInOneCSharpCode, options: Test.Utilities.TestOptions.Regular); var tree = SyntaxFactory.ParseSyntaxTree(_allInOneCSharpCode, options: Test.Utilities.TestOptions.ExperimentalParseOptions);
TestAnnotation(tree); TestAnnotation(tree);
} }
...@@ -306,7 +306,7 @@ public void TestCSharpAllInOne() ...@@ -306,7 +306,7 @@ public void TestCSharpAllInOne()
[Fact] [Fact]
public void TestCSharpAllInOneRandom() public void TestCSharpAllInOneRandom()
{ {
var tree = SyntaxFactory.ParseSyntaxTree(_allInOneCSharpCode, options: Test.Utilities.TestOptions.Regular); var tree = SyntaxFactory.ParseSyntaxTree(_allInOneCSharpCode, options: Test.Utilities.TestOptions.ExperimentalParseOptions);
TestRandomAnnotations(tree); TestRandomAnnotations(tree);
} }
...@@ -314,7 +314,7 @@ public void TestCSharpAllInOneRandom() ...@@ -314,7 +314,7 @@ public void TestCSharpAllInOneRandom()
[Fact] [Fact]
public void TestCSharpAllInOneManyRandom() public void TestCSharpAllInOneManyRandom()
{ {
var tree = SyntaxFactory.ParseSyntaxTree(_allInOneCSharpCode, options: Test.Utilities.TestOptions.Regular); var tree = SyntaxFactory.ParseSyntaxTree(_allInOneCSharpCode, options: Test.Utilities.TestOptions.ExperimentalParseOptions);
TestManyRandomAnnotations(tree); TestManyRandomAnnotations(tree);
} }
...@@ -322,7 +322,7 @@ public void TestCSharpAllInOneManyRandom() ...@@ -322,7 +322,7 @@ public void TestCSharpAllInOneManyRandom()
[Fact] [Fact]
public void TestCSharpAllInOneTrivia() public void TestCSharpAllInOneTrivia()
{ {
var tree = SyntaxFactory.ParseSyntaxTree(_allInOneCSharpCode, options: Test.Utilities.TestOptions.Regular); var tree = SyntaxFactory.ParseSyntaxTree(_allInOneCSharpCode, options: Test.Utilities.TestOptions.ExperimentalParseOptions);
TestTriviaAnnotation(tree); TestTriviaAnnotation(tree);
} }
...@@ -330,8 +330,8 @@ public void TestCSharpAllInOneTrivia() ...@@ -330,8 +330,8 @@ public void TestCSharpAllInOneTrivia()
[Fact] [Fact]
public void TestCopyAnnotations1() public void TestCopyAnnotations1()
{ {
var tree1 = SyntaxFactory.ParseSyntaxTree(_allInOneCSharpCode, options: Test.Utilities.TestOptions.Regular); var tree1 = SyntaxFactory.ParseSyntaxTree(_allInOneCSharpCode, options: Test.Utilities.TestOptions.ExperimentalParseOptions);
var tree2 = SyntaxFactory.ParseSyntaxTree(_allInOneCSharpCode, options: Test.Utilities.TestOptions.Regular); var tree2 = SyntaxFactory.ParseSyntaxTree(_allInOneCSharpCode, options: Test.Utilities.TestOptions.ExperimentalParseOptions);
TestCopyAnnotations(tree1, tree2); TestCopyAnnotations(tree1, tree2);
} }
......
...@@ -15,7 +15,7 @@ public static class TestOptions ...@@ -15,7 +15,7 @@ public static class TestOptions
public static readonly CSharpParseOptions Regular = new CSharpParseOptions(kind: SourceCodeKind.Regular, documentationMode: DocumentationMode.None); public static readonly CSharpParseOptions Regular = new CSharpParseOptions(kind: SourceCodeKind.Regular, documentationMode: DocumentationMode.None);
public static readonly CSharpParseOptions RegularWithDocumentationComments = new CSharpParseOptions(kind: SourceCodeKind.Regular, documentationMode: DocumentationMode.Diagnose); public static readonly CSharpParseOptions RegularWithDocumentationComments = new CSharpParseOptions(kind: SourceCodeKind.Regular, documentationMode: DocumentationMode.Diagnose);
private static readonly SmallDictionary<string, string> s_experimentalFeatures = new SmallDictionary<string, string>(); // no experimental features to enable private static readonly SmallDictionary<string, string> s_experimentalFeatures = new SmallDictionary<string, string> { { "localFunctions", "true" } };
public static readonly CSharpParseOptions ExperimentalParseOptions = public static readonly CSharpParseOptions ExperimentalParseOptions =
new CSharpParseOptions(kind: SourceCodeKind.Regular, documentationMode: DocumentationMode.None, languageVersion: LanguageVersion.CSharp6).WithFeatures(s_experimentalFeatures); new CSharpParseOptions(kind: SourceCodeKind.Regular, documentationMode: DocumentationMode.None, languageVersion: LanguageVersion.CSharp6).WithFeatures(s_experimentalFeatures);
......
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
// Runtime Version:4.0.30319.0 // Runtime Version:4.0.30319.42000
// //
// Changes to this file may cause incorrect behavior and will be lost if // Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. // the code is regenerated.
......
...@@ -196,6 +196,10 @@ namespace My ...@@ -196,6 +196,10 @@ namespace My
var s2 = $@"x {1 , -2 :d}"; var s2 = $@"x {1 , -2 :d}";
} }
int LocalFunction()
{
}
#if DEBUG #if DEBUG
Console.WriteLine(export.iefSupplied.command); Console.WriteLine(export.iefSupplied.command);
#endif #endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册