From 7a4152aedf00dfe880f7cff3121d31ed7ae94185 Mon Sep 17 00:00:00 2001 From: Marek Safar Date: Fri, 16 Sep 2011 10:20:20 +0100 Subject: [PATCH] Update mcs lang version --- man/mcs.1 | 6 +++++- mcs/errors/cs1617.cs | 2 +- mcs/errors/cs1644-33.cs | 4 ++-- mcs/errors/cs1644-34.cs | 14 ++++++++++++++ mcs/mcs/ikvm.cs | 2 +- mcs/mcs/report.cs | 3 +++ mcs/mcs/rootcontext.cs | 13 +++++++++++-- 7 files changed, 37 insertions(+), 7 deletions(-) create mode 100644 mcs/errors/cs1644-34.cs diff --git a/man/mcs.1 b/man/mcs.1 index b0e28637d56..ce82ecbaafd 100644 --- a/man/mcs.1 +++ b/man/mcs.1 @@ -163,7 +163,7 @@ The possible values are: .TP .I "Default" Instruct compiler to use the latest version. Equivalent is to omit the -switch (this currently defaults to the C# 3.0 language specification). +switch (this currently defaults to the C# 4.0 language specification). .TP .I "ISO-1" Restrict compiler to use only first ISO standardized features. @@ -179,6 +179,10 @@ anonymous methods for example. Restrict the compiler to use only the features available in C# 3.0 (a superset of ISO-1 and ISO-2). .TP +.I "4" +Restrict the compiler to use only the features available in C# 4.0 +specification. +.TP .I "future" Enables unstable features from upcoming versions of the language. .PP diff --git a/mcs/errors/cs1617.cs b/mcs/errors/cs1617.cs index 4a748298556..6feb97925c7 100644 --- a/mcs/errors/cs1617.cs +++ b/mcs/errors/cs1617.cs @@ -1,3 +1,3 @@ -// CS1617: Invalid -langversion option `ISO'. It must be `ISO-1', `ISO-2', `3' or `Default' +// CS1617: Invalid -langversion option `ISO'. It must be `ISO-1', `ISO-2', `3', `4', `5', `Default' or `Future' // Line: 0 // Compiler options: -langversion:ISO diff --git a/mcs/errors/cs1644-33.cs b/mcs/errors/cs1644-33.cs index a48c57d9829..fff74c90504 100644 --- a/mcs/errors/cs1644-33.cs +++ b/mcs/errors/cs1644-33.cs @@ -1,6 +1,6 @@ -// CS1644: Feature `asynchronous functions' cannot be used because it is not part of the C# 2.0 language specification +// CS1644: Feature `asynchronous functions' cannot be used because it is not part of the C# 4.0 language specification // Line: 9 -// Compiler options: -langversion:ISO-2 +// Compiler options: -langversion:4 using System; diff --git a/mcs/errors/cs1644-34.cs b/mcs/errors/cs1644-34.cs new file mode 100644 index 00000000000..847c6c115a3 --- /dev/null +++ b/mcs/errors/cs1644-34.cs @@ -0,0 +1,14 @@ +// CS1644: Feature `asynchronous functions' cannot be used because it is not part of the C# 4.0 language specification +// Line: 10 +// Compiler options: -langversion:4 + +using System; + +class C +{ + public void Foo () + { + Action a = async () => { }; + } +} + diff --git a/mcs/mcs/ikvm.cs b/mcs/mcs/ikvm.cs index 28ea7758cd9..1cc14484581 100644 --- a/mcs/mcs/ikvm.cs +++ b/mcs/mcs/ikvm.cs @@ -356,7 +356,7 @@ namespace Mono.CSharp default_references.Add ("Microsoft.CSharp.dll"); } - if (compiler.Settings.Version == LanguageVersion.Future) + if (compiler.Settings.Version >= LanguageVersion.V_4) default_references.Add ("Mono.Async.dll"); return default_references.ToArray (); diff --git a/mcs/mcs/report.cs b/mcs/mcs/report.cs index 218d088854c..81561a5cb9b 100644 --- a/mcs/mcs/report.cs +++ b/mcs/mcs/report.cs @@ -107,6 +107,9 @@ namespace Mono.CSharp { case LanguageVersion.V_4: version = "4.0"; break; + case LanguageVersion.V_5: + version = "5.0"; + break; default: throw new InternalErrorException ("Invalid feature version", compiler.Settings.Version); } diff --git a/mcs/mcs/rootcontext.cs b/mcs/mcs/rootcontext.cs index a3b379ce691..060ce475e50 100644 --- a/mcs/mcs/rootcontext.cs +++ b/mcs/mcs/rootcontext.cs @@ -10,6 +10,8 @@ // // Copyright 2001 Ximian, Inc (http://www.ximian.com) // Copyright 2004-2008 Novell, Inc +// Copyright 2011 Xamarin, Inc (http://www.xamarin.com) +// using System.Collections.Generic; using System.IO; @@ -25,6 +27,7 @@ namespace Mono.CSharp { ISO_2 = 2, V_3 = 3, V_4 = 4, + V_5 = 5, Future = 100, Default = LanguageVersion.V_4, @@ -1041,12 +1044,18 @@ namespace Mono.CSharp { case "3": settings.Version = LanguageVersion.V_3; return ParseResult.Success; + case "4": + settings.Version = LanguageVersion.V_4; + return ParseResult.Success; + case "5": + settings.Version = LanguageVersion.V_5; + return ParseResult.Success; case "future": settings.Version = LanguageVersion.Future; return ParseResult.Success; } - report.Error (1617, "Invalid -langversion option `{0}'. It must be `ISO-1', `ISO-2', `3' or `Default'", value); + report.Error (1617, "Invalid -langversion option `{0}'. It must be `ISO-1', `ISO-2', `3', `4', `5', `Default' or `Future'", value); return ParseResult.Error; case "/codepage": @@ -1407,7 +1416,7 @@ namespace Mono.CSharp { " -help Lists all compiler options (short: -?)\n" + " -keycontainer:NAME The key pair container used to sign the output assembly\n" + " -keyfile:FILE The key file used to strongname the ouput assembly\n" + - " -langversion:TEXT Specifies language version: ISO-1, ISO-2, 3, Default or Future\n" + + " -langversion:TEXT Specifies language version: ISO-1, ISO-2, 3, 4, 5, Default or Future\n" + " -lib:PATH1[,PATHn] Specifies the location of referenced assemblies\n" + " -main:CLASS Specifies the class with the Main method (short: -m)\n" + " -noconfig Disables implicitly referenced assemblies\n" + -- 2.25.1