Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[xamlc] return early in NodeILExtensions for ValidateOnly #24493

Merged
merged 1 commit into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Controls/src/Build.Tasks/ILContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,7 @@ public ILContext(ILProcessor il, MethodBody body, ModuleDefinition module, XamlC
public string XamlFilePath { get; internal set; }

public TaskLoggingHelper LoggingHelper { get; internal set; }

public bool ValidateOnly { get; set; }
}
}
12 changes: 12 additions & 0 deletions src/Controls/src/Build.Tasks/NodeILExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,10 @@ static Instruction PushParsedEnum(XamlCache cache, TypeReference enumRef, string

public static IEnumerable<Instruction> PushXmlLineInfo(this INode node, ILContext context)
{
if (context.ValidateOnly)
{
yield break;
}
var module = context.Body.Method.Module;

var xmlLineInfo = node as IXmlLineInfo;
Expand All @@ -447,6 +451,10 @@ public static IEnumerable<Instruction> PushXmlLineInfo(this INode node, ILContex

public static IEnumerable<Instruction> PushParentObjectsArray(this INode node, ILContext context)
{
if (context.ValidateOnly)
{
yield break;
}
var module = context.Body.Method.Module;

var nodes = new List<IElementNode>();
Expand Down Expand Up @@ -585,6 +593,10 @@ static IEnumerable<Instruction> PushNamescopes(INode node, ILContext context, Mo

public static IEnumerable<Instruction> PushServiceProvider(this INode node, ILContext context, FieldReference bpRef = null, PropertyReference propertyRef = null, TypeReference declaringTypeReference = null)
{
if (context.ValidateOnly)
{
yield break;
}
var module = context.Body.Method.Module;

#if NOSERVICEPROVIDER
Expand Down
1 change: 1 addition & 0 deletions src/Controls/src/Build.Tasks/SetPropertiesVisitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1666,6 +1666,7 @@ static void SetDataTemplate(IElementNode parentNode, ElementNode node, ILContext
Root = root,
XamlFilePath = parentContext.XamlFilePath,
LoggingHelper = parentContext.LoggingHelper,
ValidateOnly = parentContext.ValidateOnly,
};

//Instanciate nested class
Expand Down
1 change: 1 addition & 0 deletions src/Controls/src/Build.Tasks/XamlCTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ bool TryCoreCompile(MethodDefinition initComp, ILRootNode rootnode, string xamlF
{
XamlFilePath = xamlFilePath,
LoggingHelper = loggingHelper,
ValidateOnly = ValidateOnly,
};


Expand Down
Loading