Exemple #1
0
        private void ExternalMethod()
        {
            if (!Method.IsExternal)
            {
                return;
            }

            IsCILStream          = false;
            IsExecutePipeline    = false;
            IsStackFrameRequired = false;
            MethodData.IsMethodImplementationReplaced = false;

            var intrinsic = Architecture.GetInstrinsicMethod(Method.ExternMethodModule);

            if (intrinsic != null)
            {
                return;
            }

            Symbol.ExternalSymbolName = Method.ExternMethodName;
            Symbol.IsExternalSymbol   = true;

            var filename = Method.ExternMethodModule;

            if (filename != null)
            {
                var bytes = Compiler.SearchPathsForFileAndLoad(filename);

                // TODO: Generate an error if the file is not found
                // CompilerException.FileNotFound

                Symbol.SetData(bytes);
            }

            if (NotifyTraceLogHandler != null)
            {
                var traceLog = new TraceLog(TraceType.MethodInstructions, Method, "XX-External Method", MethodData.Version);
                traceLog?.Log($"This method is external linked: {Method.ExternMethodName}");
                NotifyTraceLogHandler.Invoke(traceLog);
            }
        }