Delete trailing whitespace
- #EngineeringDay - Total replaced: 506 Matching files: 118 Did not change any files under test/Microsoft.AspNet.Razor.Test/TestFiles - avoiding need to redo hashes
This commit is contained in:
parent
15348b0468
commit
0f724a51df
|
|
@ -1,17 +1,17 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<root>
|
<root>
|
||||||
<!--
|
<!--
|
||||||
Microsoft ResX Schema
|
Microsoft ResX Schema
|
||||||
|
|
||||||
Version 2.0
|
Version 2.0
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
The primary goals of this format is to allow a simple XML format
|
||||||
that is mostly human readable. The generation and parsing of the
|
that is mostly human readable. The generation and parsing of the
|
||||||
various data types are done through the TypeConverter classes
|
various data types are done through the TypeConverter classes
|
||||||
associated with the data types.
|
associated with the data types.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
... ado.net/XML headers & schema ...
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
<resheader name="version">2.0</resheader>
|
<resheader name="version">2.0</resheader>
|
||||||
|
|
@ -26,36 +26,36 @@
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
<comment>This is a comment</comment>
|
<comment>This is a comment</comment>
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
There are any number of "resheader" rows that contain simple
|
||||||
name/value pairs.
|
name/value pairs.
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
Each data row contains a name, and value. The row also contains a
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
text/value conversion through the TypeConverter architecture.
|
text/value conversion through the TypeConverter architecture.
|
||||||
Classes that don't support this are serialized and stored with the
|
Classes that don't support this are serialized and stored with the
|
||||||
mimetype set.
|
mimetype set.
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
The mimetype is used for serialized objects, and tells the
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
read any of the formats listed below.
|
read any of the formats listed below.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
value : The object must be serialized with
|
value : The object must be serialized with
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
value : The object must be serialized with
|
value : The object must be serialized with
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
value : The object must be serialized into a byte array
|
value : The object must be serialized into a byte array
|
||||||
: using a System.ComponentModel.TypeConverter
|
: using a System.ComponentModel.TypeConverter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
-->
|
-->
|
||||||
|
|
|
||||||
|
|
@ -73,8 +73,8 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
||||||
private static TagHelperAttributeDescriptor ToAttributeDescriptor(PropertyInfo property)
|
private static TagHelperAttributeDescriptor ToAttributeDescriptor(PropertyInfo property)
|
||||||
{
|
{
|
||||||
var attributeNameAttribute = property.GetCustomAttribute<HtmlAttributeNameAttribute>(inherit: false);
|
var attributeNameAttribute = property.GetCustomAttribute<HtmlAttributeNameAttribute>(inherit: false);
|
||||||
var attributeName = attributeNameAttribute != null ?
|
var attributeName = attributeNameAttribute != null ?
|
||||||
attributeNameAttribute.Name :
|
attributeNameAttribute.Name :
|
||||||
property.Name;
|
property.Name;
|
||||||
|
|
||||||
return new TagHelperAttributeDescriptor(attributeName, property.Name, property.PropertyType.FullName);
|
return new TagHelperAttributeDescriptor(attributeName, property.Name, property.PropertyType.FullName);
|
||||||
|
|
@ -85,7 +85,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
||||||
var typeInfo = type.GetTypeInfo();
|
var typeInfo = type.GetTypeInfo();
|
||||||
var contentBehaviorAttribute = typeInfo.GetCustomAttribute<ContentBehaviorAttribute>(inherit: false);
|
var contentBehaviorAttribute = typeInfo.GetCustomAttribute<ContentBehaviorAttribute>(inherit: false);
|
||||||
|
|
||||||
return contentBehaviorAttribute != null ?
|
return contentBehaviorAttribute != null ?
|
||||||
contentBehaviorAttribute.ContentBehavior :
|
contentBehaviorAttribute.ContentBehavior :
|
||||||
ContentBehavior.None;
|
ContentBehavior.None;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Resolves all <see cref="TagHelperDescriptor"/>s for <see cref="ITagHelper"/>s from the given
|
/// Resolves all <see cref="TagHelperDescriptor"/>s for <see cref="ITagHelper"/>s from the given
|
||||||
/// <paramref name="assemblyName"/>.
|
/// <paramref name="assemblyName"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="assemblyName">
|
/// <param name="assemblyName">
|
||||||
|
|
@ -105,7 +105,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
||||||
nameof(lookupText));
|
nameof(lookupText));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Grab the assembly name from the lookup text strings. Due to our supported lookupText formats it will
|
// Grab the assembly name from the lookup text strings. Due to our supported lookupText formats it will
|
||||||
// always be the last element provided.
|
// always be the last element provided.
|
||||||
var assemblyName = lookupStrings.Last().Trim();
|
var assemblyName = lookupStrings.Last().Trim();
|
||||||
string typeName = null;
|
string typeName = null;
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
||||||
/// Calls the <see cref="ITagHelper.ProcessAsync"/> method on <see cref="ITagHelper"/>s.
|
/// Calls the <see cref="ITagHelper.ProcessAsync"/> method on <see cref="ITagHelper"/>s.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="context">Contains information associated with running <see cref="ITagHelper"/>s.</param>
|
/// <param name="context">Contains information associated with running <see cref="ITagHelper"/>s.</param>
|
||||||
/// <returns>Resulting <see cref="TagHelperOutput"/> from processing all of the
|
/// <returns>Resulting <see cref="TagHelperOutput"/> from processing all of the
|
||||||
/// <paramref name="context"/>'s <see cref="ITagHelper"/>s.</returns>
|
/// <paramref name="context"/>'s <see cref="ITagHelper"/>s.</returns>
|
||||||
public async Task<TagHelperOutput> RunAsync([NotNull] TagHelperExecutionContext context)
|
public async Task<TagHelperOutput> RunAsync([NotNull] TagHelperExecutionContext context)
|
||||||
{
|
{
|
||||||
|
|
@ -27,7 +27,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="context">Contains information associated with running <see cref="ITagHelper"/>s.</param>
|
/// <param name="context">Contains information associated with running <see cref="ITagHelper"/>s.</param>
|
||||||
/// <param name="bufferedBody">Contains the buffered content of the current HTML tag.</param>
|
/// <param name="bufferedBody">Contains the buffered content of the current HTML tag.</param>
|
||||||
/// <returns>Resulting <see cref="TagHelperOutput"/> from processing all of the
|
/// <returns>Resulting <see cref="TagHelperOutput"/> from processing all of the
|
||||||
/// <paramref name="context"/>'s <see cref="ITagHelper"/>s.</returns>
|
/// <paramref name="context"/>'s <see cref="ITagHelper"/>s.</returns>
|
||||||
public async Task<TagHelperOutput> RunAsync([NotNull] TagHelperExecutionContext context,
|
public async Task<TagHelperOutput> RunAsync([NotNull] TagHelperExecutionContext context,
|
||||||
[NotNull] TextWriter bufferedBody)
|
[NotNull] TextWriter bufferedBody)
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
||||||
/// all valid <see cref="ITagHelper"/> <see cref="Type"/>s.
|
/// all valid <see cref="ITagHelper"/> <see cref="Type"/>s.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="name">The name of an <see cref="Assembly"/> to search.</param>
|
/// <param name="name">The name of an <see cref="Assembly"/> to search.</param>
|
||||||
/// <returns>An <see cref="IEnumerable{Type}"/> of valid <see cref="ITagHelper"/> <see cref="Type"/>s.</returns>
|
/// <returns>An <see cref="IEnumerable{Type}"/> of valid <see cref="ITagHelper"/> <see cref="Type"/>s.</returns>
|
||||||
public IEnumerable<Type> Resolve(string name)
|
public IEnumerable<Type> Resolve(string name)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(name))
|
if (string.IsNullOrEmpty(name))
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
"net45": { },
|
"net45": { },
|
||||||
"aspnet50": { },
|
"aspnet50": { },
|
||||||
"aspnetcore50": {
|
"aspnetcore50": {
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"System.Reflection.Extensions": "4.0.0-beta-*"
|
"System.Reflection.Extensions": "4.0.0-beta-*"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,17 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<root>
|
<root>
|
||||||
<!--
|
<!--
|
||||||
Microsoft ResX Schema
|
Microsoft ResX Schema
|
||||||
|
|
||||||
Version 2.0
|
Version 2.0
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
The primary goals of this format is to allow a simple XML format
|
||||||
that is mostly human readable. The generation and parsing of the
|
that is mostly human readable. The generation and parsing of the
|
||||||
various data types are done through the TypeConverter classes
|
various data types are done through the TypeConverter classes
|
||||||
associated with the data types.
|
associated with the data types.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
... ado.net/XML headers & schema ...
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
<resheader name="version">2.0</resheader>
|
<resheader name="version">2.0</resheader>
|
||||||
|
|
@ -26,36 +26,36 @@
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
<comment>This is a comment</comment>
|
<comment>This is a comment</comment>
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
There are any number of "resheader" rows that contain simple
|
||||||
name/value pairs.
|
name/value pairs.
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
Each data row contains a name, and value. The row also contains a
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
text/value conversion through the TypeConverter architecture.
|
text/value conversion through the TypeConverter architecture.
|
||||||
Classes that don't support this are serialized and stored with the
|
Classes that don't support this are serialized and stored with the
|
||||||
mimetype set.
|
mimetype set.
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
The mimetype is used for serialized objects, and tells the
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
read any of the formats listed below.
|
read any of the formats listed below.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
value : The object must be serialized with
|
value : The object must be serialized with
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
value : The object must be serialized with
|
value : The object must be serialized with
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
value : The object must be serialized into a byte array
|
value : The object must be serialized into a byte array
|
||||||
: using a System.ComponentModel.TypeConverter
|
: using a System.ComponentModel.TypeConverter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
-->
|
-->
|
||||||
|
|
|
||||||
|
|
@ -58,9 +58,9 @@ namespace Microsoft.AspNet.Razor.Editor
|
||||||
return PartialParseResult.Rejected;
|
return PartialParseResult.Rejected;
|
||||||
}
|
}
|
||||||
|
|
||||||
// In some editors intellisense insertions are handled as "dotless commits". If an intellisense selection is confirmed
|
// In some editors intellisense insertions are handled as "dotless commits". If an intellisense selection is confirmed
|
||||||
// via something like '.' a dotless commit will append a '.' and then insert the remaining intellisense selection prior
|
// via something like '.' a dotless commit will append a '.' and then insert the remaining intellisense selection prior
|
||||||
// to the appended '.'. This 'if' statement attempts to accept the intermediate steps of a dotless commit via
|
// to the appended '.'. This 'if' statement attempts to accept the intermediate steps of a dotless commit via
|
||||||
// intellisense. It will accept two cases:
|
// intellisense. It will accept two cases:
|
||||||
// 1. '@foo.' -> '@foobaz.'.
|
// 1. '@foo.' -> '@foobaz.'.
|
||||||
// 2. '@foobaz..' -> '@foobaz.bar.'. Includes Sub-cases '@foobaz()..' -> '@foobaz().bar.' etc.
|
// 2. '@foobaz..' -> '@foobaz.bar.'. Includes Sub-cases '@foobaz()..' -> '@foobaz().bar.' etc.
|
||||||
|
|
@ -128,7 +128,7 @@ namespace Microsoft.AspNet.Razor.Editor
|
||||||
}
|
}
|
||||||
|
|
||||||
// Once a dotless commit has been performed you then have something like '@DateTime.'. This scenario is used to detect the
|
// Once a dotless commit has been performed you then have something like '@DateTime.'. This scenario is used to detect the
|
||||||
// situation when you try to perform another dotless commit resulting in a textchange with '..'. Completing 'DateTime.Now'
|
// situation when you try to perform another dotless commit resulting in a textchange with '..'. Completing 'DateTime.Now'
|
||||||
// in intellisense with a '.' could result in: '@DateTime.' -> '@DateTime..' -> '@DateTime.Now.' which is accepted.
|
// in intellisense with a '.' could result in: '@DateTime.' -> '@DateTime..' -> '@DateTime.Now.' which is accepted.
|
||||||
private static bool IsSecondaryDotlessCommitInsertion(Span target, TextChange change)
|
private static bool IsSecondaryDotlessCommitInsertion(Span target, TextChange change)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ namespace Microsoft.AspNet.Razor.Generator
|
||||||
/// The current C# rendering mode.
|
/// The current C# rendering mode.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// <see cref="ExpressionRenderingMode.WriteToOutput"/> forces C# generation to write
|
/// <see cref="ExpressionRenderingMode.WriteToOutput"/> forces C# generation to write
|
||||||
/// <see cref="Compiler.Chunk"/>s to the output page, i.e. WriteLiteral("Hello World").
|
/// <see cref="Compiler.Chunk"/>s to the output page, i.e. WriteLiteral("Hello World").
|
||||||
/// <see cref="ExpressionRenderingMode.InjectCode"/> writes <see cref="Compiler.Chunk"/> values in their
|
/// <see cref="ExpressionRenderingMode.InjectCode"/> writes <see cref="Compiler.Chunk"/> values in their
|
||||||
/// rawest form, i.g. "Hello World".
|
/// rawest form, i.g. "Hello World".
|
||||||
|
|
@ -46,7 +46,7 @@ namespace Microsoft.AspNet.Razor.Generator
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// If <see cref="TargetWriterName"/> is <c>null</c> values will be written using a default write method
|
/// If <see cref="TargetWriterName"/> is <c>null</c> values will be written using a default write method
|
||||||
/// i.e. WriteLiteral("Hello World").
|
/// i.e. WriteLiteral("Hello World").
|
||||||
/// If <see cref="TargetWriterName"/> is not <c>null</c> values will be written to the given
|
/// If <see cref="TargetWriterName"/> is not <c>null</c> values will be written to the given
|
||||||
/// <see cref="TargetWriterName"/>, i.e. WriteLiteralTo(myWriter, "Hello World").
|
/// <see cref="TargetWriterName"/>, i.e. WriteLiteralTo(myWriter, "Hello World").
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public string TargetWriterName { get; set; }
|
public string TargetWriterName { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -443,9 +443,9 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
|
||||||
}
|
}
|
||||||
if (i > 0 && i % 80 == 0)
|
if (i > 0 && i % 80 == 0)
|
||||||
{
|
{
|
||||||
// If current character is a high surrogate and the following
|
// If current character is a high surrogate and the following
|
||||||
// character is a low surrogate, don't break them.
|
// character is a low surrogate, don't break them.
|
||||||
// Otherwise when we write the string to a file, we might lose
|
// Otherwise when we write the string to a file, we might lose
|
||||||
// the characters.
|
// the characters.
|
||||||
if (Char.IsHighSurrogate(literal[i])
|
if (Char.IsHighSurrogate(literal[i])
|
||||||
&& (i < literal.Length - 1)
|
&& (i < literal.Length - 1)
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
|
||||||
// In design time: __o = somecode();
|
// In design time: __o = somecode();
|
||||||
// In Run time: Write(somecode());
|
// In Run time: Write(somecode());
|
||||||
//
|
//
|
||||||
// In both cases the padding would have been 1 space to remote the space the @ symbol takes, which will be smaller than the 6
|
// In both cases the padding would have been 1 space to remote the space the @ symbol takes, which will be smaller than the 6
|
||||||
// chars the hidden generated code takes.
|
// chars the hidden generated code takes.
|
||||||
if (padding < 0)
|
if (padding < 0)
|
||||||
{
|
{
|
||||||
|
|
@ -110,7 +110,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
|
||||||
|
|
||||||
while (firstSpanInLine.Previous != null)
|
while (firstSpanInLine.Previous != null)
|
||||||
{
|
{
|
||||||
// When scanning previous spans we need to be break down the spans with spaces. The parser combines
|
// When scanning previous spans we need to be break down the spans with spaces. The parser combines
|
||||||
// whitespace into existing spans so you'll see tabs, newlines etc. within spans. We only care about
|
// whitespace into existing spans so you'll see tabs, newlines etc. within spans. We only care about
|
||||||
// the \t in existing spans.
|
// the \t in existing spans.
|
||||||
var previousContent = firstSpanInLine.Previous.Content ?? String.Empty;
|
var previousContent = firstSpanInLine.Previous.Content ?? String.Empty;
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="bodyVisitor">The <see cref="IChunkVisitor"/> used to render chunks found in the body.</param>
|
/// <param name="bodyVisitor">The <see cref="IChunkVisitor"/> used to render chunks found in the body.</param>
|
||||||
/// <param name="writer">The <see cref="CSharpCodeWriter"/> used to write code.</param>
|
/// <param name="writer">The <see cref="CSharpCodeWriter"/> used to write code.</param>
|
||||||
/// <param name="context">A <see cref="CodeBuilderContext"/> instance that contains information about
|
/// <param name="context">A <see cref="CodeBuilderContext"/> instance that contains information about
|
||||||
/// the current code generation process.</param>
|
/// the current code generation process.</param>
|
||||||
public CSharpTagHelperCodeRenderer([NotNull] IChunkVisitor bodyVisitor,
|
public CSharpTagHelperCodeRenderer([NotNull] IChunkVisitor bodyVisitor,
|
||||||
[NotNull] CSharpCodeWriter writer,
|
[NotNull] CSharpCodeWriter writer,
|
||||||
|
|
@ -194,13 +194,13 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
|
||||||
// Bufferable attributes are attributes that can have Razor code inside of them.
|
// Bufferable attributes are attributes that can have Razor code inside of them.
|
||||||
var bufferableAttribute = IsStringAttribute(attributeDescriptor);
|
var bufferableAttribute = IsStringAttribute(attributeDescriptor);
|
||||||
|
|
||||||
// Plain text values are non Razor code (@DateTime.Now) values. If an attribute is bufferable it
|
// Plain text values are non Razor code (@DateTime.Now) values. If an attribute is bufferable it
|
||||||
// may be more than just a plain text value, it may also contain Razor code which is why we attempt
|
// may be more than just a plain text value, it may also contain Razor code which is why we attempt
|
||||||
// to retrieve a plain text value here.
|
// to retrieve a plain text value here.
|
||||||
string textValue;
|
string textValue;
|
||||||
var isPlainTextValue = TryGetPlainTextValue(attributeValueChunk, out textValue);
|
var isPlainTextValue = TryGetPlainTextValue(attributeValueChunk, out textValue);
|
||||||
|
|
||||||
// If we haven't recorded a value and we need to buffer an attribute value and the value is not
|
// If we haven't recorded a value and we need to buffer an attribute value and the value is not
|
||||||
// plain text then we need to prepare the value prior to setting it below.
|
// plain text then we need to prepare the value prior to setting it below.
|
||||||
if (!attributeValueRecorded && bufferableAttribute && !isPlainTextValue)
|
if (!attributeValueRecorded && bufferableAttribute && !isPlainTextValue)
|
||||||
{
|
{
|
||||||
|
|
@ -239,7 +239,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// TODO: Make complex types in non-bufferable attributes work in
|
// TODO: Make complex types in non-bufferable attributes work in
|
||||||
// https://github.com/aspnet/Razor/issues/129
|
// https://github.com/aspnet/Razor/issues/129
|
||||||
if (!isPlainTextValue)
|
if (!isPlainTextValue)
|
||||||
{
|
{
|
||||||
|
|
@ -291,7 +291,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
|
||||||
var attributeValue = htmlAttribute.Value;
|
var attributeValue = htmlAttribute.Value;
|
||||||
var isPlainTextValue = TryGetPlainTextValue(attributeValue, out textValue);
|
var isPlainTextValue = TryGetPlainTextValue(attributeValue, out textValue);
|
||||||
|
|
||||||
// HTML attributes are always strings. So if this value is not plain text i.e. if the value contains
|
// HTML attributes are always strings. So if this value is not plain text i.e. if the value contains
|
||||||
// C# code, then we need to buffer it.
|
// C# code, then we need to buffer it.
|
||||||
if (!isPlainTextValue)
|
if (!isPlainTextValue)
|
||||||
{
|
{
|
||||||
|
|
@ -305,7 +305,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
|
||||||
}
|
}
|
||||||
|
|
||||||
_writer.WriteStartInstanceMethodInvocation(
|
_writer.WriteStartInstanceMethodInvocation(
|
||||||
ExecutionContextVariableName,
|
ExecutionContextVariableName,
|
||||||
_tagHelperContext.ExecutionContextAddHtmlAttributeMethodName);
|
_tagHelperContext.ExecutionContextAddHtmlAttributeMethodName);
|
||||||
_writer.WriteStringLiteral(htmlAttribute.Key)
|
_writer.WriteStringLiteral(htmlAttribute.Key)
|
||||||
.WriteParameterSeparator();
|
.WriteParameterSeparator();
|
||||||
|
|
@ -435,7 +435,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
|
||||||
private void BuildBufferedWritingScope(IList<Chunk> chunks)
|
private void BuildBufferedWritingScope(IList<Chunk> chunks)
|
||||||
{
|
{
|
||||||
// We're building a writing scope around the provided chunks which captures everything written from the
|
// We're building a writing scope around the provided chunks which captures everything written from the
|
||||||
// page. Therefore, we do not want to write to any other buffer since we're using the pages buffer to
|
// page. Therefore, we do not want to write to any other buffer since we're using the pages buffer to
|
||||||
// ensure we capture all content that's written, directly or indirectly.
|
// ensure we capture all content that's written, directly or indirectly.
|
||||||
var oldWriter = _context.TargetWriterName;
|
var oldWriter = _context.TargetWriterName;
|
||||||
_context.TargetWriterName = null;
|
_context.TargetWriterName = null;
|
||||||
|
|
@ -483,7 +483,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
|
||||||
{
|
{
|
||||||
if (_designTimeMode)
|
if (_designTimeMode)
|
||||||
{
|
{
|
||||||
// There is no value buffer in design time mode but we still want to write out a value. We write a
|
// There is no value buffer in design time mode but we still want to write out a value. We write a
|
||||||
// value to ensure the tag helper's property type is string.
|
// value to ensure the tag helper's property type is string.
|
||||||
writer.Write("string.Empty");
|
writer.Write("string.Empty");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
|
||||||
|
|
||||||
Writer.WriteStartAssignment(TagHelperDirectiveSyntaxHelper);
|
Writer.WriteStartAssignment(TagHelperDirectiveSyntaxHelper);
|
||||||
|
|
||||||
// The parsing mechanism for the add/remove TagHelper chunk (CSharpCodeParser.TagHelperDirective())
|
// The parsing mechanism for the add/remove TagHelper chunk (CSharpCodeParser.TagHelperDirective())
|
||||||
// removes quotes that surround the lookupText.
|
// removes quotes that surround the lookupText.
|
||||||
_csharpCodeVisitor.CreateExpressionCodeMapping(
|
_csharpCodeVisitor.CreateExpressionCodeMapping(
|
||||||
string.Format(
|
string.Format(
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
|
||||||
{
|
{
|
||||||
private CSharpCodeVisitor _csharpCodeVisitor;
|
private CSharpCodeVisitor _csharpCodeVisitor;
|
||||||
|
|
||||||
public CSharpTypeMemberVisitor([NotNull] CSharpCodeVisitor csharpCodeVisitor,
|
public CSharpTypeMemberVisitor([NotNull] CSharpCodeVisitor csharpCodeVisitor,
|
||||||
[NotNull] CSharpCodeWriter writer,
|
[NotNull] CSharpCodeWriter writer,
|
||||||
[NotNull] CodeBuilderContext context)
|
[NotNull] CodeBuilderContext context)
|
||||||
: base(writer, context)
|
: base(writer, context)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler
|
||||||
else if (chunk is TypeMemberChunk)
|
else if (chunk is TypeMemberChunk)
|
||||||
{
|
{
|
||||||
Visit((TypeMemberChunk)chunk);
|
Visit((TypeMemberChunk)chunk);
|
||||||
}
|
}
|
||||||
else if (chunk is UsingChunk)
|
else if (chunk is UsingChunk)
|
||||||
{
|
{
|
||||||
Visit((UsingChunk)chunk);
|
Visit((UsingChunk)chunk);
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler
|
||||||
// Check the first character of the current write operation.
|
// Check the first character of the current write operation.
|
||||||
builder[builder.Length - data.Length] == '\n')
|
builder[builder.Length - data.Length] == '\n')
|
||||||
{
|
{
|
||||||
// This is newline that's spread across two writes. Skip the first character of the
|
// This is newline that's spread across two writes. Skip the first character of the
|
||||||
// current write operation.
|
// current write operation.
|
||||||
//
|
//
|
||||||
// We don't need to increment our newline counter because we already did that when we
|
// We don't need to increment our newline counter because we already did that when we
|
||||||
|
|
@ -107,7 +107,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler
|
||||||
trailingPartStart = 1;
|
trailingPartStart = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Iterate the string, stopping at each occurrence of a newline character. This lets us count the
|
// Iterate the string, stopping at each occurrence of a newline character. This lets us count the
|
||||||
// newline occurrences and keep the index of the last one.
|
// newline occurrences and keep the index of the last one.
|
||||||
while ((i = data.IndexOfAny(NewLineCharacters, i)) >= 0)
|
while ((i = data.IndexOfAny(NewLineCharacters, i)) >= 0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
namespace Microsoft.AspNet.Razor.Generator.Compiler
|
namespace Microsoft.AspNet.Razor.Generator.Compiler
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A <see cref="Chunk"/> used to look up <see cref="TagHelpers.TagHelperDescriptor"/>s that should be ignored
|
/// A <see cref="Chunk"/> used to look up <see cref="TagHelpers.TagHelperDescriptor"/>s that should be ignored
|
||||||
/// within the Razor page.
|
/// within the Razor page.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class RemoveTagHelperChunk : Chunk
|
public class RemoveTagHelperChunk : Chunk
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ namespace Microsoft.AspNet.Razor.Generator
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <example>
|
/// <example>
|
||||||
/// If @foo is rendered with WriteToOutput, the code generator would output the following code:
|
/// If @foo is rendered with WriteToOutput, the code generator would output the following code:
|
||||||
///
|
///
|
||||||
/// Write(foo);
|
/// Write(foo);
|
||||||
/// </example>
|
/// </example>
|
||||||
WriteToOutput,
|
WriteToOutput,
|
||||||
|
|
@ -21,7 +21,7 @@ namespace Microsoft.AspNet.Razor.Generator
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <example>
|
/// <example>
|
||||||
/// If @foo is rendered with InjectCode, the code generator would output the following code:
|
/// If @foo is rendered with InjectCode, the code generator would output the following code:
|
||||||
///
|
///
|
||||||
/// foo
|
/// foo
|
||||||
/// </example>
|
/// </example>
|
||||||
InjectCode
|
InjectCode
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ namespace Microsoft.AspNet.Razor.Generator
|
||||||
public static readonly string DefaultWriteAttributeMethodName = "WriteAttribute";
|
public static readonly string DefaultWriteAttributeMethodName = "WriteAttribute";
|
||||||
public static readonly string DefaultWriteAttributeToMethodName = "WriteAttributeTo";
|
public static readonly string DefaultWriteAttributeToMethodName = "WriteAttributeTo";
|
||||||
|
|
||||||
public static readonly GeneratedClassContext Default =
|
public static readonly GeneratedClassContext Default =
|
||||||
new GeneratedClassContext(DefaultExecuteMethodName,
|
new GeneratedClassContext(DefaultExecuteMethodName,
|
||||||
DefaultWriteMethodName,
|
DefaultWriteMethodName,
|
||||||
DefaultWriteLiteralMethodName,
|
DefaultWriteLiteralMethodName,
|
||||||
|
|
@ -30,19 +30,19 @@ namespace Microsoft.AspNet.Razor.Generator
|
||||||
if (string.IsNullOrEmpty(executeMethodName))
|
if (string.IsNullOrEmpty(executeMethodName))
|
||||||
{
|
{
|
||||||
throw new ArgumentException(
|
throw new ArgumentException(
|
||||||
CommonResources.Argument_Cannot_Be_Null_Or_Empty,
|
CommonResources.Argument_Cannot_Be_Null_Or_Empty,
|
||||||
nameof(executeMethodName));
|
nameof(executeMethodName));
|
||||||
}
|
}
|
||||||
if (string.IsNullOrEmpty(writeMethodName))
|
if (string.IsNullOrEmpty(writeMethodName))
|
||||||
{
|
{
|
||||||
throw new ArgumentException(
|
throw new ArgumentException(
|
||||||
CommonResources.Argument_Cannot_Be_Null_Or_Empty,
|
CommonResources.Argument_Cannot_Be_Null_Or_Empty,
|
||||||
nameof(writeMethodName));
|
nameof(writeMethodName));
|
||||||
}
|
}
|
||||||
if (string.IsNullOrEmpty(writeLiteralMethodName))
|
if (string.IsNullOrEmpty(writeLiteralMethodName))
|
||||||
{
|
{
|
||||||
throw new ArgumentException(
|
throw new ArgumentException(
|
||||||
CommonResources.Argument_Cannot_Be_Null_Or_Empty,
|
CommonResources.Argument_Cannot_Be_Null_Or_Empty,
|
||||||
nameof(writeLiteralMethodName));
|
nameof(writeLiteralMethodName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -69,8 +69,8 @@ namespace Microsoft.AspNet.Razor.Generator
|
||||||
string writeLiteralToMethodName,
|
string writeLiteralToMethodName,
|
||||||
string templateTypeName,
|
string templateTypeName,
|
||||||
GeneratedTagHelperContext generatedTagHelperContext)
|
GeneratedTagHelperContext generatedTagHelperContext)
|
||||||
: this(executeMethodName,
|
: this(executeMethodName,
|
||||||
writeMethodName,
|
writeMethodName,
|
||||||
writeLiteralMethodName,
|
writeLiteralMethodName,
|
||||||
generatedTagHelperContext)
|
generatedTagHelperContext)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -71,10 +71,10 @@ namespace Microsoft.AspNet.Razor.Generator
|
||||||
{
|
{
|
||||||
if (_context == null)
|
if (_context == null)
|
||||||
{
|
{
|
||||||
_context = new CodeGeneratorContext(Host,
|
_context = new CodeGeneratorContext(Host,
|
||||||
ClassName,
|
ClassName,
|
||||||
RootNamespaceName,
|
RootNamespaceName,
|
||||||
SourceFileName,
|
SourceFileName,
|
||||||
GenerateLinePragmas);
|
GenerateLinePragmas);
|
||||||
Initialize(_context);
|
Initialize(_context);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ namespace Microsoft.AspNet.Razor.Generator
|
||||||
/// <param name="target">
|
/// <param name="target">
|
||||||
/// The <see cref="Block"/> responsible for this <see cref="TagHelperCodeGenerator"/>.
|
/// The <see cref="Block"/> responsible for this <see cref="TagHelperCodeGenerator"/>.
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <param name="context">A <see cref="CodeGeneratorContext"/> instance that contains information about
|
/// <param name="context">A <see cref="CodeGeneratorContext"/> instance that contains information about
|
||||||
/// the current code generation process.</param>
|
/// the current code generation process.</param>
|
||||||
public override void GenerateStartBlockCode(Block target, CodeGeneratorContext context)
|
public override void GenerateStartBlockCode(Block target, CodeGeneratorContext context)
|
||||||
{
|
{
|
||||||
|
|
@ -88,7 +88,7 @@ namespace Microsoft.AspNet.Razor.Generator
|
||||||
/// <param name="target">
|
/// <param name="target">
|
||||||
/// The <see cref="Block"/> responsible for this <see cref="TagHelperCodeGenerator"/>.
|
/// The <see cref="Block"/> responsible for this <see cref="TagHelperCodeGenerator"/>.
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <param name="context">A <see cref="CodeGeneratorContext"/> instance that contains information about
|
/// <param name="context">A <see cref="CodeGeneratorContext"/> instance that contains information about
|
||||||
/// the current code generation process.</param>
|
/// the current code generation process.</param>
|
||||||
public override void GenerateEndBlockCode(Block target, CodeGeneratorContext context)
|
public override void GenerateEndBlockCode(Block target, CodeGeneratorContext context)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ namespace Microsoft.AspNet.Razor.Generator
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the text used to look up <see cref="TagHelpers.TagHelperDescriptor"/>s that should be added to or
|
/// Gets the text used to look up <see cref="TagHelpers.TagHelperDescriptor"/>s that should be added to or
|
||||||
/// removed from the Razor page.
|
/// removed from the Razor page.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string LookupText { get; }
|
public string LookupText { get; }
|
||||||
|
|
@ -37,13 +37,13 @@ namespace Microsoft.AspNet.Razor.Generator
|
||||||
public bool RemoveTagHelperDescriptors { get; }
|
public bool RemoveTagHelperDescriptors { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Generates <see cref="Compiler.AddTagHelperChunk"/>s if <see cref="RemoveTagHelperDescriptors"/> is
|
/// Generates <see cref="Compiler.AddTagHelperChunk"/>s if <see cref="RemoveTagHelperDescriptors"/> is
|
||||||
/// <c>true</c>, otherwise <see cref="Compiler.RemoveTagHelperChunk"/>s are generated.
|
/// <c>true</c>, otherwise <see cref="Compiler.RemoveTagHelperChunk"/>s are generated.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="target">
|
/// <param name="target">
|
||||||
/// The <see cref="Span"/> responsible for this <see cref="AddOrRemoveTagHelperCodeGenerator"/>.
|
/// The <see cref="Span"/> responsible for this <see cref="AddOrRemoveTagHelperCodeGenerator"/>.
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <param name="context">A <see cref="CodeGeneratorContext"/> instance that contains information about
|
/// <param name="context">A <see cref="CodeGeneratorContext"/> instance that contains information about
|
||||||
/// the current code generation process.</param>
|
/// the current code generation process.</param>
|
||||||
public override void GenerateCode(Span target, CodeGeneratorContext context)
|
public override void GenerateCode(Span target, CodeGeneratorContext context)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@ namespace Microsoft.AspNet.Razor
|
||||||
public class GeneratorResults : ParserResults
|
public class GeneratorResults : ParserResults
|
||||||
{
|
{
|
||||||
public GeneratorResults(ParserResults parserResults, CodeBuilderResult codeBuilderResult, CodeTree codeTree)
|
public GeneratorResults(ParserResults parserResults, CodeBuilderResult codeBuilderResult, CodeTree codeTree)
|
||||||
: this(parserResults.Document,
|
: this(parserResults.Document,
|
||||||
parserResults.ParserErrors,
|
parserResults.ParserErrors,
|
||||||
codeBuilderResult,
|
codeBuilderResult,
|
||||||
codeTree)
|
codeTree)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
|
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
// This file is used by Code Analysis to maintain SuppressMessage
|
// This file is used by Code Analysis to maintain SuppressMessage
|
||||||
// attributes that are applied to this project.
|
// attributes that are applied to this project.
|
||||||
// Project-level suppressions either have no target or are given
|
// Project-level suppressions either have no target or are given
|
||||||
// a specific target and scoped to a namespace, type, member, etc.
|
// a specific target and scoped to a namespace, type, member, etc.
|
||||||
//
|
//
|
||||||
// To add a suppression to this file, right-click the message in the
|
// To add a suppression to this file, right-click the message in the
|
||||||
// Error List, point to "Suppress Message(s)", and click
|
// Error List, point to "Suppress Message(s)", and click
|
||||||
// "In Project Suppression File".
|
// "In Project Suppression File".
|
||||||
// You do not need to add suppressions to this file manually.
|
// You do not need to add suppressions to this file manually.
|
||||||
|
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -241,7 +241,7 @@ namespace Microsoft.AspNet.Razor.Parser
|
||||||
var blockGen = new HelperCodeGenerator(signature, headerComplete);
|
var blockGen = new HelperCodeGenerator(signature, headerComplete);
|
||||||
Context.CurrentBlock.CodeGenerator = blockGen;
|
Context.CurrentBlock.CodeGenerator = blockGen;
|
||||||
|
|
||||||
// The block will generate appropriate code,
|
// The block will generate appropriate code,
|
||||||
Span.CodeGenerator = SpanCodeGenerator.Null;
|
Span.CodeGenerator = SpanCodeGenerator.Null;
|
||||||
|
|
||||||
if (!headerComplete)
|
if (!headerComplete)
|
||||||
|
|
@ -551,9 +551,9 @@ namespace Microsoft.AspNet.Razor.Parser
|
||||||
// Set up code generation
|
// Set up code generation
|
||||||
// The generated chunk of this code generator is picked up by CSharpDesignTimeHelpersVisitor which
|
// The generated chunk of this code generator is picked up by CSharpDesignTimeHelpersVisitor which
|
||||||
// renders the C# to colorize the user provided value. We trim the quotes around the user's value
|
// renders the C# to colorize the user provided value. We trim the quotes around the user's value
|
||||||
// so when we render the code we can project the users value into double quotes to not invoke C#
|
// so when we render the code we can project the users value into double quotes to not invoke C#
|
||||||
// IntelliSense.
|
// IntelliSense.
|
||||||
Span.CodeGenerator =
|
Span.CodeGenerator =
|
||||||
new AddOrRemoveTagHelperCodeGenerator(removeTagHelperDescriptors, rawValue.Trim('"'));
|
new AddOrRemoveTagHelperCodeGenerator(removeTagHelperDescriptors, rawValue.Trim('"'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -562,7 +562,7 @@ namespace Microsoft.AspNet.Razor.Parser
|
||||||
if (!startsWithQuote ||
|
if (!startsWithQuote ||
|
||||||
!rawValue.EndsWith("\"", StringComparison.OrdinalIgnoreCase))
|
!rawValue.EndsWith("\"", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
Context.OnError(startLocation,
|
Context.OnError(startLocation,
|
||||||
RazorResources.FormatParseError_DirectiveMustBeSurroundedByQuotes(keyword));
|
RazorResources.FormatParseError_DirectiveMustBeSurroundedByQuotes(keyword));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ namespace Microsoft.AspNet.Razor.Parser
|
||||||
|
|
||||||
// Accept the "await" and move on
|
// Accept the "await" and move on
|
||||||
AcceptAndMoveNext();
|
AcceptAndMoveNext();
|
||||||
|
|
||||||
// Accept 1 or more spaces between the await and the following code.
|
// Accept 1 or more spaces between the await and the following code.
|
||||||
AcceptWhile(IsSpacingToken(includeNewLines: false, includeComments: true));
|
AcceptWhile(IsSpacingToken(includeNewLines: false, includeComments: true));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -322,7 +322,7 @@ namespace Microsoft.AspNet.Razor.Parser
|
||||||
ImplicitExpression(AcceptedCharacters.NonWhiteSpace);
|
ImplicitExpression(AcceptedCharacters.NonWhiteSpace);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Async implicit expressions include the "await" keyword and therefore need to allow spaces to
|
// Async implicit expressions include the "await" keyword and therefore need to allow spaces to
|
||||||
// separate the "await" and the following code.
|
// separate the "await" and the following code.
|
||||||
private void AsyncImplicitExpression()
|
private void AsyncImplicitExpression()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -185,8 +185,8 @@ namespace Microsoft.AspNet.Razor.Parser
|
||||||
EndTagBlock(tags, complete);
|
EndTagBlock(tags, complete);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool AfterTagStart(SourceLocation tagStart,
|
private bool AfterTagStart(SourceLocation tagStart,
|
||||||
Stack<Tuple<HtmlSymbol, SourceLocation>> tags,
|
Stack<Tuple<HtmlSymbol, SourceLocation>> tags,
|
||||||
IDisposable tagBlockWrapper)
|
IDisposable tagBlockWrapper)
|
||||||
{
|
{
|
||||||
if (!EndOfFile)
|
if (!EndOfFile)
|
||||||
|
|
@ -269,8 +269,8 @@ namespace Microsoft.AspNet.Razor.Parser
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool EndTag(SourceLocation tagStart,
|
private bool EndTag(SourceLocation tagStart,
|
||||||
Stack<Tuple<HtmlSymbol, SourceLocation>> tags,
|
Stack<Tuple<HtmlSymbol, SourceLocation>> tags,
|
||||||
IDisposable tagBlockWrapper)
|
IDisposable tagBlockWrapper)
|
||||||
{
|
{
|
||||||
// Accept "/" and move next
|
// Accept "/" and move next
|
||||||
|
|
@ -531,15 +531,15 @@ namespace Microsoft.AspNet.Razor.Parser
|
||||||
// Dynamic value, start a new block and set the code generator
|
// Dynamic value, start a new block and set the code generator
|
||||||
using (Context.StartBlock(BlockType.Markup))
|
using (Context.StartBlock(BlockType.Markup))
|
||||||
{
|
{
|
||||||
Context.CurrentBlock.CodeGenerator =
|
Context.CurrentBlock.CodeGenerator =
|
||||||
new DynamicAttributeBlockCodeGenerator(prefix.GetContent(prefixStart), valueStart);
|
new DynamicAttributeBlockCodeGenerator(prefix.GetContent(prefixStart), valueStart);
|
||||||
|
|
||||||
OtherParserBlock();
|
OtherParserBlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (At(HtmlSymbolType.Text) &&
|
else if (At(HtmlSymbolType.Text) &&
|
||||||
CurrentSymbol.Content.Length > 0 &&
|
CurrentSymbol.Content.Length > 0 &&
|
||||||
CurrentSymbol.Content[0] == '~' &&
|
CurrentSymbol.Content[0] == '~' &&
|
||||||
NextIs(HtmlSymbolType.ForwardSlash))
|
NextIs(HtmlSymbolType.ForwardSlash))
|
||||||
{
|
{
|
||||||
// Virtual Path value
|
// Virtual Path value
|
||||||
|
|
@ -558,7 +558,7 @@ namespace Microsoft.AspNet.Razor.Parser
|
||||||
sym.Type != HtmlSymbolType.WhiteSpace &&
|
sym.Type != HtmlSymbolType.WhiteSpace &&
|
||||||
sym.Type != HtmlSymbolType.NewLine &&
|
sym.Type != HtmlSymbolType.NewLine &&
|
||||||
sym.Type != HtmlSymbolType.Transition &&
|
sym.Type != HtmlSymbolType.Transition &&
|
||||||
// This condition checks for the end of the attribute value (it repeats some of the checks above
|
// This condition checks for the end of the attribute value (it repeats some of the checks above
|
||||||
// but for now that's ok)
|
// but for now that's ok)
|
||||||
!IsEndOfAttributeValue(quote, sym));
|
!IsEndOfAttributeValue(quote, sym));
|
||||||
Accept(value);
|
Accept(value);
|
||||||
|
|
@ -577,7 +577,7 @@ namespace Microsoft.AspNet.Razor.Parser
|
||||||
|
|
||||||
private bool IsUnquotedEndOfAttributeValue(HtmlSymbol sym)
|
private bool IsUnquotedEndOfAttributeValue(HtmlSymbol sym)
|
||||||
{
|
{
|
||||||
// If unquoted, we have a larger set of terminating characters:
|
// If unquoted, we have a larger set of terminating characters:
|
||||||
// http://dev.w3.org/html5/spec/tokenization.html#attribute-value-unquoted-state
|
// http://dev.w3.org/html5/spec/tokenization.html#attribute-value-unquoted-state
|
||||||
// Also we need to detect "/" and ">"
|
// Also we need to detect "/" and ">"
|
||||||
return sym.Type == HtmlSymbolType.DoubleQuote ||
|
return sym.Type == HtmlSymbolType.DoubleQuote ||
|
||||||
|
|
@ -714,8 +714,8 @@ namespace Microsoft.AspNet.Razor.Parser
|
||||||
return RestOfTag(tag, tags, tagBlockWrapper);
|
return RestOfTag(tag, tags, tagBlockWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool RestOfTag(Tuple<HtmlSymbol, SourceLocation> tag,
|
private bool RestOfTag(Tuple<HtmlSymbol, SourceLocation> tag,
|
||||||
Stack<Tuple<HtmlSymbol, SourceLocation>> tags,
|
Stack<Tuple<HtmlSymbol, SourceLocation>> tags,
|
||||||
IDisposable tagBlockWrapper)
|
IDisposable tagBlockWrapper)
|
||||||
{
|
{
|
||||||
TagContent();
|
TagContent();
|
||||||
|
|
@ -873,11 +873,11 @@ namespace Microsoft.AspNet.Razor.Parser
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CompleteTagBlockWithSpan(IDisposable tagBlockWrapper,
|
private void CompleteTagBlockWithSpan(IDisposable tagBlockWrapper,
|
||||||
AcceptedCharacters acceptedCharacters,
|
AcceptedCharacters acceptedCharacters,
|
||||||
SpanKind spanKind)
|
SpanKind spanKind)
|
||||||
{
|
{
|
||||||
Debug.Assert(tagBlockWrapper != null,
|
Debug.Assert(tagBlockWrapper != null,
|
||||||
"Tag block wrapper should not be null when attempting to complete a block");
|
"Tag block wrapper should not be null when attempting to complete a block");
|
||||||
|
|
||||||
Span.EditHandler.AcceptedCharacters = acceptedCharacters;
|
Span.EditHandler.AcceptedCharacters = acceptedCharacters;
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ namespace Microsoft.AspNet.Razor.Parser
|
||||||
|
|
||||||
public abstract void ParseBlock();
|
public abstract void ParseBlock();
|
||||||
|
|
||||||
// Markup Parsers need the ParseDocument and ParseSection methods since the markup parser is the first parser to hit the document
|
// Markup Parsers need the ParseDocument and ParseSection methods since the markup parser is the first parser to hit the document
|
||||||
// and the logic may be different than the ParseBlock method.
|
// and the logic may be different than the ParseBlock method.
|
||||||
public virtual void ParseDocument()
|
public virtual void ParseDocument()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ namespace Microsoft.AspNet.Razor.Parser
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tracks the given <paramref name="error"/>.
|
/// Tracks the given <paramref name="error"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="error">The <see cref="RazorError"/> to track.</param>
|
/// <param name="error">The <see cref="RazorError"/> to track.</param>
|
||||||
public void OnError(RazorError error)
|
public void OnError(RazorError error)
|
||||||
{
|
{
|
||||||
_errors.Add(error);
|
_errors.Add(error);
|
||||||
|
|
@ -46,7 +46,7 @@ namespace Microsoft.AspNet.Razor.Parser
|
||||||
/// Creates and tracks a new <see cref="RazorError"/>.
|
/// Creates and tracks a new <see cref="RazorError"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="location"><see cref="SourceLocation"/> of the error.</param>
|
/// <param name="location"><see cref="SourceLocation"/> of the error.</param>
|
||||||
/// <param name="message">A message describing the error.</param>
|
/// <param name="message">A message describing the error.</param>
|
||||||
public void OnError(SourceLocation location, string message)
|
public void OnError(SourceLocation location, string message)
|
||||||
{
|
{
|
||||||
_errors.Add(new RazorError(message, location));
|
_errors.Add(new RazorError(message, location));
|
||||||
|
|
|
||||||
|
|
@ -200,7 +200,7 @@ namespace Microsoft.AspNet.Razor.Parser
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a sequence of <see cref="TagHelperDescriptor"/>s for tag helpers that are registered in the
|
/// Returns a sequence of <see cref="TagHelperDescriptor"/>s for tag helpers that are registered in the
|
||||||
/// specified <paramref name="documentRoot"/>.
|
/// specified <paramref name="documentRoot"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="documentRoot">The <see cref="Block"/> to scan for tag helper registrations in.</param>
|
/// <param name="documentRoot">The <see cref="Block"/> to scan for tag helper registrations in.</param>
|
||||||
|
|
@ -215,7 +215,7 @@ namespace Microsoft.AspNet.Razor.Parser
|
||||||
{
|
{
|
||||||
return new ISyntaxTreeRewriter[]
|
return new ISyntaxTreeRewriter[]
|
||||||
{
|
{
|
||||||
// TODO: Modify the below WhiteSpaceRewriter & ConditionalAttributeCollapser to handle
|
// TODO: Modify the below WhiteSpaceRewriter & ConditionalAttributeCollapser to handle
|
||||||
// TagHelperBlock's: https://github.com/aspnet/Razor/issues/117
|
// TagHelperBlock's: https://github.com/aspnet/Razor/issues/117
|
||||||
|
|
||||||
// Move whitespace from start of expression block to markup
|
// Move whitespace from start of expression block to markup
|
||||||
|
|
|
||||||
|
|
@ -67,13 +67,13 @@ namespace Microsoft.AspNet.Razor.Parser.TagHelpers
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines whether two <see cref="TagHelperBlock"/>s are equal by comparing the <see cref="TagName"/>,
|
/// Determines whether two <see cref="TagHelperBlock"/>s are equal by comparing the <see cref="TagName"/>,
|
||||||
/// <see cref="Attributes"/>, <see cref="Block.Type"/>, <see cref="Block.CodeGenerator"/> and
|
/// <see cref="Attributes"/>, <see cref="Block.Type"/>, <see cref="Block.CodeGenerator"/> and
|
||||||
/// <see cref="Block.Children"/>.
|
/// <see cref="Block.Children"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="other">The <see cref="TagHelperBlock"/> to check equality against.</param>
|
/// <param name="other">The <see cref="TagHelperBlock"/> to check equality against.</param>
|
||||||
/// <returns>
|
/// <returns>
|
||||||
/// <c>true</c> if the current <see cref="TagHelperBlock"/> is equivalent to the given
|
/// <c>true</c> if the current <see cref="TagHelperBlock"/> is equivalent to the given
|
||||||
/// <paramref name="other"/>, <c>false</c> otherwise.
|
/// <paramref name="other"/>, <c>false</c> otherwise.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public bool Equals(TagHelperBlock other)
|
public bool Equals(TagHelperBlock other)
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ namespace Microsoft.AspNet.Razor.Parser.TagHelpers
|
||||||
public class TagHelperBlockBuilder : BlockBuilder
|
public class TagHelperBlockBuilder : BlockBuilder
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Instantiates a new <see cref="TagHelperBlockBuilder"/> instance based on given the
|
/// Instantiates a new <see cref="TagHelperBlockBuilder"/> instance based on given the
|
||||||
/// <paramref name="original"/>.
|
/// <paramref name="original"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="original">The original <see cref="TagHelperBlock"/> to copy data from.</param>
|
/// <param name="original">The original <see cref="TagHelperBlock"/> to copy data from.</param>
|
||||||
|
|
@ -170,7 +170,7 @@ namespace Microsoft.AspNet.Razor.Parser.TagHelpers
|
||||||
{
|
{
|
||||||
// We've found an '=' symbol, this means that the coming symbols will either be a quote
|
// We've found an '=' symbol, this means that the coming symbols will either be a quote
|
||||||
// or value (in the case that the value is unquoted).
|
// or value (in the case that the value is unquoted).
|
||||||
// Spaces after/before the equal symbol are not yet supported:
|
// Spaces after/before the equal symbol are not yet supported:
|
||||||
// https://github.com/aspnet/Razor/issues/123
|
// https://github.com/aspnet/Razor/issues/123
|
||||||
|
|
||||||
// TODO: Handle malformed tags, if there's an '=' then there MUST be a value.
|
// TODO: Handle malformed tags, if there's an '=' then there MUST be a value.
|
||||||
|
|
@ -290,7 +290,7 @@ namespace Microsoft.AspNet.Razor.Parser.TagHelpers
|
||||||
else if (isDynamic && childSpan.CodeGenerator == SpanCodeGenerator.Null)
|
else if (isDynamic && childSpan.CodeGenerator == SpanCodeGenerator.Null)
|
||||||
{
|
{
|
||||||
// Usually the dynamic code generator handles rendering the null code generators underneath
|
// Usually the dynamic code generator handles rendering the null code generators underneath
|
||||||
// it. This doesn't make sense in terms of tag helpers though, we need to change null code
|
// it. This doesn't make sense in terms of tag helpers though, we need to change null code
|
||||||
// generators to markup code generators.
|
// generators to markup code generators.
|
||||||
|
|
||||||
newCodeGenerator = new MarkupCodeGenerator();
|
newCodeGenerator = new MarkupCodeGenerator();
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ namespace Microsoft.AspNet.Razor.Parser.TagHelpers.Internal
|
||||||
// Found a new tag helper block
|
// Found a new tag helper block
|
||||||
TrackTagHelperBlock(new TagHelperBlockBuilder(tagName, descriptors, childBlock));
|
TrackTagHelperBlock(new TagHelperBlockBuilder(tagName, descriptors, childBlock));
|
||||||
|
|
||||||
// If it's a self closing block then we don't have to worry about nested children
|
// If it's a self closing block then we don't have to worry about nested children
|
||||||
// within the tag... complete it.
|
// within the tag... complete it.
|
||||||
if (IsSelfClosing(childBlock))
|
if (IsSelfClosing(childBlock))
|
||||||
{
|
{
|
||||||
|
|
@ -117,7 +117,7 @@ namespace Microsoft.AspNet.Razor.Parser.TagHelpers.Internal
|
||||||
// At this point the child is a Span or Block with Type BlockType.Tag that doesn't happen to be a
|
// At this point the child is a Span or Block with Type BlockType.Tag that doesn't happen to be a
|
||||||
// tag helper.
|
// tag helper.
|
||||||
|
|
||||||
// Add the child to current block.
|
// Add the child to current block.
|
||||||
_currentBlock.Children.Add(child);
|
_currentBlock.Children.Add(child);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -130,12 +130,12 @@ namespace Microsoft.AspNet.Razor.Parser.TagHelpers.Internal
|
||||||
// the document, that's the only way we can have a non-zero _blockStack.Count.
|
// the document, that's the only way we can have a non-zero _blockStack.Count.
|
||||||
if (_blockStack.Count != 0)
|
if (_blockStack.Count != 0)
|
||||||
{
|
{
|
||||||
// We reverse the children so we can search from the back to the front for the TagHelper that is
|
// We reverse the children so we can search from the back to the front for the TagHelper that is
|
||||||
// malformed.
|
// malformed.
|
||||||
var candidateChildren = _currentBlock.Children.Reverse();
|
var candidateChildren = _currentBlock.Children.Reverse();
|
||||||
var malformedTagHelper = candidateChildren.OfType<TagHelperBlock>().FirstOrDefault();
|
var malformedTagHelper = candidateChildren.OfType<TagHelperBlock>().FirstOrDefault();
|
||||||
|
|
||||||
// If the malformed tag helper is null that means something other than a TagHelper caused the
|
// If the malformed tag helper is null that means something other than a TagHelper caused the
|
||||||
// unbalancing of the syntax tree (should never happen).
|
// unbalancing of the syntax tree (should never happen).
|
||||||
Debug.Assert(malformedTagHelper != null);
|
Debug.Assert(malformedTagHelper != null);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ namespace Microsoft.AspNet.Razor
|
||||||
/// The result of attempting an incremental parse
|
/// The result of attempting an incremental parse
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// Either the Accepted or Rejected flag is ALWAYS set.
|
/// Either the Accepted or Rejected flag is ALWAYS set.
|
||||||
/// Additionally, Provisional may be set with Accepted and SpanContextChanged may be set with Rejected.
|
/// Additionally, Provisional may be set with Accepted and SpanContextChanged may be set with Rejected.
|
||||||
/// Provisional may NOT be set with Rejected and SpanContextChanged may NOT be set with Accepted.
|
/// Provisional may NOT be set with Rejected and SpanContextChanged may NOT be set with Accepted.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ namespace Microsoft.AspNet.Razor
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The "@" character must be followed by a ":", "(", or a C# identifier. If you intended to switch to markup, use an HTML start tag, for example:
|
/// The "@" character must be followed by a ":", "(", or a C# identifier. If you intended to switch to markup, use an HTML start tag, for example:
|
||||||
///
|
///
|
||||||
/// @if(isLoggedIn) {
|
/// @if(isLoggedIn) {
|
||||||
/// <p>Hello, @user!</p>
|
/// <p>Hello, @user!</p>
|
||||||
/// }
|
/// }
|
||||||
|
|
@ -104,7 +104,7 @@ namespace Microsoft.AspNet.Razor
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The "@" character must be followed by a ":", "(", or a C# identifier. If you intended to switch to markup, use an HTML start tag, for example:
|
/// The "@" character must be followed by a ":", "(", or a C# identifier. If you intended to switch to markup, use an HTML start tag, for example:
|
||||||
///
|
///
|
||||||
/// @if(isLoggedIn) {
|
/// @if(isLoggedIn) {
|
||||||
/// <p>Hello, @user!</p>
|
/// <p>Hello, @user!</p>
|
||||||
/// }
|
/// }
|
||||||
|
|
@ -228,7 +228,7 @@ namespace Microsoft.AspNet.Razor
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sections cannot be empty. The "@section" keyword must be followed by a block of markup surrounded by "{}". For example:
|
/// Sections cannot be empty. The "@section" keyword must be followed by a block of markup surrounded by "{}". For example:
|
||||||
///
|
///
|
||||||
/// @section Sidebar {
|
/// @section Sidebar {
|
||||||
/// <!-- Markup and text goes here -->
|
/// <!-- Markup and text goes here -->
|
||||||
/// }
|
/// }
|
||||||
|
|
@ -240,7 +240,7 @@ namespace Microsoft.AspNet.Razor
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sections cannot be empty. The "@section" keyword must be followed by a block of markup surrounded by "{}". For example:
|
/// Sections cannot be empty. The "@section" keyword must be followed by a block of markup surrounded by "{}". For example:
|
||||||
///
|
///
|
||||||
/// @section Sidebar {
|
/// @section Sidebar {
|
||||||
/// <!-- Markup and text goes here -->
|
/// <!-- Markup and text goes here -->
|
||||||
/// }
|
/// }
|
||||||
|
|
@ -252,7 +252,7 @@ namespace Microsoft.AspNet.Razor
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Namespace imports and type aliases cannot be placed within code blocks. They must immediately follow an "@" character in markup. It is recommended that you put them at the top of the page, as in the following example:
|
/// Namespace imports and type aliases cannot be placed within code blocks. They must immediately follow an "@" character in markup. It is recommended that you put them at the top of the page, as in the following example:
|
||||||
///
|
///
|
||||||
/// @using System.Drawing;
|
/// @using System.Drawing;
|
||||||
/// @{
|
/// @{
|
||||||
/// // OK here to use types from System.Drawing in the page.
|
/// // OK here to use types from System.Drawing in the page.
|
||||||
|
|
@ -265,7 +265,7 @@ namespace Microsoft.AspNet.Razor
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Namespace imports and type aliases cannot be placed within code blocks. They must immediately follow an "@" character in markup. It is recommended that you put them at the top of the page, as in the following example:
|
/// Namespace imports and type aliases cannot be placed within code blocks. They must immediately follow an "@" character in markup. It is recommended that you put them at the top of the page, as in the following example:
|
||||||
///
|
///
|
||||||
/// @using System.Drawing;
|
/// @using System.Drawing;
|
||||||
/// @{
|
/// @{
|
||||||
/// // OK here to use types from System.Drawing in the page.
|
/// // OK here to use types from System.Drawing in the page.
|
||||||
|
|
@ -278,12 +278,12 @@ namespace Microsoft.AspNet.Razor
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Expected a "{0}" but found a "{1}". Block statements must be enclosed in "{{" and "}}". You cannot use single-statement control-flow statements in CSHTML pages. For example, the following is not allowed:
|
/// Expected a "{0}" but found a "{1}". Block statements must be enclosed in "{{" and "}}". You cannot use single-statement control-flow statements in CSHTML pages. For example, the following is not allowed:
|
||||||
///
|
///
|
||||||
/// @if(isLoggedIn)
|
/// @if(isLoggedIn)
|
||||||
/// <p>Hello, @user</p>
|
/// <p>Hello, @user</p>
|
||||||
///
|
///
|
||||||
/// Instead, wrap the contents of the block in "{{}}":
|
/// Instead, wrap the contents of the block in "{{}}":
|
||||||
///
|
///
|
||||||
/// @if(isLoggedIn) {{
|
/// @if(isLoggedIn) {{
|
||||||
/// <p>Hello, @user</p>
|
/// <p>Hello, @user</p>
|
||||||
/// }}
|
/// }}
|
||||||
|
|
@ -295,12 +295,12 @@ namespace Microsoft.AspNet.Razor
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Expected a "{0}" but found a "{1}". Block statements must be enclosed in "{{" and "}}". You cannot use single-statement control-flow statements in CSHTML pages. For example, the following is not allowed:
|
/// Expected a "{0}" but found a "{1}". Block statements must be enclosed in "{{" and "}}". You cannot use single-statement control-flow statements in CSHTML pages. For example, the following is not allowed:
|
||||||
///
|
///
|
||||||
/// @if(isLoggedIn)
|
/// @if(isLoggedIn)
|
||||||
/// <p>Hello, @user</p>
|
/// <p>Hello, @user</p>
|
||||||
///
|
///
|
||||||
/// Instead, wrap the contents of the block in "{{}}":
|
/// Instead, wrap the contents of the block in "{{}}":
|
||||||
///
|
///
|
||||||
/// @if(isLoggedIn) {{
|
/// @if(isLoggedIn) {{
|
||||||
/// <p>Hello, @user</p>
|
/// <p>Hello, @user</p>
|
||||||
/// }}
|
/// }}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ using Microsoft.Internal.Web.Utils;
|
||||||
namespace Microsoft.AspNet.Razor
|
namespace Microsoft.AspNet.Razor
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Specifies a Razor directive that is rendered as an attribute on the generated class.
|
/// Specifies a Razor directive that is rendered as an attribute on the generated class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
|
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
|
||||||
public sealed class RazorDirectiveAttribute : Attribute
|
public sealed class RazorDirectiveAttribute : Attribute
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ namespace Microsoft.AspNet.Razor
|
||||||
/// This parser is designed to allow editors to avoid having to worry about incremental parsing.
|
/// This parser is designed to allow editors to avoid having to worry about incremental parsing.
|
||||||
/// The CheckForStructureChanges method can be called with every change made by a user in an editor and
|
/// The CheckForStructureChanges method can be called with every change made by a user in an editor and
|
||||||
/// the parser will provide a result indicating if it was able to incrementally reparse the document.
|
/// the parser will provide a result indicating if it was able to incrementally reparse the document.
|
||||||
///
|
///
|
||||||
/// The general workflow for editors with this parser is:
|
/// The general workflow for editors with this parser is:
|
||||||
/// 0. User edits document
|
/// 0. User edits document
|
||||||
/// 1. Editor builds TextChange structure describing the edit and providing a reference to the _updated_ text buffer
|
/// 1. Editor builds TextChange structure describing the edit and providing a reference to the _updated_ text buffer
|
||||||
|
|
@ -30,25 +30,25 @@ namespace Microsoft.AspNet.Razor
|
||||||
/// b. If it can not, the Parser starts a background parse task and return PartialParseResult.Rejected
|
/// b. If it can not, the Parser starts a background parse task and return PartialParseResult.Rejected
|
||||||
/// NOTE: Additional flags can be applied to the PartialParseResult, see that enum for more details. However,
|
/// NOTE: Additional flags can be applied to the PartialParseResult, see that enum for more details. However,
|
||||||
/// the Accepted or Rejected flags will ALWAYS be present
|
/// the Accepted or Rejected flags will ALWAYS be present
|
||||||
///
|
///
|
||||||
/// A change can only be incrementally parsed if a single, unique, Span (see Microsoft.AspNet.Razor.Parser.SyntaxTree) in the syntax tree can
|
/// A change can only be incrementally parsed if a single, unique, Span (see Microsoft.AspNet.Razor.Parser.SyntaxTree) in the syntax tree can
|
||||||
/// be identified as owning the entire change. For example, if a change overlaps with multiple spans, the change cannot be
|
/// be identified as owning the entire change. For example, if a change overlaps with multiple spans, the change cannot be
|
||||||
/// parsed incrementally and a full reparse is necessary. A Span "owns" a change if the change occurs either a) entirely
|
/// parsed incrementally and a full reparse is necessary. A Span "owns" a change if the change occurs either a) entirely
|
||||||
/// within it's boundaries or b) it is a pure insertion (see TextChange) at the end of a Span whose CanGrow flag (see Span) is
|
/// within it's boundaries or b) it is a pure insertion (see TextChange) at the end of a Span whose CanGrow flag (see Span) is
|
||||||
/// true.
|
/// true.
|
||||||
///
|
///
|
||||||
/// Even if a single unique Span owner can be identified, it's possible the edit will cause the Span to split or merge with other
|
/// Even if a single unique Span owner can be identified, it's possible the edit will cause the Span to split or merge with other
|
||||||
/// Spans, in which case, a full reparse is necessary to identify the extent of the changes to the tree.
|
/// Spans, in which case, a full reparse is necessary to identify the extent of the changes to the tree.
|
||||||
///
|
///
|
||||||
/// When the RazorEditorParser returns Accepted, it updates CurrentParseTree immediately. However, the editor is expected to
|
/// When the RazorEditorParser returns Accepted, it updates CurrentParseTree immediately. However, the editor is expected to
|
||||||
/// update it's own data structures independently. It can use CurrentParseTree to do this, as soon as the editor returns from
|
/// update it's own data structures independently. It can use CurrentParseTree to do this, as soon as the editor returns from
|
||||||
/// CheckForStructureChanges, but it should (ideally) have logic for doing so without needing the new tree.
|
/// CheckForStructureChanges, but it should (ideally) have logic for doing so without needing the new tree.
|
||||||
///
|
///
|
||||||
/// When Rejected is returned by CheckForStructureChanges, a background parse task has _already_ been started. When that task
|
/// When Rejected is returned by CheckForStructureChanges, a background parse task has _already_ been started. When that task
|
||||||
/// finishes, the DocumentStructureChanged event will be fired containing the new generated code, parse tree and a reference to
|
/// finishes, the DocumentStructureChanged event will be fired containing the new generated code, parse tree and a reference to
|
||||||
/// the original TextChange that caused the reparse, to allow the editor to resolve the new tree against any changes made since
|
/// the original TextChange that caused the reparse, to allow the editor to resolve the new tree against any changes made since
|
||||||
/// calling CheckForStructureChanges.
|
/// calling CheckForStructureChanges.
|
||||||
///
|
///
|
||||||
/// If a call to CheckForStructureChanges occurs while a reparse is already in-progress, the reparse is cancelled IMMEDIATELY
|
/// If a call to CheckForStructureChanges occurs while a reparse is already in-progress, the reparse is cancelled IMMEDIATELY
|
||||||
/// and Rejected is returned without attempting to reparse. This means that if a conusmer calls CheckForStructureChanges, which
|
/// and Rejected is returned without attempting to reparse. This means that if a conusmer calls CheckForStructureChanges, which
|
||||||
/// returns Rejected, then calls it again before DocumentParseComplete is fired, it will only recieve one DocumentParseComplete
|
/// returns Rejected, then calls it again before DocumentParseComplete is fired, it will only recieve one DocumentParseComplete
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,17 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<root>
|
<root>
|
||||||
<!--
|
<!--
|
||||||
Microsoft ResX Schema
|
Microsoft ResX Schema
|
||||||
|
|
||||||
Version 2.0
|
Version 2.0
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
The primary goals of this format is to allow a simple XML format
|
||||||
that is mostly human readable. The generation and parsing of the
|
that is mostly human readable. The generation and parsing of the
|
||||||
various data types are done through the TypeConverter classes
|
various data types are done through the TypeConverter classes
|
||||||
associated with the data types.
|
associated with the data types.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
... ado.net/XML headers & schema ...
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
<resheader name="version">2.0</resheader>
|
<resheader name="version">2.0</resheader>
|
||||||
|
|
@ -26,36 +26,36 @@
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
<comment>This is a comment</comment>
|
<comment>This is a comment</comment>
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
There are any number of "resheader" rows that contain simple
|
||||||
name/value pairs.
|
name/value pairs.
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
Each data row contains a name, and value. The row also contains a
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
text/value conversion through the TypeConverter architecture.
|
text/value conversion through the TypeConverter architecture.
|
||||||
Classes that don't support this are serialized and stored with the
|
Classes that don't support this are serialized and stored with the
|
||||||
mimetype set.
|
mimetype set.
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
The mimetype is used for serialized objects, and tells the
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
read any of the formats listed below.
|
read any of the formats listed below.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
value : The object must be serialized with
|
value : The object must be serialized with
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
value : The object must be serialized with
|
value : The object must be serialized with
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
value : The object must be serialized into a byte array
|
value : The object must be serialized into a byte array
|
||||||
: using a System.ComponentModel.TypeConverter
|
: using a System.ComponentModel.TypeConverter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
-->
|
-->
|
||||||
|
|
|
||||||
|
|
@ -56,10 +56,10 @@ namespace Microsoft.AspNet.Razor
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// IMPORTANT: This does NOT need to be called before GeneratedCode! GenerateCode will automatically
|
/// IMPORTANT: This does NOT need to be called before GeneratedCode! GenerateCode will automatically
|
||||||
/// parse the document first.
|
/// parse the document first.
|
||||||
///
|
///
|
||||||
/// The cancel token provided can be used to cancel the parse. However, please note
|
/// The cancel token provided can be used to cancel the parse. However, please note
|
||||||
/// that the parse occurs _synchronously_, on the callers thread. This parameter is
|
/// that the parse occurs _synchronously_, on the callers thread. This parameter is
|
||||||
/// provided so that if the caller is in a background thread with a CancellationToken,
|
/// provided so that if the caller is in a background thread with a CancellationToken,
|
||||||
/// it can pass it along to the parser.
|
/// it can pass it along to the parser.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="input">The input text to parse</param>
|
/// <param name="input">The input text to parse</param>
|
||||||
|
|
@ -71,7 +71,7 @@ namespace Microsoft.AspNet.Razor
|
||||||
return ParseTemplateCore(input.ToDocument(), sourceFileName: null, cancelToken: cancelToken);
|
return ParseTemplateCore(input.ToDocument(), sourceFileName: null, cancelToken: cancelToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
// See ParseTemplate(ITextBuffer, CancellationToken?),
|
// See ParseTemplate(ITextBuffer, CancellationToken?),
|
||||||
// this overload simply wraps a TextReader in a TextBuffer (see ITextBuffer and BufferingTextReader)
|
// this overload simply wraps a TextReader in a TextBuffer (see ITextBuffer and BufferingTextReader)
|
||||||
public ParserResults ParseTemplate(TextReader input, string sourceFileName)
|
public ParserResults ParseTemplate(TextReader input, string sourceFileName)
|
||||||
{
|
{
|
||||||
|
|
@ -114,14 +114,14 @@ namespace Microsoft.AspNet.Razor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// The cancel token provided can be used to cancel the parse. However, please note
|
/// The cancel token provided can be used to cancel the parse. However, please note
|
||||||
/// that the parse occurs _synchronously_, on the callers thread. This parameter is
|
/// that the parse occurs _synchronously_, on the callers thread. This parameter is
|
||||||
/// provided so that if the caller is in a background thread with a CancellationToken,
|
/// provided so that if the caller is in a background thread with a CancellationToken,
|
||||||
/// it can pass it along to the parser.
|
/// it can pass it along to the parser.
|
||||||
///
|
///
|
||||||
/// The className, rootNamespace and sourceFileName parameters are optional and override the default
|
/// The className, rootNamespace and sourceFileName parameters are optional and override the default
|
||||||
/// specified by the Host. For example, the WebPageRazorHost in System.Web.WebPages.Razor configures the
|
/// specified by the Host. For example, the WebPageRazorHost in System.Web.WebPages.Razor configures the
|
||||||
/// Class Name, Root Namespace and Source File Name based on the virtual path of the page being compiled.
|
/// Class Name, Root Namespace and Source File Name based on the virtual path of the page being compiled.
|
||||||
/// However, the built-in RazorEngineHost class uses constant defaults, so the caller will likely want to
|
/// However, the built-in RazorEngineHost class uses constant defaults, so the caller will likely want to
|
||||||
/// change them using these parameters
|
/// change them using these parameters
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <param name="input">The input text to parse</param>
|
/// <param name="input">The input text to parse</param>
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,9 @@ namespace Microsoft.AspNet.Razor.TagHelpers
|
||||||
/// Resolves <see cref="TagHelperDescriptor"/>s based on the given <paramref name="resolutionContext"/>.
|
/// Resolves <see cref="TagHelperDescriptor"/>s based on the given <paramref name="resolutionContext"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="resolutionContext">
|
/// <param name="resolutionContext">
|
||||||
/// <see cref="TagHelperDescriptorResolutionContext"/> used to resolve descriptors for the Razor page.
|
/// <see cref="TagHelperDescriptorResolutionContext"/> used to resolve descriptors for the Razor page.
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <returns>An <see cref="IEnumerable{TagHelperDescriptor}"/> of <see cref="TagHelperDescriptor"/>s based
|
/// <returns>An <see cref="IEnumerable{TagHelperDescriptor}"/> of <see cref="TagHelperDescriptor"/>s based
|
||||||
/// on the given <paramref name="resolutionContext"/>.</returns>
|
/// on the given <paramref name="resolutionContext"/>.</returns>
|
||||||
IEnumerable<TagHelperDescriptor> Resolve(TagHelperDescriptorResolutionContext resolutionContext);
|
IEnumerable<TagHelperDescriptor> Resolve(TagHelperDescriptorResolutionContext resolutionContext);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,10 @@ namespace Microsoft.AspNet.Razor.TagHelpers
|
||||||
/// Instantiates a new instance of the <see cref="TagHelperAttributeDescriptor"/> class.
|
/// Instantiates a new instance of the <see cref="TagHelperAttributeDescriptor"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="name">The HTML attribute name.</param>
|
/// <param name="name">The HTML attribute name.</param>
|
||||||
/// <param name="propertyName">The name of the CLR property name that corresponds to the HTML
|
/// <param name="propertyName">The name of the CLR property name that corresponds to the HTML
|
||||||
/// attribute.</param>
|
/// attribute.</param>
|
||||||
/// <param name="typeName">
|
/// <param name="typeName">
|
||||||
/// The full name of the named (see <paramref name="propertyName"/>) property's
|
/// The full name of the named (see <paramref name="propertyName"/>) property's
|
||||||
/// <see cref="System.Type"/>.
|
/// <see cref="System.Type"/>.
|
||||||
/// </param>
|
/// </param>
|
||||||
public TagHelperAttributeDescriptor(string name,
|
public TagHelperAttributeDescriptor(string name,
|
||||||
|
|
@ -46,7 +46,7 @@ namespace Microsoft.AspNet.Razor.TagHelpers
|
||||||
public string PropertyName { get; private set; }
|
public string PropertyName { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The full name of the named (see <see name="PropertyName"/>) property's
|
/// The full name of the named (see <see name="PropertyName"/>) property's
|
||||||
/// <see cref="System.Type"/>.
|
/// <see cref="System.Type"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string TypeName { get; private set; }
|
public string TypeName { get; private set; }
|
||||||
|
|
|
||||||
|
|
@ -13,12 +13,12 @@ namespace Microsoft.AspNet.Razor.TagHelpers
|
||||||
public class TagHelperAttributeValueCodeRenderer
|
public class TagHelperAttributeValueCodeRenderer
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called during Razor's code generation process to generate code that instantiates the value of the tag
|
/// Called during Razor's code generation process to generate code that instantiates the value of the tag
|
||||||
/// helper's property. Last value written should not be or end with a semicolon.
|
/// helper's property. Last value written should not be or end with a semicolon.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="attributeDescriptor">The <see cref="TagHelperAttributeDescriptor"/> to generate code for.</param>
|
/// <param name="attributeDescriptor">The <see cref="TagHelperAttributeDescriptor"/> to generate code for.</param>
|
||||||
/// <param name="writer">The <see cref="CSharpCodeWriter"/> that's used to write code.</param>
|
/// <param name="writer">The <see cref="CSharpCodeWriter"/> that's used to write code.</param>
|
||||||
/// <param name="context">A <see cref="CodeGeneratorContext"/> instance that contains information about
|
/// <param name="context">A <see cref="CodeGeneratorContext"/> instance that contains information about
|
||||||
/// the current code generation process.</param>
|
/// the current code generation process.</param>
|
||||||
/// <param name="renderAttributeValue"><see cref="Action"/> that renders the raw value of the HTML attribute.</param>
|
/// <param name="renderAttributeValue"><see cref="Action"/> that renders the raw value of the HTML attribute.</param>
|
||||||
public virtual void RenderAttributeValue([NotNull] TagHelperAttributeDescriptor attributeDescriptor,
|
public virtual void RenderAttributeValue([NotNull] TagHelperAttributeDescriptor attributeDescriptor,
|
||||||
|
|
|
||||||
|
|
@ -24,16 +24,16 @@ namespace Microsoft.AspNet.Razor.TagHelpers
|
||||||
[NotNull] string typeName,
|
[NotNull] string typeName,
|
||||||
[NotNull] string assemblyName,
|
[NotNull] string assemblyName,
|
||||||
ContentBehavior contentBehavior)
|
ContentBehavior contentBehavior)
|
||||||
: this(tagName,
|
: this(tagName,
|
||||||
typeName,
|
typeName,
|
||||||
assemblyName,
|
assemblyName,
|
||||||
contentBehavior,
|
contentBehavior,
|
||||||
Enumerable.Empty<TagHelperAttributeDescriptor>())
|
Enumerable.Empty<TagHelperAttributeDescriptor>())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Instantiates a new instance of the <see cref="TagHelperDescriptor"/> class with the given
|
/// Instantiates a new instance of the <see cref="TagHelperDescriptor"/> class with the given
|
||||||
/// <paramref name="attributes"/>.
|
/// <paramref name="attributes"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="tagName">The tag name that the tag helper targets. '*' indicates a catch-all
|
/// <param name="tagName">The tag name that the tag helper targets. '*' indicates a catch-all
|
||||||
|
|
|
||||||
|
|
@ -21,15 +21,15 @@ namespace Microsoft.AspNet.Razor.TagHelpers
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines if the two given tag helpers are equal.
|
/// Determines if the two given tag helpers are equal.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="descriptorX">A <see cref="TagHelperDescriptor"/> to compare with the given
|
/// <param name="descriptorX">A <see cref="TagHelperDescriptor"/> to compare with the given
|
||||||
/// <paramref name="descriptorY"/>.</param>
|
/// <paramref name="descriptorY"/>.</param>
|
||||||
/// <param name="descriptorY">A <see cref="TagHelperDescriptor"/> to compare with the given
|
/// <param name="descriptorY">A <see cref="TagHelperDescriptor"/> to compare with the given
|
||||||
/// <paramref name="descriptorX"/>.</param>
|
/// <paramref name="descriptorX"/>.</param>
|
||||||
/// <returns><c>true</c> if <paramref name="descriptorX"/> and <paramref name="descriptorY"/> are equal,
|
/// <returns><c>true</c> if <paramref name="descriptorX"/> and <paramref name="descriptorY"/> are equal,
|
||||||
/// <c>false</c> otherwise.</returns>
|
/// <c>false</c> otherwise.</returns>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// Determines equality based on <see cref="TagHelperDescriptor.TypeName"/>,
|
/// Determines equality based on <see cref="TagHelperDescriptor.TypeName"/>,
|
||||||
/// <see cref="TagHelperDescriptor.AssemblyName"/>, <see cref="TagHelperDescriptor.TagName"/> and
|
/// <see cref="TagHelperDescriptor.AssemblyName"/>, <see cref="TagHelperDescriptor.TagName"/> and
|
||||||
/// <see cref="TagHelperDescriptor.ContentBehavior"/>.
|
/// <see cref="TagHelperDescriptor.ContentBehavior"/>.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public bool Equals(TagHelperDescriptor descriptorX, TagHelperDescriptor descriptorY)
|
public bool Equals(TagHelperDescriptor descriptorX, TagHelperDescriptor descriptorY)
|
||||||
|
|
@ -44,7 +44,7 @@ namespace Microsoft.AspNet.Razor.TagHelpers
|
||||||
/// Returns an <see cref="int"/> value that uniquely identifies the given <see cref="TagHelperDescriptor"/>.
|
/// Returns an <see cref="int"/> value that uniquely identifies the given <see cref="TagHelperDescriptor"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="descriptor">The <see cref="TagHelperDescriptor"/> to create a hash code for.</param>
|
/// <param name="descriptor">The <see cref="TagHelperDescriptor"/> to create a hash code for.</param>
|
||||||
/// <returns>An <see cref="int"/> that uniquely identifies the given <paramref name="descriptor"/>.</returns>
|
/// <returns>An <see cref="int"/> that uniquely identifies the given <paramref name="descriptor"/>.</returns>
|
||||||
public int GetHashCode(TagHelperDescriptor descriptor)
|
public int GetHashCode(TagHelperDescriptor descriptor)
|
||||||
{
|
{
|
||||||
return HashCodeCombiner.Start()
|
return HashCodeCombiner.Start()
|
||||||
|
|
|
||||||
|
|
@ -35,10 +35,10 @@ namespace Microsoft.AspNet.Razor.TagHelpers
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets all tag helpers that match the given <paramref name="tagName"/>.
|
/// Gets all tag helpers that match the given <paramref name="tagName"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="tagName">The name of the HTML tag to match. Providing a '*' tag name
|
/// <param name="tagName">The name of the HTML tag to match. Providing a '*' tag name
|
||||||
/// retrieves catch-all <see cref="TagHelperDescriptor"/>s (descriptors that target every tag).</param>
|
/// retrieves catch-all <see cref="TagHelperDescriptor"/>s (descriptors that target every tag).</param>
|
||||||
/// <returns><see cref="TagHelperDescriptor"/>s that apply to the given <paramref name="tagName"/>.
|
/// <returns><see cref="TagHelperDescriptor"/>s that apply to the given <paramref name="tagName"/>.
|
||||||
/// Will return an empty <see cref="Enumerable" /> if no <see cref="TagHelperDescriptor"/>s are
|
/// Will return an empty <see cref="Enumerable" /> if no <see cref="TagHelperDescriptor"/>s are
|
||||||
/// found.</returns>
|
/// found.</returns>
|
||||||
public IEnumerable<TagHelperDescriptor> GetTagHelpers(string tagName)
|
public IEnumerable<TagHelperDescriptor> GetTagHelpers(string tagName)
|
||||||
{
|
{
|
||||||
|
|
@ -63,7 +63,7 @@ namespace Microsoft.AspNet.Razor.TagHelpers
|
||||||
{
|
{
|
||||||
return matchingDescriptors.Concat(descriptors);
|
return matchingDescriptors.Concat(descriptors);
|
||||||
}
|
}
|
||||||
|
|
||||||
// We couldn't any descriptors associated with the requested tag name, return all
|
// We couldn't any descriptors associated with the requested tag name, return all
|
||||||
// of the "catch-all" tag descriptors (there may not be any).
|
// of the "catch-all" tag descriptors (there may not be any).
|
||||||
return descriptors;
|
return descriptors;
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ namespace Microsoft.AspNet.Razor.TagHelpers
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <see cref="TagHelperDirectiveDescriptor"/>s used to resolve <see cref="TagHelperDescriptor"/>s.
|
/// <see cref="TagHelperDirectiveDescriptor"/>s used to resolve <see cref="TagHelperDescriptor"/>s.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IList<TagHelperDirectiveDescriptor> DirectiveDescriptors { get; private set; }
|
public IList<TagHelperDirectiveDescriptor> DirectiveDescriptors { get; private set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -275,7 +275,7 @@ namespace Microsoft.AspNet.Razor.Tokenizer
|
||||||
if (CurrentCharacter == '\\')
|
if (CurrentCharacter == '\\')
|
||||||
{
|
{
|
||||||
TakeCurrent(); // Take the '\'
|
TakeCurrent(); // Take the '\'
|
||||||
|
|
||||||
// If the next char is the same quote that started this
|
// If the next char is the same quote that started this
|
||||||
if (CurrentCharacter == quote || CurrentCharacter == '\\')
|
if (CurrentCharacter == quote || CurrentCharacter == '\\')
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ namespace Microsoft.AspNet.Razor.Tokenizer
|
||||||
{
|
{
|
||||||
public static bool IsXmlNameStartChar(char chr)
|
public static bool IsXmlNameStartChar(char chr)
|
||||||
{
|
{
|
||||||
// [4] NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] |
|
// [4] NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] |
|
||||||
// [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] |
|
// [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] |
|
||||||
// [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
|
// [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
|
||||||
// http://www.w3.org/TR/REC-xml/#NT-Name
|
// http://www.w3.org/TR/REC-xml/#NT-Name
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
||||||
public bool Equals(TagHelperAttributeDescriptor descriptorX, TagHelperAttributeDescriptor descriptorY)
|
public bool Equals(TagHelperAttributeDescriptor descriptorX, TagHelperAttributeDescriptor descriptorY)
|
||||||
{
|
{
|
||||||
return descriptorX.Name == descriptorY.Name &&
|
return descriptorX.Name == descriptorY.Name &&
|
||||||
descriptorX.PropertyName == descriptorY.PropertyName &&
|
descriptorX.PropertyName == descriptorY.PropertyName &&
|
||||||
descriptorX.TypeName == descriptorY.TypeName;
|
descriptorX.TypeName == descriptorY.TypeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var objectAssemblyName = typeof(object).GetTypeInfo().Assembly.GetName().Name;
|
var objectAssemblyName = typeof(object).GetTypeInfo().Assembly.GetName().Name;
|
||||||
var expectedDescriptor =
|
var expectedDescriptor =
|
||||||
new TagHelperDescriptor("Object", "System.Object", objectAssemblyName, ContentBehavior.None);
|
new TagHelperDescriptor("Object", "System.Object", objectAssemblyName, ContentBehavior.None);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
|
|
@ -205,7 +205,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
||||||
[Fact]
|
[Fact]
|
||||||
public void CreateDescriptor_ResolvesCustomContentBehavior()
|
public void CreateDescriptor_ResolvesCustomContentBehavior()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var expectedDescriptor = new TagHelperDescriptor(
|
var expectedDescriptor = new TagHelperDescriptor(
|
||||||
"CustomContentBehavior",
|
"CustomContentBehavior",
|
||||||
typeof(CustomContentBehaviorTagHelper).FullName,
|
typeof(CustomContentBehaviorTagHelper).FullName,
|
||||||
|
|
@ -223,7 +223,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
||||||
[Fact]
|
[Fact]
|
||||||
public void CreateDescriptor_DoesNotResolveInheritedCustomContentBehavior()
|
public void CreateDescriptor_DoesNotResolveInheritedCustomContentBehavior()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var expectedDescriptor = new TagHelperDescriptor(
|
var expectedDescriptor = new TagHelperDescriptor(
|
||||||
"InheritedCustomContentBehavior",
|
"InheritedCustomContentBehavior",
|
||||||
typeof(InheritedCustomContentBehaviorTagHelper).FullName,
|
typeof(InheritedCustomContentBehaviorTagHelper).FullName,
|
||||||
|
|
@ -340,18 +340,18 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
||||||
// Arrange
|
// Arrange
|
||||||
var expectedDescriptors = new[] {
|
var expectedDescriptors = new[] {
|
||||||
new TagHelperDescriptor(
|
new TagHelperDescriptor(
|
||||||
"span",
|
"span",
|
||||||
typeof(MultipleAttributeTagHelper).FullName,
|
typeof(MultipleAttributeTagHelper).FullName,
|
||||||
AssemblyName,
|
|
||||||
ContentBehavior.None),
|
|
||||||
new TagHelperDescriptor(
|
|
||||||
"p",
|
|
||||||
typeof(MultipleAttributeTagHelper).FullName,
|
|
||||||
AssemblyName,
|
AssemblyName,
|
||||||
ContentBehavior.None),
|
ContentBehavior.None),
|
||||||
new TagHelperDescriptor(
|
new TagHelperDescriptor(
|
||||||
"div",
|
"p",
|
||||||
typeof(MultipleAttributeTagHelper).FullName,
|
typeof(MultipleAttributeTagHelper).FullName,
|
||||||
|
AssemblyName,
|
||||||
|
ContentBehavior.None),
|
||||||
|
new TagHelperDescriptor(
|
||||||
|
"div",
|
||||||
|
typeof(MultipleAttributeTagHelper).FullName,
|
||||||
AssemblyName,
|
AssemblyName,
|
||||||
ContentBehavior.None)
|
ContentBehavior.None)
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -69,10 +69,10 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
||||||
|
|
||||||
// We're treating 'string' as a TagHelper so we can test TagHelpers in multiple assemblies without
|
// We're treating 'string' as a TagHelper so we can test TagHelpers in multiple assemblies without
|
||||||
// building a separate assembly with a single TagHelper.
|
// building a separate assembly with a single TagHelper.
|
||||||
var stringTagHelperDescriptor =
|
var stringTagHelperDescriptor =
|
||||||
new TagHelperDescriptor("string",
|
new TagHelperDescriptor("string",
|
||||||
"System.String",
|
"System.String",
|
||||||
assemblyB,
|
assemblyB,
|
||||||
ContentBehavior.None);
|
ContentBehavior.None);
|
||||||
|
|
||||||
return new TheoryData<Dictionary<string, IEnumerable<Type>>, // descriptorAssemblyLookups
|
return new TheoryData<Dictionary<string, IEnumerable<Type>>, // descriptorAssemblyLookups
|
||||||
|
|
@ -138,7 +138,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
||||||
new []
|
new []
|
||||||
{
|
{
|
||||||
new TagHelperDirectiveDescriptor(
|
new TagHelperDirectiveDescriptor(
|
||||||
Valid_PlainTagHelperType.FullName + ", " + assemblyA,
|
Valid_PlainTagHelperType.FullName + ", " + assemblyA,
|
||||||
TagHelperDirectiveType.AddTagHelper),
|
TagHelperDirectiveType.AddTagHelper),
|
||||||
new TagHelperDirectiveDescriptor(assemblyA, TagHelperDirectiveType.AddTagHelper)
|
new TagHelperDirectiveDescriptor(assemblyA, TagHelperDirectiveType.AddTagHelper)
|
||||||
},
|
},
|
||||||
|
|
@ -153,7 +153,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
||||||
{
|
{
|
||||||
new TagHelperDirectiveDescriptor(assemblyA, TagHelperDirectiveType.AddTagHelper),
|
new TagHelperDirectiveDescriptor(assemblyA, TagHelperDirectiveType.AddTagHelper),
|
||||||
new TagHelperDirectiveDescriptor(
|
new TagHelperDirectiveDescriptor(
|
||||||
Valid_PlainTagHelperType.FullName + ", " + assemblyA,
|
Valid_PlainTagHelperType.FullName + ", " + assemblyA,
|
||||||
TagHelperDirectiveType.RemoveTagHelper)
|
TagHelperDirectiveType.RemoveTagHelper)
|
||||||
},
|
},
|
||||||
new [] { Valid_InheritedTagHelperDescriptor }
|
new [] { Valid_InheritedTagHelperDescriptor }
|
||||||
|
|
@ -167,7 +167,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
||||||
{
|
{
|
||||||
new TagHelperDirectiveDescriptor(assemblyA, TagHelperDirectiveType.AddTagHelper),
|
new TagHelperDirectiveDescriptor(assemblyA, TagHelperDirectiveType.AddTagHelper),
|
||||||
new TagHelperDirectiveDescriptor(
|
new TagHelperDirectiveDescriptor(
|
||||||
Valid_PlainTagHelperType.FullName + ", " + assemblyA,
|
Valid_PlainTagHelperType.FullName + ", " + assemblyA,
|
||||||
TagHelperDirectiveType.RemoveTagHelper),
|
TagHelperDirectiveType.RemoveTagHelper),
|
||||||
new TagHelperDirectiveDescriptor(assemblyA, TagHelperDirectiveType.AddTagHelper)
|
new TagHelperDirectiveDescriptor(assemblyA, TagHelperDirectiveType.AddTagHelper)
|
||||||
},
|
},
|
||||||
|
|
@ -471,7 +471,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
||||||
return Resolve(
|
return Resolve(
|
||||||
new TagHelperDescriptorResolutionContext(
|
new TagHelperDescriptorResolutionContext(
|
||||||
lookupTexts.Select(
|
lookupTexts.Select(
|
||||||
lookupText =>
|
lookupText =>
|
||||||
new TagHelperDirectiveDescriptor(lookupText, TagHelperDirectiveType.AddTagHelper))));
|
new TagHelperDirectiveDescriptor(lookupText, TagHelperDirectiveType.AddTagHelper))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
||||||
public void GenerateStartTag_ReturnsSelfClosingStartTag_Attributes()
|
public void GenerateStartTag_ReturnsSelfClosingStartTag_Attributes()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var tagHelperOutput = new TagHelperOutput("p",
|
var tagHelperOutput = new TagHelperOutput("p",
|
||||||
attributes: new Dictionary<string, string>
|
attributes: new Dictionary<string, string>
|
||||||
{
|
{
|
||||||
{ "class", "btn" },
|
{ "class", "btn" },
|
||||||
|
|
@ -114,7 +114,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
||||||
public void GenerateStartTag_ReturnsNothingIfWhitespaceTagName()
|
public void GenerateStartTag_ReturnsNothingIfWhitespaceTagName()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var tagHelperOutput = new TagHelperOutput(" ",
|
var tagHelperOutput = new TagHelperOutput(" ",
|
||||||
attributes: new Dictionary<string, string>
|
attributes: new Dictionary<string, string>
|
||||||
{
|
{
|
||||||
{ "class", "btn" },
|
{ "class", "btn" },
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ namespace Microsoft.AspNet.Razor.Test
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var language = new CSharpRazorCodeLanguage();
|
var language = new CSharpRazorCodeLanguage();
|
||||||
var host = new RazorEngineHost(language);
|
var host = new RazorEngineHost(language);
|
||||||
var codeBuilderContext = new CodeBuilderContext(
|
var codeBuilderContext = new CodeBuilderContext(
|
||||||
host,
|
host,
|
||||||
"myclass",
|
"myclass",
|
||||||
|
|
|
||||||
|
|
@ -132,7 +132,7 @@ namespace Microsoft.AspNet.Razor.Test.Editor
|
||||||
parser.CheckForStructureChanges(new TextChange(0, 0, new StringTextBuffer(String.Empty), input.Length, input));
|
parser.CheckForStructureChanges(new TextChange(0, 0, new StringTextBuffer(String.Empty), input.Length, input));
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
MiscUtils.DoWithTimeoutIfNotDebugging(parseComplete.Wait);
|
MiscUtils.DoWithTimeoutIfNotDebugging(parseComplete.Wait);
|
||||||
|
|
||||||
Assert.Equal(
|
Assert.Equal(
|
||||||
SimpleCSHTMLDocumentGenerated.ReadAllText(),
|
SimpleCSHTMLDocumentGenerated.ReadAllText(),
|
||||||
|
|
|
||||||
|
|
@ -183,7 +183,7 @@ namespace Microsoft.AspNet.Razor.Test.Framework
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public MarkupTagHelperBlock(string tagName,
|
public MarkupTagHelperBlock(string tagName,
|
||||||
IDictionary<string, SyntaxTreeNode> attributes)
|
IDictionary<string, SyntaxTreeNode> attributes)
|
||||||
: this(tagName, attributes, new SyntaxTreeNode[0])
|
: this(tagName, attributes, new SyntaxTreeNode[0])
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -35,15 +35,15 @@ namespace Microsoft.AspNet.Razor.Test.Framework
|
||||||
|
|
||||||
protected abstract ParserBase SelectActiveParser(ParserBase codeParser, ParserBase markupParser);
|
protected abstract ParserBase SelectActiveParser(ParserBase codeParser, ParserBase markupParser);
|
||||||
|
|
||||||
public virtual ParserContext CreateParserContext(ITextDocument input,
|
public virtual ParserContext CreateParserContext(ITextDocument input,
|
||||||
ParserBase codeParser,
|
ParserBase codeParser,
|
||||||
ParserBase markupParser,
|
ParserBase markupParser,
|
||||||
ParserErrorSink errorSink)
|
ParserErrorSink errorSink)
|
||||||
{
|
{
|
||||||
return new ParserContext(input,
|
return new ParserContext(input,
|
||||||
codeParser,
|
codeParser,
|
||||||
markupParser,
|
markupParser,
|
||||||
SelectActiveParser(codeParser, markupParser),
|
SelectActiveParser(codeParser, markupParser),
|
||||||
errorSink);
|
errorSink);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -161,13 +161,13 @@ namespace Microsoft.AspNet.Razor.Test.Framework
|
||||||
return ParseDocument(document, designTimeParser: false, errorSink: errorSink);
|
return ParseDocument(document, designTimeParser: false, errorSink: errorSink);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual ParserResults ParseDocument(string document,
|
protected virtual ParserResults ParseDocument(string document,
|
||||||
bool designTimeParser,
|
bool designTimeParser,
|
||||||
ParserErrorSink errorSink)
|
ParserErrorSink errorSink)
|
||||||
{
|
{
|
||||||
return RunParse(document,
|
return RunParse(document,
|
||||||
parser => parser.ParseDocument,
|
parser => parser.ParseDocument,
|
||||||
designTimeParser,
|
designTimeParser,
|
||||||
parserSelector: c => c.MarkupParser,
|
parserSelector: c => c.MarkupParser,
|
||||||
errorSink: errorSink);
|
errorSink: errorSink);
|
||||||
}
|
}
|
||||||
|
|
@ -180,9 +180,9 @@ namespace Microsoft.AspNet.Razor.Test.Framework
|
||||||
return RunParse(document, parser => parser.ParseBlock, designTimeParser);
|
return RunParse(document, parser => parser.ParseBlock, designTimeParser);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual ParserResults RunParse(string document,
|
protected virtual ParserResults RunParse(string document,
|
||||||
Func<ParserBase, Action> parserActionSelector,
|
Func<ParserBase, Action> parserActionSelector,
|
||||||
bool designTimeParser,
|
bool designTimeParser,
|
||||||
Func<ParserContext, ParserBase> parserSelector = null,
|
Func<ParserContext, ParserBase> parserSelector = null,
|
||||||
ParserErrorSink errorSink = null)
|
ParserErrorSink errorSink = null)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -492,40 +492,40 @@ namespace Microsoft.AspNet.Razor.Test.Generator
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static LineMapping BuildLineMapping(int documentAbsoluteIndex,
|
protected static LineMapping BuildLineMapping(int documentAbsoluteIndex,
|
||||||
int documentLineIndex,
|
int documentLineIndex,
|
||||||
int generatedAbsoluteIndex,
|
int generatedAbsoluteIndex,
|
||||||
int generatedLineIndex,
|
int generatedLineIndex,
|
||||||
int characterOffsetIndex,
|
int characterOffsetIndex,
|
||||||
int contentLength)
|
int contentLength)
|
||||||
{
|
{
|
||||||
return BuildLineMapping(documentAbsoluteIndex,
|
return BuildLineMapping(documentAbsoluteIndex,
|
||||||
documentLineIndex,
|
documentLineIndex,
|
||||||
characterOffsetIndex,
|
characterOffsetIndex,
|
||||||
generatedAbsoluteIndex,
|
generatedAbsoluteIndex,
|
||||||
generatedLineIndex,
|
generatedLineIndex,
|
||||||
characterOffsetIndex,
|
characterOffsetIndex,
|
||||||
contentLength);
|
contentLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static LineMapping BuildLineMapping(int documentAbsoluteIndex,
|
protected static LineMapping BuildLineMapping(int documentAbsoluteIndex,
|
||||||
int documentLineIndex,
|
int documentLineIndex,
|
||||||
int documentCharacterOffsetIndex,
|
int documentCharacterOffsetIndex,
|
||||||
int generatedAbsoluteIndex,
|
int generatedAbsoluteIndex,
|
||||||
int generatedLineIndex,
|
int generatedLineIndex,
|
||||||
int generatedCharacterOffsetIndex,
|
int generatedCharacterOffsetIndex,
|
||||||
int contentLength)
|
int contentLength)
|
||||||
{
|
{
|
||||||
return new LineMapping(
|
return new LineMapping(
|
||||||
documentLocation: new MappingLocation(
|
documentLocation: new MappingLocation(
|
||||||
new SourceLocation(documentAbsoluteIndex,
|
new SourceLocation(documentAbsoluteIndex,
|
||||||
documentLineIndex,
|
documentLineIndex,
|
||||||
documentCharacterOffsetIndex),
|
documentCharacterOffsetIndex),
|
||||||
contentLength),
|
contentLength),
|
||||||
generatedLocation: new MappingLocation(
|
generatedLocation: new MappingLocation(
|
||||||
new SourceLocation(generatedAbsoluteIndex,
|
new SourceLocation(generatedAbsoluteIndex,
|
||||||
generatedLineIndex,
|
generatedLineIndex,
|
||||||
generatedCharacterOffsetIndex),
|
generatedCharacterOffsetIndex),
|
||||||
contentLength)
|
contentLength)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator.CodeTree
|
||||||
var result = codeBuilder.Build();
|
var result = codeBuilder.Build();
|
||||||
|
|
||||||
BaselineWriter.WriteBaseline(
|
BaselineWriter.WriteBaseline(
|
||||||
@"test\Microsoft.AspNet.Razor.Test\TestFiles\CodeGenerator\CS\Output\CSharpCodeBuilder.cs",
|
@"test\Microsoft.AspNet.Razor.Test\TestFiles\CodeGenerator\CS\Output\CSharpCodeBuilder.cs",
|
||||||
result.Code);
|
result.Code);
|
||||||
|
|
||||||
var expectedOutput = TestFile.Create("TestFiles/CodeGenerator/CS/Output/CSharpCodeBuilder.cs").ReadAllText();
|
var expectedOutput = TestFile.Create("TestFiles/CodeGenerator/CS/Output/CSharpCodeBuilder.cs").ReadAllText();
|
||||||
|
|
|
||||||
|
|
@ -221,7 +221,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator
|
||||||
{
|
{
|
||||||
Assert.True(spanIndex > 0);
|
Assert.True(spanIndex > 0);
|
||||||
|
|
||||||
var parser = new RazorParser(new CSharpCodeParser(),
|
var parser = new RazorParser(new CSharpCodeParser(),
|
||||||
new HtmlMarkupParser(),
|
new HtmlMarkupParser(),
|
||||||
tagHelperDescriptorResolver: null);
|
tagHelperDescriptorResolver: null);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ namespace Microsoft.AspNet.Razor
|
||||||
var block = new ExpressionBlock();
|
var block = new ExpressionBlock();
|
||||||
var addTagHelperDirective = spanFactory.MetaCode(SyntaxConstants.CSharp.AddTagHelperKeyword + " ");
|
var addTagHelperDirective = spanFactory.MetaCode(SyntaxConstants.CSharp.AddTagHelperKeyword + " ");
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
builder.StartChunkBlock<ExpressionBlockChunk>(block);
|
builder.StartChunkBlock<ExpressionBlockChunk>(block);
|
||||||
builder.AddAddTagHelperChunk("some text", addTagHelperDirective);
|
builder.AddAddTagHelperChunk("some text", addTagHelperDirective);
|
||||||
builder.EndChunkBlock();
|
builder.EndChunkBlock();
|
||||||
|
|
@ -45,7 +45,7 @@ namespace Microsoft.AspNet.Razor
|
||||||
var block = new ExpressionBlock();
|
var block = new ExpressionBlock();
|
||||||
var removeTagHelperDirective = spanFactory.MetaCode(SyntaxConstants.CSharp.RemoveTagHelperKeyword + " ");
|
var removeTagHelperDirective = spanFactory.MetaCode(SyntaxConstants.CSharp.RemoveTagHelperKeyword + " ");
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
builder.StartChunkBlock<ExpressionBlockChunk>(block);
|
builder.StartChunkBlock<ExpressionBlockChunk>(block);
|
||||||
builder.AddRemoveTagHelperChunk("some text", removeTagHelperDirective);
|
builder.AddRemoveTagHelperChunk("some text", removeTagHelperDirective);
|
||||||
builder.EndChunkBlock();
|
builder.EndChunkBlock();
|
||||||
|
|
@ -67,8 +67,8 @@ namespace Microsoft.AspNet.Razor
|
||||||
var spanFactory = SpanFactory.CreateCsHtml();
|
var spanFactory = SpanFactory.CreateCsHtml();
|
||||||
var previousSpan = spanFactory.EmptyHtml().Builder.Build();
|
var previousSpan = spanFactory.EmptyHtml().Builder.Build();
|
||||||
var builder = new CodeTreeBuilder();
|
var builder = new CodeTreeBuilder();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
builder.AddLiteralChunk("some text", previousSpan);
|
builder.AddLiteralChunk("some text", previousSpan);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
|
|
@ -87,7 +87,7 @@ namespace Microsoft.AspNet.Razor
|
||||||
var newSpan = spanFactory.Markup("<p>").Builder.Build();
|
var newSpan = spanFactory.Markup("<p>").Builder.Build();
|
||||||
var builder = new CodeTreeBuilder();
|
var builder = new CodeTreeBuilder();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
builder.AddLiteralChunk("<a>", previousSpan);
|
builder.AddLiteralChunk("<a>", previousSpan);
|
||||||
builder.AddLiteralChunk("<p>", newSpan);
|
builder.AddLiteralChunk("<p>", newSpan);
|
||||||
|
|
||||||
|
|
@ -110,7 +110,7 @@ namespace Microsoft.AspNet.Razor
|
||||||
var literalSpan = spanFactory.Markup("<p>").Builder.Build();
|
var literalSpan = spanFactory.Markup("<p>").Builder.Build();
|
||||||
var builder = new CodeTreeBuilder();
|
var builder = new CodeTreeBuilder();
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
builder.AddStatementChunk("int a = 10;", codeSpan);
|
builder.AddStatementChunk("int a = 10;", codeSpan);
|
||||||
builder.AddLiteralChunk("<p>", literalSpan);
|
builder.AddLiteralChunk("<p>", literalSpan);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler
|
||||||
|
|
||||||
var expected = new SourceLocation(
|
var expected = new SourceLocation(
|
||||||
absoluteIndex: 6 + newLine.Length + WriterNewLineLength,
|
absoluteIndex: 6 + newLine.Length + WriterNewLineLength,
|
||||||
lineIndex: 2,
|
lineIndex: 2,
|
||||||
characterIndex: 0);
|
characterIndex: 0);
|
||||||
|
|
||||||
Assert.Equal(expected, location);
|
Assert.Equal(expected, location);
|
||||||
|
|
@ -111,8 +111,8 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler
|
||||||
var location = writer.GetCurrentSourceLocation();
|
var location = writer.GetCurrentSourceLocation();
|
||||||
|
|
||||||
var expected = new SourceLocation(
|
var expected = new SourceLocation(
|
||||||
absoluteIndex: 9 + newLine.Length + newLine.Length,
|
absoluteIndex: 9 + newLine.Length + newLine.Length,
|
||||||
lineIndex: 2,
|
lineIndex: 2,
|
||||||
characterIndex: 2);
|
characterIndex: 2);
|
||||||
|
|
||||||
Assert.Equal(expected, location);
|
Assert.Equal(expected, location);
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator
|
||||||
{
|
{
|
||||||
if (directiveDescriptor.DirectiveType == TagHelperDirectiveType.RemoveTagHelper)
|
if (directiveDescriptor.DirectiveType == TagHelperDirectiveType.RemoveTagHelper)
|
||||||
{
|
{
|
||||||
// We don't yet support "typeName, assemblyName" for @removetaghelper in this test class. Will
|
// We don't yet support "typeName, assemblyName" for @removetaghelper in this test class. Will
|
||||||
// add that ability and add the corresponding end-to-end test verification in:
|
// add that ability and add the corresponding end-to-end test verification in:
|
||||||
// https://github.com/aspnet/Razor/issues/222
|
// https://github.com/aspnet/Razor/issues/222
|
||||||
descriptors = null;
|
descriptors = null;
|
||||||
|
|
|
||||||
|
|
@ -148,7 +148,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
|
||||||
[Fact]
|
[Fact]
|
||||||
public void ParseBlockSupportsLineCommentBetweenIfAndElseClause()
|
public void ParseBlockSupportsLineCommentBetweenIfAndElseClause()
|
||||||
{
|
{
|
||||||
SingleSpanBlockTest(@"if(foo) { bar(); }
|
SingleSpanBlockTest(@"if(foo) { bar(); }
|
||||||
// Foo
|
// Foo
|
||||||
// Bar
|
// Bar
|
||||||
else { baz(); }", BlockType.Statement, SpanKind.Code, acceptedCharacters: AcceptedCharacters.None);
|
else { baz(); }", BlockType.Statement, SpanKind.Code, acceptedCharacters: AcceptedCharacters.None);
|
||||||
|
|
@ -176,10 +176,10 @@ else if(bar) { baz(); }", BlockType.Statement, SpanKind.Code);
|
||||||
public void ParseBlockParsesElseIfBranchesOfIfStatement()
|
public void ParseBlockParsesElseIfBranchesOfIfStatement()
|
||||||
{
|
{
|
||||||
const string ifStatement = @"if(int i = 0; i < 10; new Foo { Bar = ""baz"" }) {
|
const string ifStatement = @"if(int i = 0; i < 10; new Foo { Bar = ""baz"" }) {
|
||||||
Debug.WriteLine(@""foo } bar"");
|
Debug.WriteLine(@""foo } bar"");
|
||||||
}";
|
}";
|
||||||
const string elseIfBranch = @" else if(int i = 0; i < 10; new Foo { Bar = ""baz"" }) {
|
const string elseIfBranch = @" else if(int i = 0; i < 10; new Foo { Bar = ""baz"" }) {
|
||||||
Debug.WriteLine(@""bar } baz"");
|
Debug.WriteLine(@""bar } baz"");
|
||||||
}";
|
}";
|
||||||
const string document = ifStatement + elseIfBranch;
|
const string document = ifStatement + elseIfBranch;
|
||||||
|
|
||||||
|
|
@ -190,10 +190,10 @@ else if(bar) { baz(); }", BlockType.Statement, SpanKind.Code);
|
||||||
public void ParseBlockParsesMultipleElseIfBranchesOfIfStatement()
|
public void ParseBlockParsesMultipleElseIfBranchesOfIfStatement()
|
||||||
{
|
{
|
||||||
const string ifStatement = @"if(int i = 0; i < 10; new Foo { Bar = ""baz"" }) {
|
const string ifStatement = @"if(int i = 0; i < 10; new Foo { Bar = ""baz"" }) {
|
||||||
Debug.WriteLine(@""foo } bar"");
|
Debug.WriteLine(@""foo } bar"");
|
||||||
}";
|
}";
|
||||||
const string elseIfBranch = @" else if(int i = 0; i < 10; new Foo { Bar = ""baz"" }) {
|
const string elseIfBranch = @" else if(int i = 0; i < 10; new Foo { Bar = ""baz"" }) {
|
||||||
Debug.WriteLine(@""bar } baz"");
|
Debug.WriteLine(@""bar } baz"");
|
||||||
}";
|
}";
|
||||||
const string document = ifStatement + elseIfBranch + elseIfBranch + elseIfBranch + elseIfBranch;
|
const string document = ifStatement + elseIfBranch + elseIfBranch + elseIfBranch + elseIfBranch;
|
||||||
SingleSpanBlockTest(document, BlockType.Statement, SpanKind.Code);
|
SingleSpanBlockTest(document, BlockType.Statement, SpanKind.Code);
|
||||||
|
|
@ -203,10 +203,10 @@ else if(bar) { baz(); }", BlockType.Statement, SpanKind.Code);
|
||||||
public void ParseBlockParsesMultipleElseIfBranchesOfIfStatementFollowedByOneElseBranch()
|
public void ParseBlockParsesMultipleElseIfBranchesOfIfStatementFollowedByOneElseBranch()
|
||||||
{
|
{
|
||||||
const string ifStatement = @"if(int i = 0; i < 10; new Foo { Bar = ""baz"" }) {
|
const string ifStatement = @"if(int i = 0; i < 10; new Foo { Bar = ""baz"" }) {
|
||||||
Debug.WriteLine(@""foo } bar"");
|
Debug.WriteLine(@""foo } bar"");
|
||||||
}";
|
}";
|
||||||
const string elseIfBranch = @" else if(int i = 0; i < 10; new Foo { Bar = ""baz"" }) {
|
const string elseIfBranch = @" else if(int i = 0; i < 10; new Foo { Bar = ""baz"" }) {
|
||||||
Debug.WriteLine(@""bar } baz"");
|
Debug.WriteLine(@""bar } baz"");
|
||||||
}";
|
}";
|
||||||
const string elseBranch = @" else { Debug.WriteLine(@""bar } baz""); }";
|
const string elseBranch = @" else { Debug.WriteLine(@""bar } baz""); }";
|
||||||
const string document = ifStatement + elseIfBranch + elseIfBranch + elseBranch;
|
const string document = ifStatement + elseIfBranch + elseIfBranch + elseBranch;
|
||||||
|
|
@ -218,10 +218,10 @@ else if(bar) { baz(); }", BlockType.Statement, SpanKind.Code);
|
||||||
public void ParseBlockStopsParsingCodeAfterElseBranch()
|
public void ParseBlockStopsParsingCodeAfterElseBranch()
|
||||||
{
|
{
|
||||||
const string ifStatement = @"if(int i = 0; i < 10; new Foo { Bar = ""baz"" }) {
|
const string ifStatement = @"if(int i = 0; i < 10; new Foo { Bar = ""baz"" }) {
|
||||||
Debug.WriteLine(@""foo } bar"");
|
Debug.WriteLine(@""foo } bar"");
|
||||||
}";
|
}";
|
||||||
const string elseIfBranch = @" else if(int i = 0; i < 10; new Foo { Bar = ""baz"" }) {
|
const string elseIfBranch = @" else if(int i = 0; i < 10; new Foo { Bar = ""baz"" }) {
|
||||||
Debug.WriteLine(@""bar } baz"");
|
Debug.WriteLine(@""bar } baz"");
|
||||||
}";
|
}";
|
||||||
const string elseBranch = @" else { Debug.WriteLine(@""bar } baz""); }";
|
const string elseBranch = @" else { Debug.WriteLine(@""bar } baz""); }";
|
||||||
const string document = ifStatement + elseIfBranch + elseBranch + elseIfBranch;
|
const string document = ifStatement + elseIfBranch + elseBranch + elseIfBranch;
|
||||||
|
|
@ -234,7 +234,7 @@ else if(bar) { baz(); }", BlockType.Statement, SpanKind.Code);
|
||||||
public void ParseBlockStopsParsingIfIfStatementNotFollowedByElse()
|
public void ParseBlockStopsParsingIfIfStatementNotFollowedByElse()
|
||||||
{
|
{
|
||||||
const string document = @"if(int i = 0; i < 10; new Foo { Bar = ""baz"" }) {
|
const string document = @"if(int i = 0; i < 10; new Foo { Bar = ""baz"" }) {
|
||||||
Debug.WriteLine(@""foo } bar"");
|
Debug.WriteLine(@""foo } bar"");
|
||||||
}";
|
}";
|
||||||
|
|
||||||
SingleSpanBlockTest(document, BlockType.Statement, SpanKind.Code);
|
SingleSpanBlockTest(document, BlockType.Statement, SpanKind.Code);
|
||||||
|
|
@ -245,7 +245,7 @@ else if(bar) { baz(); }", BlockType.Statement, SpanKind.Code);
|
||||||
{
|
{
|
||||||
// We don't want to be a full C# parser - If the else if is missing it's condition, the C# compiler can handle that, we have all the info we need to keep parsing
|
// We don't want to be a full C# parser - If the else if is missing it's condition, the C# compiler can handle that, we have all the info we need to keep parsing
|
||||||
const string ifBranch = @"if(int i = 0; i < 10; new Foo { Bar = ""baz"" }) {
|
const string ifBranch = @"if(int i = 0; i < 10; new Foo { Bar = ""baz"" }) {
|
||||||
Debug.WriteLine(@""foo } bar"");
|
Debug.WriteLine(@""foo } bar"");
|
||||||
}";
|
}";
|
||||||
const string elseIfBranch = @" else if { foo(); }";
|
const string elseIfBranch = @" else if { foo(); }";
|
||||||
const string document = ifBranch + elseIfBranch;
|
const string document = ifBranch + elseIfBranch;
|
||||||
|
|
@ -292,7 +292,7 @@ else if(bar) { baz(); }", BlockType.Statement, SpanKind.Code);
|
||||||
[Fact]
|
[Fact]
|
||||||
public void ParseBlockSupportsLineCommentBetweenDoAndWhileClause()
|
public void ParseBlockSupportsLineCommentBetweenDoAndWhileClause()
|
||||||
{
|
{
|
||||||
SingleSpanBlockTest(@"do { var foo = bar; }
|
SingleSpanBlockTest(@"do { var foo = bar; }
|
||||||
// Foo
|
// Foo
|
||||||
// Bar
|
// Bar
|
||||||
while(true);", BlockType.Statement, SpanKind.Code, acceptedCharacters: AcceptedCharacters.None);
|
while(true);", BlockType.Statement, SpanKind.Code, acceptedCharacters: AcceptedCharacters.None);
|
||||||
|
|
@ -449,7 +449,7 @@ while(true);", BlockType.Statement, SpanKind.Code, acceptedCharacters: AcceptedC
|
||||||
[Fact]
|
[Fact]
|
||||||
public void ParseBlockSupportsLineCommentBetweenTryAndFinallyClause()
|
public void ParseBlockSupportsLineCommentBetweenTryAndFinallyClause()
|
||||||
{
|
{
|
||||||
SingleSpanBlockTest(@"try { bar(); }
|
SingleSpanBlockTest(@"try { bar(); }
|
||||||
// Foo
|
// Foo
|
||||||
// Bar
|
// Bar
|
||||||
finally { baz(); }", BlockType.Statement, SpanKind.Code, acceptedCharacters: AcceptedCharacters.None);
|
finally { baz(); }", BlockType.Statement, SpanKind.Code, acceptedCharacters: AcceptedCharacters.None);
|
||||||
|
|
@ -483,8 +483,8 @@ catch(bar) { baz(); }", BlockType.Statement, SpanKind.Code);
|
||||||
public void ParseBlockSupportsMarkupWithinTryClause()
|
public void ParseBlockSupportsMarkupWithinTryClause()
|
||||||
{
|
{
|
||||||
RunSimpleWrappedMarkupTest(
|
RunSimpleWrappedMarkupTest(
|
||||||
prefix: "try {",
|
prefix: "try {",
|
||||||
markup: " <p>Foo</p> ",
|
markup: " <p>Foo</p> ",
|
||||||
suffix: "}",
|
suffix: "}",
|
||||||
expectedMarkup: new MarkupBlock(
|
expectedMarkup: new MarkupBlock(
|
||||||
Factory.Markup(" "),
|
Factory.Markup(" "),
|
||||||
|
|
@ -504,8 +504,8 @@ catch(bar) { baz(); }", BlockType.Statement, SpanKind.Code);
|
||||||
public void ParseBlockSupportsMarkupWithinCatchClause()
|
public void ParseBlockSupportsMarkupWithinCatchClause()
|
||||||
{
|
{
|
||||||
RunSimpleWrappedMarkupTest(
|
RunSimpleWrappedMarkupTest(
|
||||||
prefix: "try { var foo = new { } } catch(Foo Bar Baz) {",
|
prefix: "try { var foo = new { } } catch(Foo Bar Baz) {",
|
||||||
markup: " <p>Foo</p> ",
|
markup: " <p>Foo</p> ",
|
||||||
suffix: "}",
|
suffix: "}",
|
||||||
expectedMarkup: new MarkupBlock(
|
expectedMarkup: new MarkupBlock(
|
||||||
Factory.Markup(" "),
|
Factory.Markup(" "),
|
||||||
|
|
|
||||||
|
|
@ -284,7 +284,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.CSharp
|
||||||
Factory.Markup("<script>")),
|
Factory.Markup("<script>")),
|
||||||
Factory.Markup("(function foo() { return 1; })();"),
|
Factory.Markup("(function foo() { return 1; })();"),
|
||||||
new MarkupTagBlock(
|
new MarkupTagBlock(
|
||||||
Factory.Markup("</script>")),
|
Factory.Markup("</script>")),
|
||||||
Factory.Markup(" ")),
|
Factory.Markup(" ")),
|
||||||
Factory.MetaCode("}").Accepts(AcceptedCharacters.None)),
|
Factory.MetaCode("}").Accepts(AcceptedCharacters.None)),
|
||||||
Factory.EmptyHtml()));
|
Factory.EmptyHtml()));
|
||||||
|
|
|
||||||
|
|
@ -331,7 +331,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html
|
||||||
new MarkupBlock(
|
new MarkupBlock(
|
||||||
new MarkupTagBlock(
|
new MarkupTagBlock(
|
||||||
Factory.Markup("<foo>").Accepts(AcceptedCharacters.None)),
|
Factory.Markup("<foo>").Accepts(AcceptedCharacters.None)),
|
||||||
Factory.Markup("bar"),
|
Factory.Markup("bar"),
|
||||||
Factory.Markup("<!-- zoop -->").Accepts(AcceptedCharacters.None),
|
Factory.Markup("<!-- zoop -->").Accepts(AcceptedCharacters.None),
|
||||||
Factory.Markup("baz"),
|
Factory.Markup("baz"),
|
||||||
new MarkupTagBlock(
|
new MarkupTagBlock(
|
||||||
|
|
|
||||||
|
|
@ -285,7 +285,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser.Html
|
||||||
.Accepts(AcceptedCharacters.NonWhiteSpace))),
|
.Accepts(AcceptedCharacters.NonWhiteSpace))),
|
||||||
Factory.Markup("/Boz").With(new LiteralAttributeCodeGenerator(new LocationTagged<string>(String.Empty, 49, 0, 49), new LocationTagged<string>("/Boz", 49, 0, 49)))),
|
Factory.Markup("/Boz").With(new LiteralAttributeCodeGenerator(new LocationTagged<string>(String.Empty, 49, 0, 49), new LocationTagged<string>("/Boz", 49, 0, 49)))),
|
||||||
Factory.Markup(" />")),
|
Factory.Markup(" />")),
|
||||||
Factory.Markup(" ")
|
Factory.Markup(" ")
|
||||||
),
|
),
|
||||||
Factory.MetaCode("}").Accepts(AcceptedCharacters.None)),
|
Factory.MetaCode("}").Accepts(AcceptedCharacters.None)),
|
||||||
Factory.EmptyHtml()));
|
Factory.EmptyHtml()));
|
||||||
|
|
|
||||||
|
|
@ -58,12 +58,12 @@ namespace Microsoft.AspNet.Razor.Test.Parser.PartialParsing
|
||||||
{
|
{
|
||||||
return new RazorEngineHost(new TLanguage())
|
return new RazorEngineHost(new TLanguage())
|
||||||
{
|
{
|
||||||
GeneratedClassContext = new GeneratedClassContext("Execute",
|
GeneratedClassContext = new GeneratedClassContext("Execute",
|
||||||
"Write",
|
"Write",
|
||||||
"WriteLiteral",
|
"WriteLiteral",
|
||||||
"WriteTo",
|
"WriteTo",
|
||||||
"WriteLiteralTo",
|
"WriteLiteralTo",
|
||||||
"Template",
|
"Template",
|
||||||
"DefineSection",
|
"DefineSection",
|
||||||
new GeneratedTagHelperContext()),
|
new GeneratedTagHelperContext()),
|
||||||
DesignTimeMode = true
|
DesignTimeMode = true
|
||||||
|
|
|
||||||
|
|
@ -1181,9 +1181,9 @@ namespace Microsoft.AspNet.Razor.Test.TagHelpers
|
||||||
return new TagHelperDescriptorProvider(descriptors);
|
return new TagHelperDescriptorProvider(descriptors);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override ParserContext CreateParserContext(ITextDocument input,
|
public override ParserContext CreateParserContext(ITextDocument input,
|
||||||
ParserBase codeParser,
|
ParserBase codeParser,
|
||||||
ParserBase markupParser,
|
ParserBase markupParser,
|
||||||
ParserErrorSink errorSink)
|
ParserErrorSink errorSink)
|
||||||
{
|
{
|
||||||
return base.CreateParserContext(input, codeParser, markupParser, errorSink);
|
return base.CreateParserContext(input, codeParser, markupParser, errorSink);
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ namespace Microsoft.AspNet.Razor.Test.Text
|
||||||
[Fact]
|
[Fact]
|
||||||
public void TestIsDelete()
|
public void TestIsDelete()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var oldBuffer = new Mock<ITextBuffer>().Object;
|
var oldBuffer = new Mock<ITextBuffer>().Object;
|
||||||
var newBuffer = new Mock<ITextBuffer>().Object;
|
var newBuffer = new Mock<ITextBuffer>().Object;
|
||||||
var change = new TextChange(0, 1, oldBuffer, 0, newBuffer);
|
var change = new TextChange(0, 1, oldBuffer, 0, newBuffer);
|
||||||
|
|
@ -89,7 +89,7 @@ namespace Microsoft.AspNet.Razor.Test.Text
|
||||||
[Fact]
|
[Fact]
|
||||||
public void TestDeleteCreatesTheRightSizeChange()
|
public void TestDeleteCreatesTheRightSizeChange()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var oldBuffer = new Mock<ITextBuffer>().Object;
|
var oldBuffer = new Mock<ITextBuffer>().Object;
|
||||||
var newBuffer = new Mock<ITextBuffer>().Object;
|
var newBuffer = new Mock<ITextBuffer>().Object;
|
||||||
var change = new TextChange(0, 1, oldBuffer, 0, newBuffer);
|
var change = new TextChange(0, 1, oldBuffer, 0, newBuffer);
|
||||||
|
|
@ -102,7 +102,7 @@ namespace Microsoft.AspNet.Razor.Test.Text
|
||||||
[Fact]
|
[Fact]
|
||||||
public void TestIsInsert()
|
public void TestIsInsert()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var oldBuffer = new Mock<ITextBuffer>().Object;
|
var oldBuffer = new Mock<ITextBuffer>().Object;
|
||||||
var newBuffer = new Mock<ITextBuffer>().Object;
|
var newBuffer = new Mock<ITextBuffer>().Object;
|
||||||
var change = new TextChange(0, 0, oldBuffer, 35, newBuffer);
|
var change = new TextChange(0, 0, oldBuffer, 35, newBuffer);
|
||||||
|
|
@ -114,7 +114,7 @@ namespace Microsoft.AspNet.Razor.Test.Text
|
||||||
[Fact]
|
[Fact]
|
||||||
public void TestInsertCreateTheRightSizeChange()
|
public void TestInsertCreateTheRightSizeChange()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var oldBuffer = new Mock<ITextBuffer>().Object;
|
var oldBuffer = new Mock<ITextBuffer>().Object;
|
||||||
var newBuffer = new Mock<ITextBuffer>().Object;
|
var newBuffer = new Mock<ITextBuffer>().Object;
|
||||||
var change = new TextChange(0, 0, oldBuffer, 1, newBuffer);
|
var change = new TextChange(0, 0, oldBuffer, 1, newBuffer);
|
||||||
|
|
@ -127,7 +127,7 @@ namespace Microsoft.AspNet.Razor.Test.Text
|
||||||
[Fact]
|
[Fact]
|
||||||
public void TestIsReplace()
|
public void TestIsReplace()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var oldBuffer = new Mock<ITextBuffer>().Object;
|
var oldBuffer = new Mock<ITextBuffer>().Object;
|
||||||
var newBuffer = new Mock<ITextBuffer>().Object;
|
var newBuffer = new Mock<ITextBuffer>().Object;
|
||||||
var change = new TextChange(0, 5, oldBuffer, 10, newBuffer);
|
var change = new TextChange(0, 5, oldBuffer, 10, newBuffer);
|
||||||
|
|
@ -139,7 +139,7 @@ namespace Microsoft.AspNet.Razor.Test.Text
|
||||||
[Fact]
|
[Fact]
|
||||||
public void ReplaceCreatesTheRightSizeChange()
|
public void ReplaceCreatesTheRightSizeChange()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var oldBuffer = new Mock<ITextBuffer>().Object;
|
var oldBuffer = new Mock<ITextBuffer>().Object;
|
||||||
var newBuffer = new Mock<ITextBuffer>().Object;
|
var newBuffer = new Mock<ITextBuffer>().Object;
|
||||||
var change = new TextChange(0, 5, oldBuffer, 10, newBuffer);
|
var change = new TextChange(0, 5, oldBuffer, 10, newBuffer);
|
||||||
|
|
@ -152,7 +152,7 @@ namespace Microsoft.AspNet.Razor.Test.Text
|
||||||
[Fact]
|
[Fact]
|
||||||
public void ReplaceCreatesTheRightSizeChange1()
|
public void ReplaceCreatesTheRightSizeChange1()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var oldBuffer = new Mock<ITextBuffer>().Object;
|
var oldBuffer = new Mock<ITextBuffer>().Object;
|
||||||
var newBuffer = new Mock<ITextBuffer>().Object;
|
var newBuffer = new Mock<ITextBuffer>().Object;
|
||||||
var change = new TextChange(0, 5, oldBuffer, 1, newBuffer);
|
var change = new TextChange(0, 5, oldBuffer, 1, newBuffer);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue