diff --git a/source/Cosmos.IL2CPU/CompilerEngine.cs b/source/Cosmos.IL2CPU/CompilerEngine.cs index adc57a4ab..f852ac388 100644 --- a/source/Cosmos.IL2CPU/CompilerEngine.cs +++ b/source/Cosmos.IL2CPU/CompilerEngine.cs @@ -236,6 +236,7 @@ namespace Cosmos.IL2CPU using (var xScanner = new ILScanner(xAsm)) { xScanner.LogException = LogException; + xScanner.LogWarning = LogWarning; CompilerHelpers.DebugEvent += LogMessage; if (EnableLogging) { @@ -249,7 +250,7 @@ namespace Cosmos.IL2CPU } xScanner.QueueMethod(xInitMethod.DeclaringType.BaseType.GetMethod("Start")); xScanner.Execute(xInitMethod); - + AppAssemblerRingsCheck.Execute(xScanner, xInitMethod.DeclaringType.Assembly); using (var xOut = new StreamWriter(OutputFilename, false, Encoding.ASCII, 128 * 1024)) diff --git a/source/Cosmos.IL2CPU/ILScanner.cs b/source/Cosmos.IL2CPU/ILScanner.cs index 6ed7a0ee9..23ab3c5bb 100644 --- a/source/Cosmos.IL2CPU/ILScanner.cs +++ b/source/Cosmos.IL2CPU/ILScanner.cs @@ -31,6 +31,7 @@ namespace Cosmos.IL2CPU public class ILScanner : IDisposable { public LogExceptionDelegate LogException = null; + public Action LogWarning = null; protected ILReader mReader; protected AppAssembler mAsmblr; @@ -71,7 +72,7 @@ namespace Cosmos.IL2CPU mAsmblr = aAsmblr; mReader = new ILReader(); - mPlugManager = new PlugManager(LogException); + mPlugManager = new PlugManager(LogException, LogWarning); } public bool EnableLogging(string aPathname) diff --git a/source/Cosmos.IL2CPU/PlugManager.cs b/source/Cosmos.IL2CPU/PlugManager.cs index 522b5fd47..2345d3199 100644 --- a/source/Cosmos.IL2CPU/PlugManager.cs +++ b/source/Cosmos.IL2CPU/PlugManager.cs @@ -68,9 +68,10 @@ namespace Cosmos.IL2CPU return LabelName.GenerateFullName(m); } - public PlugManager(LogExceptionDelegate aLogException) + public PlugManager(LogExceptionDelegate aLogException, Action aLogWarning) { LogException = aLogException; + LogWarning = aLogWarning; } public void FindPlugImpls() @@ -321,7 +322,10 @@ namespace Cosmos.IL2CPU if (xAttrib == null || xAttrib.IsOptional) { - throw new Exception("Invalid plug method! Target method not found. : " + xMethod.GetFullName()); + if (LogWarning != null) + { + LogWarning("Invalid plug method! Target method not found. : " + xMethod.GetFullName()); + } } } } @@ -330,7 +334,10 @@ namespace Cosmos.IL2CPU if (xAttrib.IsWildcard && xAttrib.Assembler == null) { - throw new Exception("Wildcard PlugMethods need to use an assembler for now."); + if (LogWarning != null) + { + LogWarning("Wildcard PlugMethods need to use an assembler for now."); + } } } } @@ -355,6 +362,8 @@ namespace Cosmos.IL2CPU } } + public Action LogWarning; + private MethodBase ResolvePlug(Type aTargetType, List aImpls, MethodBase aMethod, Type[] aParamTypes) { //TODO: This method is "reversed" from old - remember that when porting @@ -717,7 +726,7 @@ namespace Cosmos.IL2CPU } else { - // private + // private xBindingFlagsToFindMethod = BindingFlags.NonPublic; } if (aMethod.IsStatic) diff --git a/source/Tools/PlugsInspector/Form1.cs b/source/Tools/PlugsInspector/Form1.cs index c0f8ae738..068fabb64 100644 --- a/source/Tools/PlugsInspector/Form1.cs +++ b/source/Tools/PlugsInspector/Form1.cs @@ -74,7 +74,9 @@ namespace PlugsInspector plugManager = new PlugManager((Exception ex) => { AddExceptionEntry(ex.Message); - }); + }, warning => + { + }); plugManager.ThrowExceptions = false; }