Skip to content
This repository has been archived by the owner on Dec 19, 2018. It is now read-only.

Commit

Permalink
Don't render directive token from imports in design time
Browse files Browse the repository at this point in the history
  • Loading branch information
ajaybhargavb committed Mar 29, 2017
1 parent 582ffe2 commit 16706fb
Show file tree
Hide file tree
Showing 19 changed files with 34 additions and 452 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,14 @@ public override void VisitDirectiveToken(DirectiveTokenIRNode node)
const string TypeHelper = "__typeHelper";

var tokenKind = node.Descriptor.Kind;
if (node.Source == null)
if (!node.Source.HasValue ||
(Context.SourceDocument.FileName != null &&
!string.Equals(
Context.SourceDocument.FileName,
node.Source.Value.FilePath,
StringComparison.OrdinalIgnoreCase)))
{
// We don't want to handle directives from imports.
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,58 +33,6 @@ public class _TestFiles_Input_Basic_cshtml : global::Microsoft.AspNetCore.Mvc.Ra
{
#pragma warning disable 219
private void __RazorDirectiveTokenHelpers__() {
((System.Action)(() => {
global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TModel> __typeHelper = null;
}
))();
((System.Action)(() => {
System.Object Html = null;
}
))();
((System.Action)(() => {
global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper __typeHelper = null;
}
))();
((System.Action)(() => {
System.Object Json = null;
}
))();
((System.Action)(() => {
global::Microsoft.AspNetCore.Mvc.IViewComponentHelper __typeHelper = null;
}
))();
((System.Action)(() => {
System.Object Component = null;
}
))();
((System.Action)(() => {
global::Microsoft.AspNetCore.Mvc.IUrlHelper __typeHelper = null;
}
))();
((System.Action)(() => {
System.Object Url = null;
}
))();
((System.Action)(() => {
global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider __typeHelper = null;
}
))();
((System.Action)(() => {
System.Object ModelExpressionProvider = null;
}
))();
((System.Action)(() => {
System.Object __typeHelper = "Microsoft.AspNetCore.Razor.TagHelpers.UrlResolutionTagHelper, Microsoft.AspNetCore.Mvc.Razor";
}
))();
((System.Action)(() => {
System.Object __typeHelper = "Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper, Microsoft.AspNetCore.Mvc.Razor";
}
))();
((System.Action)(() => {
System.Object __typeHelper = "Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper, Microsoft.AspNetCore.Mvc.Razor";
}
))();
}
#pragma warning restore 219
private static System.Object __o = null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Source Location: (13:0,13 [4] /TestFiles/Input/Basic.cshtml)
|logo|
Generated Location: (2732:94,13 [4] )
Generated Location: (1024:42,13 [4] )
|logo|

Source Location: (43:2,5 [21] /TestFiles/Input/Basic.cshtml)
|Html.Input("SomeKey")|
Generated Location: (2817:99,6 [21] )
Generated Location: (1109:47,6 [21] )
|Html.Input("SomeKey")|

Original file line number Diff line number Diff line change
Expand Up @@ -39,58 +39,6 @@ public class _TestFiles_Input_Inject_cshtml : global::Microsoft.AspNetCore.Mvc.R
#pragma warning disable 219
private void __RazorDirectiveTokenHelpers__() {
((System.Action)(() => {
global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TModel> __typeHelper = null;
}
))();
((System.Action)(() => {
System.Object Html = null;
}
))();
((System.Action)(() => {
global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper __typeHelper = null;
}
))();
((System.Action)(() => {
System.Object Json = null;
}
))();
((System.Action)(() => {
global::Microsoft.AspNetCore.Mvc.IViewComponentHelper __typeHelper = null;
}
))();
((System.Action)(() => {
System.Object Component = null;
}
))();
((System.Action)(() => {
global::Microsoft.AspNetCore.Mvc.IUrlHelper __typeHelper = null;
}
))();
((System.Action)(() => {
System.Object Url = null;
}
))();
((System.Action)(() => {
global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider __typeHelper = null;
}
))();
((System.Action)(() => {
System.Object ModelExpressionProvider = null;
}
))();
((System.Action)(() => {
System.Object __typeHelper = "Microsoft.AspNetCore.Razor.TagHelpers.UrlResolutionTagHelper, Microsoft.AspNetCore.Mvc.Razor";
}
))();
((System.Action)(() => {
System.Object __typeHelper = "Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper, Microsoft.AspNetCore.Mvc.Razor";
}
))();
((System.Action)(() => {
System.Object __typeHelper = "Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper, Microsoft.AspNetCore.Mvc.Razor";
}
))();
((System.Action)(() => {
MyApp __typeHelper = null;
}
))();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Source Location: (28:1,8 [5] /TestFiles/Input/Inject.cshtml)
|MyApp|
Generated Location: (2577:93,0 [5] )
Generated Location: (869:41,0 [5] )
|MyApp|

Source Location: (34:1,14 [14] /TestFiles/Input/Inject.cshtml)
|MyPropertyName|
Generated Location: (2679:97,14 [14] )
Generated Location: (971:45,14 [14] )
|MyPropertyName|

Original file line number Diff line number Diff line change
Expand Up @@ -34,58 +34,6 @@ public class _TestFiles_Input_InjectWithModel_cshtml : global::Microsoft.AspNetC
#pragma warning disable 219
private void __RazorDirectiveTokenHelpers__() {
((System.Action)(() => {
global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TModel> __typeHelper = null;
}
))();
((System.Action)(() => {
System.Object Html = null;
}
))();
((System.Action)(() => {
global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper __typeHelper = null;
}
))();
((System.Action)(() => {
System.Object Json = null;
}
))();
((System.Action)(() => {
global::Microsoft.AspNetCore.Mvc.IViewComponentHelper __typeHelper = null;
}
))();
((System.Action)(() => {
System.Object Component = null;
}
))();
((System.Action)(() => {
global::Microsoft.AspNetCore.Mvc.IUrlHelper __typeHelper = null;
}
))();
((System.Action)(() => {
System.Object Url = null;
}
))();
((System.Action)(() => {
global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider __typeHelper = null;
}
))();
((System.Action)(() => {
System.Object ModelExpressionProvider = null;
}
))();
((System.Action)(() => {
System.Object __typeHelper = "Microsoft.AspNetCore.Razor.TagHelpers.UrlResolutionTagHelper, Microsoft.AspNetCore.Mvc.Razor";
}
))();
((System.Action)(() => {
System.Object __typeHelper = "Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper, Microsoft.AspNetCore.Mvc.Razor";
}
))();
((System.Action)(() => {
System.Object __typeHelper = "Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper, Microsoft.AspNetCore.Mvc.Razor";
}
))();
((System.Action)(() => {
MyModel __typeHelper = null;
}
))();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
Source Location: (7:0,7 [7] /TestFiles/Input/InjectWithModel.cshtml)
|MyModel|
Generated Location: (2479:88,0 [7] )
Generated Location: (771:36,0 [7] )
|MyModel|

Source Location: (24:1,8 [5] /TestFiles/Input/InjectWithModel.cshtml)
|MyApp|
Generated Location: (2569:92,0 [5] )
Generated Location: (861:40,0 [5] )
|MyApp|

Source Location: (30:1,14 [14] /TestFiles/Input/InjectWithModel.cshtml)
|MyPropertyName|
Generated Location: (2671:96,14 [14] )
Generated Location: (963:44,14 [14] )
|MyPropertyName|

Source Location: (54:2,8 [17] /TestFiles/Input/InjectWithModel.cshtml)
|MyService<TModel>|
Generated Location: (2755:100,0 [17] )
Generated Location: (1047:48,0 [17] )
|MyService<TModel>|

Source Location: (72:2,26 [4] /TestFiles/Input/InjectWithModel.cshtml)
|Html|
Generated Location: (2869:104,14 [4] )
Generated Location: (1161:52,14 [4] )
|Html|

Original file line number Diff line number Diff line change
Expand Up @@ -34,58 +34,6 @@ public class _TestFiles_Input_InjectWithSemicolon_cshtml : global::Microsoft.Asp
#pragma warning disable 219
private void __RazorDirectiveTokenHelpers__() {
((System.Action)(() => {
global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TModel> __typeHelper = null;
}
))();
((System.Action)(() => {
System.Object Html = null;
}
))();
((System.Action)(() => {
global::Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper __typeHelper = null;
}
))();
((System.Action)(() => {
System.Object Json = null;
}
))();
((System.Action)(() => {
global::Microsoft.AspNetCore.Mvc.IViewComponentHelper __typeHelper = null;
}
))();
((System.Action)(() => {
System.Object Component = null;
}
))();
((System.Action)(() => {
global::Microsoft.AspNetCore.Mvc.IUrlHelper __typeHelper = null;
}
))();
((System.Action)(() => {
System.Object Url = null;
}
))();
((System.Action)(() => {
global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider __typeHelper = null;
}
))();
((System.Action)(() => {
System.Object ModelExpressionProvider = null;
}
))();
((System.Action)(() => {
System.Object __typeHelper = "Microsoft.AspNetCore.Razor.TagHelpers.UrlResolutionTagHelper, Microsoft.AspNetCore.Mvc.Razor";
}
))();
((System.Action)(() => {
System.Object __typeHelper = "Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper, Microsoft.AspNetCore.Mvc.Razor";
}
))();
((System.Action)(() => {
System.Object __typeHelper = "Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper, Microsoft.AspNetCore.Mvc.Razor";
}
))();
((System.Action)(() => {
MyModel __typeHelper = null;
}
))();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
Source Location: (7:0,7 [7] /TestFiles/Input/InjectWithSemicolon.cshtml)
|MyModel|
Generated Location: (2483:88,0 [7] )
Generated Location: (775:36,0 [7] )
|MyModel|

Source Location: (24:1,8 [5] /TestFiles/Input/InjectWithSemicolon.cshtml)
|MyApp|
Generated Location: (2573:92,0 [5] )
Generated Location: (865:40,0 [5] )
|MyApp|

Source Location: (30:1,14 [14] /TestFiles/Input/InjectWithSemicolon.cshtml)
|MyPropertyName|
Generated Location: (2675:96,14 [14] )
Generated Location: (967:44,14 [14] )
|MyPropertyName|

Source Location: (58:2,8 [17] /TestFiles/Input/InjectWithSemicolon.cshtml)
|MyService<TModel>|
Generated Location: (2759:100,0 [17] )
Generated Location: (1051:48,0 [17] )
|MyService<TModel>|

Source Location: (76:2,26 [4] /TestFiles/Input/InjectWithSemicolon.cshtml)
|Html|
Generated Location: (2873:104,14 [4] )
Generated Location: (1165:52,14 [4] )
|Html|

Source Location: (93:3,8 [5] /TestFiles/Input/InjectWithSemicolon.cshtml)
|MyApp|
Generated Location: (2947:108,0 [5] )
Generated Location: (1239:56,0 [5] )
|MyApp|

Source Location: (99:3,14 [15] /TestFiles/Input/InjectWithSemicolon.cshtml)
|MyPropertyName2|
Generated Location: (3049:112,14 [15] )
Generated Location: (1341:60,14 [15] )
|MyPropertyName2|

Source Location: (129:4,8 [17] /TestFiles/Input/InjectWithSemicolon.cshtml)
|MyService<TModel>|
Generated Location: (3134:116,0 [17] )
Generated Location: (1426:64,0 [17] )
|MyService<TModel>|

Source Location: (147:4,26 [5] /TestFiles/Input/InjectWithSemicolon.cshtml)
|Html2|
Generated Location: (3248:120,14 [5] )
Generated Location: (1540:68,14 [5] )
|Html2|

Loading

0 comments on commit 16706fb

Please sign in to comment.