Fix #1355 Make extension nodes check for their extensions
This commit is contained in:
parent
e05c697c58
commit
17800b6055
|
|
@ -38,7 +38,18 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
|
||||||
throw new ArgumentNullException(nameof(target));
|
throw new ArgumentNullException(nameof(target));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (context == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(context));
|
||||||
|
}
|
||||||
|
|
||||||
var extension = target.GetExtension<IInjectDirectiveTargetExtension>();
|
var extension = target.GetExtension<IInjectDirectiveTargetExtension>();
|
||||||
|
if (extension == null)
|
||||||
|
{
|
||||||
|
context.ReportMissingExtension<IInjectDirectiveTargetExtension>();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
extension.WriteInjectProperty(context, this);
|
extension.WriteInjectProperty(context, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,16 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions
|
||||||
|
|
||||||
public override void WriteNode(CodeTarget target, CSharpRenderingContext context)
|
public override void WriteNode(CodeTarget target, CSharpRenderingContext context)
|
||||||
{
|
{
|
||||||
|
if (target == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(target));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (context == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(context));
|
||||||
|
}
|
||||||
|
|
||||||
var extension = target.GetExtension<ITemplateTargetExtension>();
|
var extension = target.GetExtension<ITemplateTargetExtension>();
|
||||||
if (extension == null)
|
if (extension == null)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,23 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
|
||||||
|
|
||||||
public override void WriteNode(CodeTarget target, CSharpRenderingContext context)
|
public override void WriteNode(CodeTarget target, CSharpRenderingContext context)
|
||||||
{
|
{
|
||||||
|
if (target == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(target));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (context == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(context));
|
||||||
|
}
|
||||||
|
|
||||||
var extension = target.GetExtension<IPreallocatedAttributeTargetExtension>();
|
var extension = target.GetExtension<IPreallocatedAttributeTargetExtension>();
|
||||||
|
if (extension == null)
|
||||||
|
{
|
||||||
|
context.ReportMissingExtension<IPreallocatedAttributeTargetExtension>();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
extension.WriteAddPreallocatedTagHelperHtmlAttribute(context, this);
|
extension.WriteAddPreallocatedTagHelperHtmlAttribute(context, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,23 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
|
||||||
|
|
||||||
public override void WriteNode(CodeTarget target, CSharpRenderingContext context)
|
public override void WriteNode(CodeTarget target, CSharpRenderingContext context)
|
||||||
{
|
{
|
||||||
|
if (target == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(target));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (context == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(context));
|
||||||
|
}
|
||||||
|
|
||||||
var extension = target.GetExtension<IPreallocatedAttributeTargetExtension>();
|
var extension = target.GetExtension<IPreallocatedAttributeTargetExtension>();
|
||||||
|
if (extension == null)
|
||||||
|
{
|
||||||
|
context.ReportMissingExtension<IPreallocatedAttributeTargetExtension>();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
extension.WriteDeclarePreallocatedTagHelperAttribute(context, this);
|
extension.WriteDeclarePreallocatedTagHelperAttribute(context, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,23 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
|
||||||
|
|
||||||
public override void WriteNode(CodeTarget target, CSharpRenderingContext context)
|
public override void WriteNode(CodeTarget target, CSharpRenderingContext context)
|
||||||
{
|
{
|
||||||
|
if (target == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(target));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (context == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(context));
|
||||||
|
}
|
||||||
|
|
||||||
var extension = target.GetExtension<IPreallocatedAttributeTargetExtension>();
|
var extension = target.GetExtension<IPreallocatedAttributeTargetExtension>();
|
||||||
|
if (extension == null)
|
||||||
|
{
|
||||||
|
context.ReportMissingExtension<IPreallocatedAttributeTargetExtension>();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
extension.WriteDeclarePreallocatedTagHelperHtmlAttribute(context, this);
|
extension.WriteDeclarePreallocatedTagHelperHtmlAttribute(context, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,23 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
|
||||||
|
|
||||||
public override void WriteNode(CodeTarget target, CSharpRenderingContext context)
|
public override void WriteNode(CodeTarget target, CSharpRenderingContext context)
|
||||||
{
|
{
|
||||||
|
if (target == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(target));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (context == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(context));
|
||||||
|
}
|
||||||
|
|
||||||
var extension = target.GetExtension<IDesignTimeDirectiveTargetExtension>();
|
var extension = target.GetExtension<IDesignTimeDirectiveTargetExtension>();
|
||||||
|
if (extension == null)
|
||||||
|
{
|
||||||
|
context.ReportMissingExtension<IDesignTimeDirectiveTargetExtension>();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
extension.WriteDesignTimeDirective(context, this);
|
extension.WriteDesignTimeDirective(context, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,23 @@ namespace Microsoft.AspNetCore.Razor.Language.Intermediate
|
||||||
|
|
||||||
public override void WriteNode(CodeTarget target, CSharpRenderingContext context)
|
public override void WriteNode(CodeTarget target, CSharpRenderingContext context)
|
||||||
{
|
{
|
||||||
|
if (target == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(target));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (context == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(context));
|
||||||
|
}
|
||||||
|
|
||||||
var extension = target.GetExtension<IPreallocatedAttributeTargetExtension>();
|
var extension = target.GetExtension<IPreallocatedAttributeTargetExtension>();
|
||||||
|
if (extension == null)
|
||||||
|
{
|
||||||
|
context.ReportMissingExtension<IPreallocatedAttributeTargetExtension>();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
extension.WriteSetPreallocatedTagHelperProperty(context, this);
|
extension.WriteSetPreallocatedTagHelperProperty(context, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue