From 2892ceabcc1f8a4a641f9719f431f254a96c9342 Mon Sep 17 00:00:00 2001
From: Miguel de Icaza <miguel@gnome.org>
Date: Wed, 19 Mar 2014 15:01:05 -0400
Subject: [PATCH 01/14] Backport from Marek: Allow to bootstrap with mcs

---
 Src/Compilers/CSharp/Source/CSharpParseOptions.cs              |  2 +-
 Src/Compilers/CSharp/Source/Compilation/CSharpSemanticModel.cs |  2 ++
 Src/Compilers/CSharp/Source/Compiler/MethodBodyCompiler.cs     | 10 ++++++++--
 Src/Compilers/CSharp/Source/Parser/LanguageParser.cs           |  4 ++--
 .../Core/Source/NonPortable/CommandLine/CommonCompiler.cs      |  2 +-
 5 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/Src/Compilers/CSharp/Source/CSharpParseOptions.cs b/Src/Compilers/CSharp/Source/CSharpParseOptions.cs
index 4923b80..d0a9822 100644
--- a/Src/Compilers/CSharp/Source/CSharpParseOptions.cs
+++ b/Src/Compilers/CSharp/Source/CSharpParseOptions.cs
@@ -21,7 +21,7 @@ namespace Microsoft.CodeAnalysis.CSharp
         /// <summary>
         /// The default parse options.
         /// </summary>
-        public static readonly CSharpParseOptions Default = new CSharpParseOptions();
+        public static readonly CSharpParseOptions Default = new CSharpParseOptions(preprocessorSymbols: null);
 
         /// <summary>
         /// Gets the language version.
diff --git a/Src/Compilers/CSharp/Source/Compilation/CSharpSemanticModel.cs b/Src/Compilers/CSharp/Source/Compilation/CSharpSemanticModel.cs
index 7950c86..f4f6cb1 100644
--- a/Src/Compilers/CSharp/Source/Compilation/CSharpSemanticModel.cs
+++ b/Src/Compilers/CSharp/Source/Compilation/CSharpSemanticModel.cs
@@ -3003,7 +3003,9 @@ namespace Microsoft.CodeAnalysis.CSharp
 
                 case BoundKind.AwaitExpression:
                     var await = (BoundAwaitExpression)boundNode;
+#if !BOOTSTRAP
                     isDynamic = await.IsDynamic;
+#endif
                     // TODO:
                     goto default;
 
diff --git a/Src/Compilers/CSharp/Source/Compiler/MethodBodyCompiler.cs b/Src/Compilers/CSharp/Source/Compiler/MethodBodyCompiler.cs
index 2ff3320..b7d91ee 100644
--- a/Src/Compilers/CSharp/Source/Compiler/MethodBodyCompiler.cs
+++ b/Src/Compilers/CSharp/Source/Compiler/MethodBodyCompiler.cs
@@ -224,7 +224,10 @@ namespace Microsoft.CodeAnalysis.CSharp
                         CompileNamespace(symbol);
                         return (object)null;
                     }
-                    catch (Exception e) if (CompilerFatalError.ReportUnlessCanceled(e))
+                    catch (Exception e)
+#if !BOOTSTRAP
+                    if (CompilerFatalError.ReportUnlessCanceled(e))
+#endif
                     {
                         throw ExceptionUtilities.Unreachable;
                     }
@@ -271,7 +274,10 @@ namespace Microsoft.CodeAnalysis.CSharp
                         CompileNamedType(symbol);
                         return (object)null;
                     }
-                    catch (Exception e) if (CompilerFatalError.Report(e))
+                    catch (Exception e)
+#if !BOOTSTRAP
+                    if (CompilerFatalError.Report(e))
+#endif
                     {
                         throw ExceptionUtilities.Unreachable;
                     }
diff --git a/Src/Compilers/CSharp/Source/Parser/LanguageParser.cs b/Src/Compilers/CSharp/Source/Parser/LanguageParser.cs
index 883f561..75c20b3 100644
--- a/Src/Compilers/CSharp/Source/Parser/LanguageParser.cs
+++ b/Src/Compilers/CSharp/Source/Parser/LanguageParser.cs
@@ -6249,7 +6249,7 @@ namespace Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax
                 return true;
             }
 
-            bool? typedIdentifier = IsPossibleTypedIdentifierStart(this.CurrentToken, this.PeekToken(1), allowThisKeyword: false);
+            bool? typedIdentifier = IsPossibleTypedIdentifierStart(this.CurrentToken, this.PeekToken(1), false);
             if (typedIdentifier != null)
             {
                 return typedIdentifier.Value;
@@ -6519,7 +6519,7 @@ namespace Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax
                 return false;
             }
 
-            bool? typedIdentifier = IsPossibleTypedIdentifierStart(nextToken, PeekToken(2), allowThisKeyword: true);
+            bool? typedIdentifier = IsPossibleTypedIdentifierStart(nextToken, PeekToken(2), true);
             if (typedIdentifier != null)
             {
                 // new Idf Idf
diff --git a/Src/Compilers/Core/Source/NonPortable/CommandLine/CommonCompiler.cs b/Src/Compilers/Core/Source/NonPortable/CommandLine/CommonCompiler.cs
index d70a602..80858dd 100644
--- a/Src/Compilers/Core/Source/NonPortable/CommandLine/CommonCompiler.cs
+++ b/Src/Compilers/Core/Source/NonPortable/CommandLine/CommonCompiler.cs
@@ -585,7 +585,7 @@ namespace Microsoft.CodeAnalysis
                     if (sqm != null)
                     {
                         sqm.BeginSession(this.GetSqmAppID(), false, out sqmSession);
-                        sqm.SetGlobalSessionGuid(Arguments.SqmSessionGuid);
+//                        sqm.SetGlobalSessionGuid(Arguments.SqmSessionGuid);
 
                         // Build Version
                         Assembly thisAssembly = typeof(CommonCompiler).Assembly;
-- 
1.8.5.2 (Apple Git-48)

