diff --git a/Carbon.Core/Carbon.Components/Carbon.Modules b/Carbon.Core/Carbon.Components/Carbon.Modules index b2587205d..6c49e33a2 160000 --- a/Carbon.Core/Carbon.Components/Carbon.Modules +++ b/Carbon.Core/Carbon.Components/Carbon.Modules @@ -1 +1 @@ -Subproject commit b2587205d720bd1eea2fd10e1499cb49f968c874 +Subproject commit 6c49e33a29043e2cd199b56c9f51d3f1aec6098b diff --git a/Carbon.Core/Carbon/src/Jobs/ScriptCompilationThread.cs b/Carbon.Core/Carbon/src/Jobs/ScriptCompilationThread.cs index 718c1c529..cdb15157c 100644 --- a/Carbon.Core/Carbon/src/Jobs/ScriptCompilationThread.cs +++ b/Carbon.Core/Carbon/src/Jobs/ScriptCompilationThread.cs @@ -306,6 +306,11 @@ public override void Start() public override void ThreadFunction() { + if (Sources.TrueForAll(x => string.IsNullOrEmpty(x.Content))) + { + return; + } + try { Exceptions.Clear(); @@ -343,7 +348,7 @@ public override void ThreadFunction() var parseOptions = new CSharpParseOptions(LanguageVersion.Latest) .WithPreprocessorSymbols(conditionals); - var containsInternalCallHookOverride = Sources.Any(x => x.Content.Contains(_internalCallHookPattern)); + var containsInternalCallHookOverride = Sources.Any(x => !string.IsNullOrEmpty(x.Content) && x.Content.Contains(_internalCallHookPattern)); foreach (var source in Sources) { @@ -505,7 +510,7 @@ public override void ThreadFunction() public override void Dispose() { - ClassList.Clear(); + ClassList?.Clear(); Exceptions?.Clear(); Warnings?.Clear(); diff --git a/Carbon.Core/Carbon/src/Loaders/ScriptLoader.cs b/Carbon.Core/Carbon/src/Loaders/ScriptLoader.cs index 0ed69fa17..e0e1b067a 100644 --- a/Carbon.Core/Carbon/src/Loaders/ScriptLoader.cs +++ b/Carbon.Core/Carbon/src/Loaders/ScriptLoader.cs @@ -302,34 +302,37 @@ public IEnumerator Compile() if (AsyncLoader.Assembly == null) { - Logger.Error($"Failed compiling '{AsyncLoader.InitialSource.ContextFilePath}':"); - for (int i = 0; i < AsyncLoader.Exceptions.Count; i++) + if (AsyncLoader.Exceptions.Count > 0) { - var error = AsyncLoader.Exceptions[i]; - var print = $"{error.Error.ErrorText} [{error.Error.ErrorNumber}]\n ({error.Error.FileName} {error.Error.Column} line {error.Error.Line})"; - Logger.Error($" {i + 1:n0}. {print}"); - } + Logger.Error($"Failed compiling '{AsyncLoader.InitialSource.ContextFilePath}':"); + for (int i = 0; i < AsyncLoader.Exceptions.Count; i++) + { + var error = AsyncLoader.Exceptions[i]; + var print = $"{error.Error.ErrorText} [{error.Error.ErrorNumber}]\n ({error.Error.FileName} {error.Error.Column} line {error.Error.Line})"; + Logger.Error($" {i + 1:n0}. {print}"); + } - ModLoader.FailedMods.Add(new ModLoader.FailedMod - { - File = InitialSource.ContextFilePath, - Errors = AsyncLoader.Exceptions.Select(x => new ModLoader.FailedMod.Error + ModLoader.FailedMods.Add(new ModLoader.FailedMod { - Message = x.Error.ErrorText, - Number = x.Error.ErrorNumber, - Column = x.Error.Column, - Line = x.Error.Line - }).ToArray(), + File = InitialSource.ContextFilePath, + Errors = AsyncLoader.Exceptions.Select(x => new ModLoader.FailedMod.Error + { + Message = x.Error.ErrorText, + Number = x.Error.ErrorNumber, + Column = x.Error.Column, + Line = x.Error.Line + }).ToArray(), #if DEBUG - Warnings = AsyncLoader.Warnings.Select(x => new ModLoader.FailedMod.Error - { - Message = x.Error.ErrorText, - Number = x.Error.ErrorNumber, - Column = x.Error.Column, - Line = x.Error.Line - }).ToArray() + Warnings = AsyncLoader.Warnings.Select(x => new ModLoader.FailedMod.Error + { + Message = x.Error.ErrorText, + Number = x.Error.ErrorNumber, + Column = x.Error.Column, + Line = x.Error.Line + }).ToArray() #endif - }); + }); + } AsyncLoader.Exceptions.Clear(); AsyncLoader.Warnings.Clear();