mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-04-18 21:37:55 -04:00
* ! Reimplement SharedArrayPool because it is internal in .net runtime * ! Expose PublicArrayPool that maps to our copy of SharedArrayPool * ! CodeGenerator that remaps System.Buffers.ArrayPool.Shared calls to Sandbox.PublicArrayPool * ! Don't run ArrayPoolUpgrader in full engine builds * ! Add tests that verifies ArrayPool.Shared replacements * ! Remove ArrayPool.Shared from whitelist * ! Build AST from nodes instead of parsing text * ! Use Reflection to grab Gen2GcCallback instead of event polling
42 lines
1009 B
C#
42 lines
1009 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, incrementalState.PreHotloadSyntaxTrees );
|
|
}
|
|
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;
|
|
}
|
|
}
|