mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-08-01 16:28:36 -04:00
* 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
42 lines
969 B
C#
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;
|
|
}
|
|
}
|