Comment ifdefs and fix K10 functionality
This commit is contained in:
parent
9f80b7d1c8
commit
7f0878c1b8
|
|
@ -22,6 +22,8 @@ namespace Microsoft.AspNet.Razor
|
|||
get { return CSharpLanguageName; }
|
||||
}
|
||||
#if NET45
|
||||
// No CodeDOM in CoreCLR
|
||||
|
||||
/// <summary>
|
||||
/// Returns the type of the CodeDOM provider for this language
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -310,6 +310,11 @@ namespace Microsoft.AspNet.Razor.Editor
|
|||
{
|
||||
RazorEditorTrace.TraceLine(RazorResources.Trace_BackgroundThreadStart, fileNameOnly);
|
||||
EnsureOnThread();
|
||||
|
||||
#if K10
|
||||
var spinWait = new SpinWait();
|
||||
#endif
|
||||
|
||||
while (!_shutdownToken.IsCancellationRequested)
|
||||
{
|
||||
// Grab the parcel of work to do
|
||||
|
|
@ -425,7 +430,12 @@ namespace Microsoft.AspNet.Razor.Editor
|
|||
{
|
||||
RazorEditorTrace.TraceLine(RazorResources.Trace_NoChangesArrived, fileNameOnly, parcel.Changes.Count);
|
||||
#if NET45
|
||||
// No Yield in CoreCLR
|
||||
|
||||
Thread.Yield();
|
||||
#else
|
||||
// This does the equivalent of thread.yield under the covers.
|
||||
spinWait.SpinOnce();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@ namespace Microsoft.AspNet.Razor.Editor
|
|||
if (Boolean.TryParse(Environment.GetEnvironmentVariable("RAZOR_EDITOR_TRACE"), out enabled))
|
||||
{
|
||||
#if NET45
|
||||
// No Trace in CoreCLR
|
||||
|
||||
Trace.WriteLine(String.Format(
|
||||
CultureInfo.CurrentCulture,
|
||||
RazorResources.Trace_Startup,
|
||||
|
|
@ -46,6 +48,8 @@ namespace Microsoft.AspNet.Razor.Editor
|
|||
if (IsEnabled())
|
||||
{
|
||||
#if NET45
|
||||
// No Trace in CoreCLR
|
||||
|
||||
Trace.WriteLine(String.Format(
|
||||
CultureInfo.CurrentCulture,
|
||||
RazorResources.Trace_Format,
|
||||
|
|
|
|||
|
|
@ -36,6 +36,9 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
public override void GenerateCode(Span target, CodeGeneratorContext context)
|
||||
{
|
||||
#if NET45
|
||||
// No CodeDOM in CoreCLR.
|
||||
// #if'd the entire section because once we transition over to the CodeTree we will not need all this code.
|
||||
|
||||
// Try to find the namespace in the existing imports
|
||||
string ns = Namespace;
|
||||
if (!String.IsNullOrEmpty(ns) && Char.IsWhiteSpace(ns[0]))
|
||||
|
|
|
|||
|
|
@ -34,6 +34,9 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
public override void GenerateStartBlockCode(Block target, CodeGeneratorContext context)
|
||||
{
|
||||
#if NET45
|
||||
// No CodeDOM in CoreCLR.
|
||||
// #if'd the entire section because once we transition over to the CodeTree we will not need all this code.
|
||||
|
||||
if (context.Host.DesignTimeMode)
|
||||
{
|
||||
return; // Don't generate anything!
|
||||
|
|
@ -72,6 +75,9 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
public override void GenerateEndBlockCode(Block target, CodeGeneratorContext context)
|
||||
{
|
||||
#if NET45
|
||||
// No CodeDOM in CoreCLR (AddStatement and FlushBufferedStatement etc. utilize it).
|
||||
// #if'd the entire section because once we transition over to the CodeTree we will not need all this code.
|
||||
|
||||
if (context.Host.DesignTimeMode)
|
||||
{
|
||||
return; // Don't generate anything!
|
||||
|
|
|
|||
|
|
@ -25,6 +25,9 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
{
|
||||
base.Initialize(context);
|
||||
#if NET45
|
||||
// No CodeDOM in CoreCLR.
|
||||
// #if'd the entire section because once we transition over to the CodeTree we will not need all this code.
|
||||
|
||||
context.GeneratedClass.Members.Insert(0, new CodeSnippetTypeMember(HiddenLinePragma));
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,9 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
|
||||
#region deletable
|
||||
#if NET45
|
||||
// This section is #if'd because it contains SOME incompatible pieces but also will not be needed once we transition over
|
||||
// to using the CodeTree
|
||||
|
||||
private int _nextDesignTimePragmaId = 1;
|
||||
private bool _expressionHelperVariableWriten;
|
||||
private CodeMemberMethod _designTimeHelperMethod;
|
||||
|
|
@ -318,6 +321,9 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
Host = host,
|
||||
SourceFile = shouldGenerateLinePragmas ? sourceFile : null,
|
||||
#if NET45
|
||||
// This section is #if'd because it contains SOME incompatible pieces but also will not be needed once we transition over
|
||||
// to using the CodeTree
|
||||
|
||||
CodeWriterFactory = writerFactory,
|
||||
CompileUnit = new CodeCompileUnit(),
|
||||
Namespace = new CodeNamespace(rootNamespace),
|
||||
|
|
@ -334,6 +340,8 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
#endif
|
||||
};
|
||||
#if NET45
|
||||
// No CodeDOM in CoreCLR.
|
||||
|
||||
context.CompileUnit.Namespaces.Add(context.Namespace);
|
||||
context.Namespace.Types.Add(context.GeneratedClass);
|
||||
context.GeneratedClass.Members.Add(context.TargetMethod);
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ using Microsoft.AspNet.Razor.Parser.SyntaxTree;
|
|||
namespace Microsoft.AspNet.Razor.Generator
|
||||
{
|
||||
#if NET45
|
||||
// This section is #if'd because it is no longer needed for the CodeTree transition.
|
||||
|
||||
internal static class CodeGeneratorPaddingHelper
|
||||
{
|
||||
private static readonly char[] _newLineChars = { '\r', '\n' };
|
||||
|
|
|
|||
|
|
@ -54,6 +54,8 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
public abstract void WriteStringLiteral(string literal);
|
||||
public abstract int WriteVariableDeclaration(string type, string name, string value);
|
||||
#if NET45
|
||||
// No CodeDOM in CoreCLR
|
||||
|
||||
public virtual void WriteLinePragma()
|
||||
{
|
||||
WriteLinePragma(null);
|
||||
|
|
@ -169,6 +171,9 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
public virtual void WriteBooleanLiteral(bool value)
|
||||
{
|
||||
#if NET45
|
||||
// ToString does not take a parameter in CoreCLR
|
||||
// #if'd the entire section because once we transition over to the CodeTree we will not need all this code.
|
||||
|
||||
WriteSnippet(value.ToString(CultureInfo.InvariantCulture));
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,9 +29,6 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
|
|||
writer.WriteComment(new string('-', 78))
|
||||
.WriteComment("<auto-generated>")
|
||||
.WriteComment(" This code was generated by a tool.")
|
||||
#if NET45
|
||||
.WriteComment(" Runtime Version: " + Assembly.GetExecutingAssembly().ImageRuntimeVersion)
|
||||
#endif
|
||||
.WriteComment("")
|
||||
.WriteComment(" Changes to this file may cause incorrect behavior and will be lost if")
|
||||
.WriteComment(" the code is regenerated.")
|
||||
|
|
|
|||
|
|
@ -41,6 +41,8 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
public override void GenerateStartBlockCode(Block target, CodeGeneratorContext context)
|
||||
{
|
||||
#if NET45
|
||||
// This code will not be needed once we transition to the CodeTree
|
||||
|
||||
if (context.Host.DesignTimeMode)
|
||||
{
|
||||
return; // Don't generate anything!
|
||||
|
|
@ -55,6 +57,8 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
{
|
||||
_isExpression = true;
|
||||
#if NET45
|
||||
// No CodeDOM + This code will not be needed once we transition to the CodeTree
|
||||
|
||||
generatedCode = context.BuildCodeString(cw =>
|
||||
{
|
||||
cw.WriteParameterSeparator();
|
||||
|
|
@ -68,6 +72,8 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
context.ExpressionRenderingMode = ExpressionRenderingMode.InjectCode;
|
||||
}
|
||||
#if NET45
|
||||
// No CodeDOM + This code will not be needed once we transition to the CodeTree
|
||||
|
||||
else
|
||||
{
|
||||
generatedCode = context.BuildCodeString(cw =>
|
||||
|
|
@ -108,6 +114,8 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
if (_isExpression)
|
||||
{
|
||||
#if NET45
|
||||
// No CodeDOM + This code will not be needed once we transition to the CodeTree
|
||||
|
||||
generatedCode = context.BuildCodeString(cw =>
|
||||
{
|
||||
cw.WriteParameterSeparator();
|
||||
|
|
@ -123,6 +131,8 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
context.ExpressionRenderingMode = _oldRenderingMode;
|
||||
}
|
||||
#if NET45
|
||||
// No CodeDOM + This code will not be needed once we transition to the CodeTree
|
||||
|
||||
else
|
||||
{
|
||||
generatedCode = context.BuildCodeString(cw =>
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
public override void GenerateStartBlockCode(Block target, CodeGeneratorContext context)
|
||||
{
|
||||
#if NET45
|
||||
// No CodeDOM + This code will not be needed once we transition to the CodeTree
|
||||
|
||||
if (context.Host.EnableInstrumentation && context.ExpressionRenderingMode == ExpressionRenderingMode.WriteToOutput)
|
||||
{
|
||||
Span contentSpan = target.Children
|
||||
|
|
@ -69,6 +71,8 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
public override void GenerateEndBlockCode(Block target, CodeGeneratorContext context)
|
||||
{
|
||||
#if NET45
|
||||
// No CodeDOM + This code will not be needed once we transition to the CodeTree
|
||||
|
||||
string endBlock = context.BuildCodeString(cw =>
|
||||
{
|
||||
if (context.ExpressionRenderingMode == ExpressionRenderingMode.WriteToOutput)
|
||||
|
|
@ -115,6 +119,8 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
public override void GenerateCode(Span target, CodeGeneratorContext context)
|
||||
{
|
||||
#if NET45
|
||||
// No CodeDOM + This code will not be needed once we transition to the CodeTree
|
||||
|
||||
Span sourceSpan = null;
|
||||
if (context.CreateCodeWriter().SupportsMidStatementLinePragmas || context.ExpressionRenderingMode == ExpressionRenderingMode.WriteToOutput)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -40,6 +40,8 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
public override void GenerateStartBlockCode(Block target, CodeGeneratorContext context)
|
||||
{
|
||||
#if NET45
|
||||
// No CodeDOM + This code will not be needed once we transition to the CodeTree
|
||||
|
||||
_writer = context.CreateCodeWriter();
|
||||
|
||||
string prefix = context.BuildCodeString(
|
||||
|
|
@ -78,6 +80,8 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
public override void GenerateEndBlockCode(Block target, CodeGeneratorContext context)
|
||||
{
|
||||
#if NET45
|
||||
// No CodeDOM + This code will not be needed once we transition to the CodeTree
|
||||
|
||||
_statementCollectorToken.Dispose();
|
||||
if (HeaderComplete)
|
||||
{
|
||||
|
|
@ -126,6 +130,8 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
}
|
||||
|
||||
#if NET45
|
||||
// No CodeDOM + This code will not be needed once we transition to the CodeTree
|
||||
|
||||
private void AddStatementToHelper(string statement, CodeLinePragma pragma)
|
||||
{
|
||||
if (pragma != null)
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
|
||||
ExpressionRenderingMode oldMode = context.ExpressionRenderingMode;
|
||||
#if NET45
|
||||
// No CodeDOM + This code will not be needed once we transition to the CodeTree
|
||||
|
||||
context.BufferStatementFragment(context.BuildCodeString(cw =>
|
||||
{
|
||||
cw.WriteParameterSeparator();
|
||||
|
|
@ -52,14 +54,17 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
cw.WriteLocationTaggedString(Prefix);
|
||||
cw.WriteParameterSeparator();
|
||||
#endif
|
||||
if (ValueGenerator != null)
|
||||
if (ValueGenerator != null)
|
||||
{
|
||||
#if NET45
|
||||
// No CodeDOM + This code will not be needed once we transition to the CodeTree
|
||||
cw.WriteStartMethodInvoke("Tuple.Create", "System.Object", "System.Int32");
|
||||
#endif
|
||||
context.ExpressionRenderingMode = ExpressionRenderingMode.InjectCode;
|
||||
}
|
||||
#if NET45
|
||||
// No CodeDOM + This code will not be needed once we transition to the CodeTree
|
||||
|
||||
else
|
||||
{
|
||||
cw.WriteLocationTaggedString(Value);
|
||||
|
|
@ -74,15 +79,21 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
{
|
||||
ValueGenerator.Value.GenerateCode(target, context);
|
||||
#if NET45
|
||||
// No CodeDOM + This code will not be needed once we transition to the CodeTree
|
||||
|
||||
context.FlushBufferedStatement();
|
||||
#endif
|
||||
context.ExpressionRenderingMode = oldMode;
|
||||
#if NET45
|
||||
// No CodeDOM + This code will not be needed once we transition to the CodeTree
|
||||
|
||||
context.AddStatement(context.BuildCodeString(cw =>
|
||||
{
|
||||
#endif
|
||||
chunk.ValueLocation = ValueGenerator.Location;
|
||||
chunk.ValueLocation = ValueGenerator.Location;
|
||||
#if NET45
|
||||
// No CodeDOM + This code will not be needed once we transition to the CodeTree
|
||||
|
||||
cw.WriteParameterSeparator();
|
||||
cw.WriteSnippet(ValueGenerator.Location.AbsoluteIndex.ToString(CultureInfo.CurrentCulture));
|
||||
cw.WriteEndMethodInvoke();
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
return;
|
||||
}
|
||||
#if NET45
|
||||
// No CodeDOM + This code will not be needed once we transition to the CodeTree
|
||||
|
||||
if (context.Host.EnableInstrumentation)
|
||||
{
|
||||
context.AddContextCall(target, context.Host.GeneratedClassContext.BeginContextMethodName, isLiteral: true);
|
||||
|
|
|
|||
|
|
@ -77,6 +77,8 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
public override void OnComplete()
|
||||
{
|
||||
#if NET45
|
||||
// No CodeDOM + This code will not be needed once we transition to the CodeTree
|
||||
|
||||
Context.FlushBufferedStatement();
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
public override void GenerateStartBlockCode(Block target, CodeGeneratorContext context)
|
||||
{
|
||||
#if NET45
|
||||
// No CodeDOM + This code will not be needed once we transition to the CodeTree
|
||||
|
||||
// Flush the buffered statement since we're interrupting it with a comment.
|
||||
if (!String.IsNullOrEmpty(context.CurrentBufferedStatement))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -36,6 +36,8 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
public override void GenerateCode(Span target, CodeGeneratorContext context)
|
||||
{
|
||||
#if NET45
|
||||
// No CodeDOM + This code will not be needed once we transition to the CodeTree
|
||||
|
||||
var attributeType = new CodeTypeReference(typeof(RazorDirectiveAttribute));
|
||||
var attributeDeclaration = new CodeAttributeDeclaration(
|
||||
attributeType,
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
return;
|
||||
}
|
||||
#if NET45
|
||||
// No CodeDOM + This code will not be needed once we transition to the CodeTree
|
||||
|
||||
if (!context.Host.DesignTimeMode && String.IsNullOrEmpty(target.Content))
|
||||
{
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
public override void GenerateStartBlockCode(Block target, CodeGeneratorContext context)
|
||||
{
|
||||
#if NET45
|
||||
// No CodeDOM + This code will not be needed once we transition to the CodeTree
|
||||
|
||||
string startBlock = context.BuildCodeString(cw =>
|
||||
{
|
||||
cw.WriteStartMethodInvoke(context.Host.GeneratedClassContext.DefineSectionMethodName);
|
||||
|
|
@ -48,6 +50,8 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
public override void GenerateEndBlockCode(Block target, CodeGeneratorContext context)
|
||||
{
|
||||
#if NET45
|
||||
// No CodeDOM + This code will not be needed once we transition to the CodeTree
|
||||
|
||||
string startBlock = context.BuildCodeString(cw =>
|
||||
{
|
||||
cw.WriteEndLambdaDelegate();
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
public override void GenerateCode(Span target, CodeGeneratorContext context)
|
||||
{
|
||||
#if NET45
|
||||
// No CodeDOM + This code will not be needed once we transition to the CodeTree
|
||||
|
||||
context.GeneratedClass.BaseTypes.Clear();
|
||||
context.GeneratedClass.BaseTypes.Add(new CodeTypeReference(ResolveType(context, BaseType.Trim())));
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
public override void GenerateCode(Span target, CodeGeneratorContext context)
|
||||
{
|
||||
#if NET45
|
||||
// No CodeDOM
|
||||
|
||||
if (!context.Host.DesignTimeMode && !String.IsNullOrEmpty(context.Host.GeneratedClassContext.LayoutPropertyName))
|
||||
{
|
||||
context.TargetMethod.Statements.Add(
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
public override void GenerateCode(Span target, CodeGeneratorContext context)
|
||||
{
|
||||
#if NET45
|
||||
// No CodeDOM + This code will not be needed once we transition to the CodeTree
|
||||
|
||||
context.FlushBufferedStatement();
|
||||
|
||||
string generatedCode = context.BuildCodeString(cw =>
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
public override void GenerateStartBlockCode(Block target, CodeGeneratorContext context)
|
||||
{
|
||||
#if NET45
|
||||
// No CodeDOM + This code will not be needed once we transition to the CodeTree
|
||||
|
||||
string generatedCode = context.BuildCodeString(cw =>
|
||||
{
|
||||
cw.WriteStartLambdaExpression(ItemParameterName);
|
||||
|
|
@ -47,6 +49,8 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
public override void GenerateEndBlockCode(Block target, CodeGeneratorContext context)
|
||||
{
|
||||
#if NET45
|
||||
// No CodeDOM + This code will not be needed once we transition to the CodeTree
|
||||
|
||||
string generatedCode = context.BuildCodeString(cw =>
|
||||
{
|
||||
cw.WriteEndLambdaDelegate();
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@ namespace Microsoft.AspNet.Razor.Generator
|
|||
public override void GenerateCode(Span target, CodeGeneratorContext context)
|
||||
{
|
||||
#if NET45
|
||||
// No CodeDOM + This code will not be needed once we transition to the CodeTree
|
||||
|
||||
string generatedCode = context.BuildCodeString(cw =>
|
||||
{
|
||||
cw.WriteSnippet(target.Content);
|
||||
|
|
|
|||
|
|
@ -39,6 +39,8 @@ namespace Microsoft.AspNet.Razor
|
|||
public IList<LineMapping> DesignTimeLineMappings { get; private set; }
|
||||
|
||||
#if NET45
|
||||
// No CodeDOM + This code will not be needed once we transition to the CodeTree
|
||||
|
||||
public CodeCompileUnit CCU { get; set; }
|
||||
public IDictionary<int, GeneratedCodeMapping> OLDDesignTimeLineMappings { get; set; }
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -145,7 +145,10 @@ namespace Microsoft.AspNet.Razor.Parser
|
|||
return CSharpSymbolType.LessThan;
|
||||
default:
|
||||
#if NET45
|
||||
Debug.Fail("FlipBracket must be called with a bracket character");
|
||||
// No Debug.Fail
|
||||
Debug.Fail("FlipBracket must be called with a bracket character");
|
||||
#else
|
||||
Debug.Assert(false, "FlipBracket must be called with a bracket character");
|
||||
#endif
|
||||
return CSharpSymbolType.Unknown;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,7 +90,11 @@ namespace Microsoft.AspNet.Razor.Parser
|
|||
return HtmlSymbolType.OpenAngle;
|
||||
default:
|
||||
#if NET45
|
||||
Debug.Fail("FlipBracket must be called with a bracket character");
|
||||
// No Debug.Fail in CoreCLR
|
||||
|
||||
Debug.Fail("FlipBracket must be called with a bracket character");
|
||||
#else
|
||||
Debug.Assert(false, "FlipBracket must be called with a bracket character");
|
||||
#endif
|
||||
return HtmlSymbolType.Unknown;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -288,7 +288,11 @@ namespace Microsoft.AspNet.Razor.Parser
|
|||
if (_infiniteLoopGuardCount > InfiniteLoopCountThreshold)
|
||||
{
|
||||
#if NET45
|
||||
// No Debug.Fail in CoreCLR
|
||||
|
||||
Debug.Fail("An internal parser error is causing an infinite loop at this location.");
|
||||
#else
|
||||
Debug.Assert(false, "An internal parser error is causing an infinite loop at this location.");
|
||||
#endif
|
||||
_terminated = true;
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -34,9 +34,11 @@ namespace Microsoft.AspNet.Razor.Parser
|
|||
value == '\t' ||
|
||||
value == '\u000B' || // Vertical Tab
|
||||
#if NET45
|
||||
// No GetUnicodeCategory on Char in CoreCLR
|
||||
|
||||
Char.GetUnicodeCategory(value) == UnicodeCategory.SpaceSeparator;
|
||||
#else
|
||||
Char.IsSeparator(value);
|
||||
CharUnicodeInfo.GetUnicodeCategory(value) == UnicodeCategory.SpaceSeparator;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -93,9 +95,11 @@ namespace Microsoft.AspNet.Razor.Parser
|
|||
public static bool IsDecimalDigit(char value)
|
||||
{
|
||||
#if NET45
|
||||
// No GetUnicodeCategory on Char in CoreCLR
|
||||
|
||||
return Char.GetUnicodeCategory(value) == UnicodeCategory.DecimalDigitNumber;
|
||||
#else
|
||||
return Char.IsDigit(value);
|
||||
return CharUnicodeInfo.GetUnicodeCategory(value) == UnicodeCategory.DecimalDigitNumber;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -106,48 +110,57 @@ namespace Microsoft.AspNet.Razor.Parser
|
|||
|
||||
public static bool IsLetter(char value)
|
||||
{
|
||||
UnicodeCategory cat;
|
||||
#if NET45
|
||||
var cat = Char.GetUnicodeCategory(value);
|
||||
// No GetUnicodeCategory on Char in CoreCLR
|
||||
|
||||
cat = Char.GetUnicodeCategory(value);
|
||||
#else
|
||||
cat = CharUnicodeInfo.GetUnicodeCategory(value);
|
||||
#endif
|
||||
return cat == UnicodeCategory.UppercaseLetter
|
||||
|| cat == UnicodeCategory.LowercaseLetter
|
||||
|| cat == UnicodeCategory.TitlecaseLetter
|
||||
|| cat == UnicodeCategory.ModifierLetter
|
||||
|| cat == UnicodeCategory.OtherLetter
|
||||
|| cat == UnicodeCategory.LetterNumber;
|
||||
#else
|
||||
return Char.IsLetter(value);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
public static bool IsFormatting(char value)
|
||||
{
|
||||
#if NET45
|
||||
// No GetUnicodeCategory on Char in CoreCLR
|
||||
|
||||
return Char.GetUnicodeCategory(value) == UnicodeCategory.Format;
|
||||
#else
|
||||
return false; // TODO: Make the above work
|
||||
|
||||
return CharUnicodeInfo.GetUnicodeCategory(value) == UnicodeCategory.Format;
|
||||
#endif
|
||||
}
|
||||
|
||||
public static bool IsCombining(char value)
|
||||
{
|
||||
UnicodeCategory cat;
|
||||
#if NET45
|
||||
var cat = Char.GetUnicodeCategory(value);
|
||||
// No GetUnicodeCategory on Char in CoreCLR
|
||||
|
||||
cat = Char.GetUnicodeCategory(value);
|
||||
#else
|
||||
cat = CharUnicodeInfo.GetUnicodeCategory(value);
|
||||
#endif
|
||||
|
||||
return cat == UnicodeCategory.SpacingCombiningMark || cat == UnicodeCategory.NonSpacingMark;
|
||||
#else
|
||||
return false; // TODO: Make the above work
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static bool IsConnecting(char value)
|
||||
{
|
||||
#if NET45
|
||||
// No GetUnicodeCategory on Char in CoreCLR
|
||||
|
||||
return Char.GetUnicodeCategory(value) == UnicodeCategory.ConnectorPunctuation;
|
||||
#else
|
||||
return false; // TODO: Make the above work
|
||||
return CharUnicodeInfo.GetUnicodeCategory(value) == UnicodeCategory.ConnectorPunctuation;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@ namespace Microsoft.AspNet.Razor
|
|||
/// </summary>
|
||||
public abstract string LanguageName { get; }
|
||||
#if NET45
|
||||
// No CodeDOM in CoreCLR
|
||||
|
||||
/// <summary>
|
||||
/// The type of the CodeDOM provider for this language
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -40,6 +40,8 @@ namespace Microsoft.AspNet.Razor
|
|||
get { return _outputDebuggingEnabled; }
|
||||
}
|
||||
#if NET45
|
||||
// No CodeDOM in CoreCLR
|
||||
|
||||
[SuppressMessage("Microsoft.Security", "CA2141:TransparentMethodsMustNotSatisfyLinkDemandsFxCopRule", Justification = "This is debug only")]
|
||||
[SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Justification = "This is debug only")]
|
||||
[SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.IO.StringWriter.#ctor", Justification = "This is debug only")]
|
||||
|
|
|
|||
|
|
@ -201,6 +201,8 @@ namespace Microsoft.AspNet.Razor
|
|||
return incomingCodeGenerator;
|
||||
}
|
||||
#if NET45
|
||||
// No CodeDOM in CoreCLR
|
||||
|
||||
/// <summary>
|
||||
/// Gets the important CodeDOM nodes generated by the code generator and has a chance to add to them.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -167,6 +167,8 @@ namespace Microsoft.AspNet.Razor
|
|||
generator.DesignTimeMode = Host.DesignTimeMode;
|
||||
generator.Visit(results);
|
||||
#if NET45
|
||||
// No CodeDOM in CoreCLR, this calls into CodeDOM dependent code.
|
||||
|
||||
// Post process code
|
||||
Host.PostProcessGeneratedCode(generator.Context);
|
||||
#endif
|
||||
|
|
@ -176,6 +178,8 @@ namespace Microsoft.AspNet.Razor
|
|||
if (Host.DesignTimeMode)
|
||||
{
|
||||
#if NET45
|
||||
// No CodeDOM in CoreCLR, this calls into CodeDOM dependent code.
|
||||
|
||||
designTimeLineMappings = generator.Context.CodeMappings;
|
||||
#endif
|
||||
}
|
||||
|
|
@ -187,9 +191,12 @@ namespace Microsoft.AspNet.Razor
|
|||
return new GeneratorResults(results, builderResult)
|
||||
{
|
||||
#if NET45
|
||||
// No CodeDOM in CoreCLR, this calls into CodeDOM dependent code.
|
||||
// Also this code will be removed once we transition into the CodeTree
|
||||
|
||||
CCU = generator.Context.CompileUnit,
|
||||
OLDDesignTimeLineMappings = designTimeLineMappings,
|
||||
#endif
|
||||
#endif
|
||||
CT = generator.Context.CodeTreeBuilder.CodeTree
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ using System.Globalization;
|
|||
namespace Microsoft.AspNet.Razor.Text
|
||||
{
|
||||
#if NET45
|
||||
// No Serializable attribute in CoreCLR (no need for it anymore?)
|
||||
[Serializable]
|
||||
#endif
|
||||
public struct SourceLocation : IEquatable<SourceLocation>, IComparable<SourceLocation>
|
||||
|
|
|
|||
|
|
@ -11,13 +11,14 @@ namespace Microsoft.AspNet.Razor.Tokenizer
|
|||
public static bool IsIdentifierStart(char character)
|
||||
{
|
||||
return Char.IsLetter(character) ||
|
||||
character == '_'
|
||||
character == '_' ||
|
||||
#if NET45
|
||||
|| Char.GetUnicodeCategory(character) == UnicodeCategory.LetterNumber
|
||||
// No GetUnicodeCategory on Char in CoreCLR
|
||||
|
||||
Char.GetUnicodeCategory(character) == UnicodeCategory.LetterNumber;
|
||||
#else
|
||||
|| Char.IsLetterOrDigit(character)
|
||||
CharUnicodeInfo.GetUnicodeCategory(character) == UnicodeCategory.LetterNumber;
|
||||
#endif
|
||||
; // Ln
|
||||
}
|
||||
|
||||
public static bool IsIdentifierPart(char character)
|
||||
|
|
@ -39,16 +40,19 @@ namespace Microsoft.AspNet.Razor.Tokenizer
|
|||
|
||||
private static bool IsIdentifierPartByUnicodeCategory(char character)
|
||||
{
|
||||
UnicodeCategory category;
|
||||
#if NET45
|
||||
UnicodeCategory category = Char.GetUnicodeCategory(character);
|
||||
|
||||
// No GetUnicodeCategory on Char in CoreCLR
|
||||
|
||||
category = Char.GetUnicodeCategory(character);
|
||||
#else
|
||||
category = CharUnicodeInfo.GetUnicodeCategory(character);
|
||||
#endif
|
||||
|
||||
return category == UnicodeCategory.NonSpacingMark || // Mn
|
||||
category == UnicodeCategory.SpacingCombiningMark || // Mc
|
||||
category == UnicodeCategory.ConnectorPunctuation || // Pc
|
||||
category == UnicodeCategory.Format; // Cf
|
||||
#else
|
||||
return false; // TODO: Make the above work
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -153,7 +153,11 @@ namespace Microsoft.AspNet.Razor.Tokenizer
|
|||
return EndSymbol(HtmlSymbolType.DoubleHyphen);
|
||||
default:
|
||||
#if NET45
|
||||
Debug.Fail("Unexpected symbol!");
|
||||
// No Debug.Fail in CoreCLR
|
||||
|
||||
Debug.Fail("Unexpected symbol!");
|
||||
#else
|
||||
Debug.Assert(false, "Unexpected symbol");
|
||||
#endif
|
||||
return EndSymbol(HtmlSymbolType.Unknown);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -322,7 +322,11 @@ namespace Microsoft.AspNet.Razor.Tokenizer
|
|||
internal void AssertCurrent(char current)
|
||||
{
|
||||
#if NET45
|
||||
// No Debug.Assert with this many arguments in CoreCLR
|
||||
|
||||
Debug.Assert(CurrentCharacter == current, "CurrentCharacter Assumption violated", "Assumed that the current character would be {0}, but it is actually {1}", current, CurrentCharacter);
|
||||
#else
|
||||
Debug.Assert(CurrentCharacter == current, String.Format("CurrentCharacter Assumption violated. Assumed that the current character would be {0}, but it is actually {1}", current, CurrentCharacter));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue