protected virtual MemberResolver Preconvert(MemberResolver resolver) { bool needRecompile = false; foreach (var sourceFile in this.ParsedSourceFiles) { var syntaxTree = sourceFile.SyntaxTree; var detecter = new PreconverterDetecter(resolver); syntaxTree.AcceptVisitor(detecter); if (detecter.Found) { var fixer = new PreconverterFixer(resolver); var astNode = syntaxTree.AcceptVisitor(fixer); syntaxTree = astNode != null ? (SyntaxTree)astNode : syntaxTree; sourceFile.SyntaxTree = syntaxTree; needRecompile = true; } } if (needRecompile) { return(new MemberResolver(this.ParsedSourceFiles, resolver.Assemblies, this.AssemblyDefinition)); } return(resolver); }
protected virtual MemberResolver Preconvert(MemberResolver resolver, IAssemblyInfo config) { bool needRecompile = false; foreach (var sourceFile in this.ParsedSourceFiles) { this.Log.Trace("Preconvert " + sourceFile.ParsedFile.FileName); var syntaxTree = sourceFile.SyntaxTree; var tempEmitter = new TempEmitter { AssemblyInfo = config }; var detecter = new PreconverterDetecter(resolver, tempEmitter); syntaxTree.AcceptVisitor(detecter); if (detecter.Found) { var fixer = new PreconverterFixer(resolver, tempEmitter, this.Log); var astNode = syntaxTree.AcceptVisitor(fixer); syntaxTree = astNode != null ? (SyntaxTree)astNode : syntaxTree; sourceFile.SyntaxTree = syntaxTree; needRecompile = true; } } if (needRecompile) { return(new MemberResolver(this.ParsedSourceFiles, resolver.Assemblies, this.AssemblyDefinition)); } return(resolver); }