IronRuby.Runtime.Loader.CompileRubySource C# (CSharp) Method

CompileRubySource() private method

private CompileRubySource ( SourceUnit sourceUnit, LoadFlags flags ) : ScriptCode
sourceUnit SourceUnit
flags LoadFlags
return Microsoft.Scripting.ScriptCode
        private ScriptCode/*!*/ CompileRubySource(SourceUnit/*!*/ sourceUnit, LoadFlags flags) {
            Assert.NotNull(sourceUnit);
            
            // TODO: check file timestamp
            string fullPath = Platform.GetFullPath(sourceUnit.Path);
            CompiledFile compiledFile;
            if (TryGetCompiledFile(fullPath, out compiledFile)) {
                Utils.Log(String.Format("{0}: {1}", ++_cacheHitCount, sourceUnit.Path), "LOAD_CACHED");

                return compiledFile.CompiledCode;
            } else {
                Utils.Log(String.Format("{0}: {1}", ++_compiledFileCount, sourceUnit.Path), "LOAD_COMPILED");

                RubyCompilerOptions options = new RubyCompilerOptions(_context.RubyOptions) {
                    FactoryKind = (flags & LoadFlags.LoadIsolated) != 0 ? TopScopeFactoryKind.WrappedFile : TopScopeFactoryKind.File
                };

                ScriptCode compiledCode = sourceUnit.Compile(options, _context.RuntimeErrorSink);
                AddCompiledFile(fullPath, compiledCode);
                return compiledCode;
            }
        }