Update mcs lang version
authorMarek Safar <marek.safar@gmail.com>
Fri, 16 Sep 2011 09:20:20 +0000 (10:20 +0100)
committerMarek Safar <marek.safar@gmail.com>
Mon, 19 Sep 2011 10:56:41 +0000 (11:56 +0100)
man/mcs.1
mcs/errors/cs1617.cs
mcs/errors/cs1644-33.cs
mcs/errors/cs1644-34.cs [new file with mode: 0644]
mcs/mcs/ikvm.cs
mcs/mcs/report.cs
mcs/mcs/rootcontext.cs

index b0e28637d566ab00614b0d7c8984767b17302f49..ce82ecbaafdbaca249dd0ccee2d9a1c5116c4304 100644 (file)
--- 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
index 4a74829855620d9e1702f1e0b7242b86c2c64fba..6feb97925c79bb29e9e52577c2058724f8df774d 100644 (file)
@@ -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
index a48c57d98298a57ef85365a667aed2972ed6fe42..fff74c905048dec88114ba710f02bb1686038f3c 100644 (file)
@@ -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 (file)
index 0000000..847c6c1
--- /dev/null
@@ -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 () => { };
+       }
+}
+
index 28ea7758cd9a6ffd271f7281e4d3835378380798..1cc144845815cf9f8441abb4904228f13acdf82f 100644 (file)
@@ -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 ();
index 218d088854c659de8705b2ca1ac0ed43a2d84cbf..81561a5cb9b387d48df82648e7b83e7b028c09ab 100644 (file)
@@ -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);
                        }
index a3b379ce691db5af0556ef5fde5ad92565b2413d..060ce475e50bc5ae8eb2e77958553e51dd82b90e 100644 (file)
@@ -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" +