Files
sbox-public/engine/Sandbox.Compiling/Compiler/Compiler.Generator.cs
James King 6e71079a04 Fix ILHotload falling apart when doing incremental compiles (#5376)
* Simplify by removing BeforeILHotloadProcessingTrees
* Strip ILHotload attribs when comparing syntax trees
* MethodBodyChanged attribute is versioned to support incremental compiles
* Possible fix for Facepunch/sbox-public#11275
2026-07-21 15:18:18 +02:00

42 lines
969 B
C#

using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
namespace Sandbox;
partial class Compiler
{
private Generator.Processor RunGenerators( CSharpCompilation compiler, List<SyntaxTree> syntaxTrees, CompilerOutput output )
{
var processor = new Generator.Processor()
{
AddonName = Name,
AddonFileMap = output.Archive.FileMap,
EnableCorelibPolyfills = _config.Whitelist
};
if ( Group.AllowFastHotload && incrementalState.HasState )
{
processor.Run( compiler, syntaxTrees, incrementalState.Compilation );
}
else
{
processor.Run( compiler, syntaxTrees );
}
output.Diagnostics.AddRange( processor.Diagnostics );
// Error within code generation itself
if ( processor.Exception != null )
{
Log.Error( processor.Exception, "Error when generating code" );
Sentry.SentrySdk.CaptureException( processor.Exception, scope =>
{
scope.SetTag( "group", "generator" );
} );
}
return processor;
}
}