Example #1
0
 /*//from MapAstToDom
  * public Dictionary<CompilationUnit, List<CodeNamespace>> CompilationUnitToNameSpaces { get; set; }
  * public Dictionary<MethodDeclaration, CodeMemberMethod> MethodsAstToDom { get; set; }
  * public Dictionary<CodeMemberMethod, MethodDeclaration> MethodsDomToAst { get; set; }
  * public Dictionary<TypeDeclaration, CodeTypeDeclaration> TypesAstToDom { get; set; }
  * public Dictionary<CodeTypeDeclaration, TypeDeclaration> TypesDomToAst { get; set; }
  *
  * //from MapAstToNRefactory
  * public Dictionary<NRefactoryAST.CompilationUnit, ICompilationUnit> CompilationUnitToICompilationUnit { get; set; }
  * public Dictionary<NRefactoryAST.TypeDeclaration, IClass> TypeDeclarationToIClass { get; set; }
  * public Dictionary<IClass, NRefactoryAST.TypeDeclaration> IClassToTypeDeclaration { get; set; }
  * public Dictionary<NRefactoryAST.MethodDeclaration, IMethod> MethodDeclarationToIMethod { get; set; }
  * public Dictionary<IMethod, NRefactoryAST.MethodDeclaration> IMethodToMethodDeclaration { get; set; }
  * public Dictionary<NRefactoryAST.ConstructorDeclaration, IMethod> ConstructorDeclarationToIMethod { get; set; }
  * public Dictionary<IMethod, NRefactoryAST.ConstructorDeclaration> IMethodToConstructorDeclaration { get; set; }
  */
 public O2MappedAstData()
 {
     O2AstResolver = new O2AstResolver();
     //by default add these two (it slows down a bit, but it helps when viewing AST/DOM data
     O2AstResolver.addReference("System");
     //"added reference to MsCorLib.dll and System.dll".info();
     MapAstToDom           = new MapAstToDom();
     MapAstToNRefactory    = new MapAstToNRefactory(O2AstResolver.myProjectContent);
     FileToINodes          = new Dictionary <string, GetAllINodes>();
     FileToCompilationUnit = new Dictionary <string, CompilationUnit>();
     FileToSpecials        = new Dictionary <string, List <ISpecial> >();
 }
Example #2
0
        /*//from MapAstToDom
        public Dictionary<CompilationUnit, List<CodeNamespace>> CompilationUnitToNameSpaces { get; set; }
        public Dictionary<MethodDeclaration, CodeMemberMethod> MethodsAstToDom { get; set; }
        public Dictionary<CodeMemberMethod, MethodDeclaration> MethodsDomToAst { get; set; }
        public Dictionary<TypeDeclaration, CodeTypeDeclaration> TypesAstToDom { get; set; }
        public Dictionary<CodeTypeDeclaration, TypeDeclaration> TypesDomToAst { get; set; }

        //from MapAstToNRefactory
        public Dictionary<NRefactoryAST.CompilationUnit, ICompilationUnit> CompilationUnitToICompilationUnit { get; set; }
        public Dictionary<NRefactoryAST.TypeDeclaration, IClass> TypeDeclarationToIClass { get; set; }
        public Dictionary<IClass, NRefactoryAST.TypeDeclaration> IClassToTypeDeclaration { get; set; }
        public Dictionary<NRefactoryAST.MethodDeclaration, IMethod> MethodDeclarationToIMethod { get; set; }
        public Dictionary<IMethod, NRefactoryAST.MethodDeclaration> IMethodToMethodDeclaration { get; set; }
        public Dictionary<NRefactoryAST.ConstructorDeclaration, IMethod> ConstructorDeclarationToIMethod { get; set; }
        public Dictionary<IMethod, NRefactoryAST.ConstructorDeclaration> IMethodToConstructorDeclaration { get; set; }
        */
        public O2MappedAstData()
        {
            O2AstResolver = new O2AstResolver();
            //by default add these two (it slows down a bit, but it helps when viewing AST/DOM data
            O2AstResolver.addReference("System");
            //"added reference to MsCorLib.dll and System.dll".info();
            MapAstToDom = new MapAstToDom();
            MapAstToNRefactory = new MapAstToNRefactory(O2AstResolver.myProjectContent);
            FileToINodes = new Dictionary<string, GetAllINodes>();
            FileToCompilationUnit = new Dictionary<string,CompilationUnit>();
            FileToSpecials = new Dictionary<string, List<ISpecial>>();
        }
Example #3
0
        public void loadCompilationUnit(string filePath, List <ISpecial> specials, CompilationUnit compilationUnit)
        {
            //store specials
            FileToSpecials.add(filePath, specials);
            // map all INodes
            FileToINodes.add(filePath, new GetAllINodes(compilationUnit));
            FileToCompilationUnit.add(filePath, compilationUnit);
            //Map AsT to DOM (System.DOM classes)
            MapAstToDom.loadCompilationUnit(compilationUnit);
            //Map AST to NRefactory (ICompilationUnit, IClass, IMethod)
            MapAstToNRefactory.loadCompilationUnit(compilationUnit);

            // update variable for CodeComplete
            O2AstResolver.setCurrentCompilationUnit(compilationUnit);
            var iCompilationUnit = MapAstToNRefactory.CompilationUnitToICompilationUnit[compilationUnit];

            O2AstResolver.myProjectContent.UpdateCompilationUnit(null, iCompilationUnit, "");
        }
Example #4
0
        public void Dispose()
        {
            try
            {
                if (O2AstResolver.notNull())
                {
                    O2AstResolver.myProjectContent.Classes.Clear();
                    O2AstResolver.myProjectContent.ClassLists.Clear();
                    //O2AstResolver.myProjectContent.NamespaceNames.Clear();
                    O2AstResolver.myProjectContent.ReferencedContents.Clear();
                    O2AstResolver.pcRegistry.Dispose();


                    O2AstResolver.myProjectContent.Dispose();
                    GC.Collect(10, GCCollectionMode.Forced);
                }
                O2AstResolver = null;
                //"added reference to MsCorLib.dll and System.dll".info();
                MapAstToDom        = null;
                MapAstToNRefactory = null;
                if (FileToINodes.notNull())
                {
                    FileToINodes.Clear();
                }
                FileToINodes = null;
                if (FileToCompilationUnit.notNull())
                {
                    FileToCompilationUnit.Clear();
                }
                FileToCompilationUnit = null;
                if (FileToSpecials.notNull())
                {
                    FileToSpecials.Clear();
                }
                FileToSpecials = null;
            }
            catch (Exception ex)
            {
                ex.log("in O2MappedAstData.Dispose()");
            }
        }
Example #5
0
 public AstMethodFinder(O2AstResolver o2AstResolver)
 {
     O2AstResolver = o2AstResolver;
     foundMethods = new List<MethodDeclaration>();
     setupAstVisitor();
 }
Example #6
0
        public void Dispose()
        {
            try
            {
                if (O2AstResolver.notNull())
                {

                    O2AstResolver.myProjectContent.Classes.Clear();
                    O2AstResolver.myProjectContent.ClassLists.Clear();
                    //O2AstResolver.myProjectContent.NamespaceNames.Clear();
                    O2AstResolver.myProjectContent.ReferencedContents.Clear();
                    O2AstResolver.pcRegistry.Dispose();

                    O2AstResolver.myProjectContent.Dispose();
                    GC.Collect(10, GCCollectionMode.Forced);
                }
                O2AstResolver = null;
                //"added reference to MsCorLib.dll and System.dll".info();
                MapAstToDom = null;
                MapAstToNRefactory = null;
                if (FileToINodes.notNull())
                    FileToINodes.Clear();
                FileToINodes = null;
                if (FileToCompilationUnit.notNull())
                    FileToCompilationUnit.Clear();
                FileToCompilationUnit = null;
                if (FileToSpecials.notNull())
                    FileToSpecials.Clear();
                FileToSpecials = null;
            }
            catch (Exception ex)
            {
                ex.log("in O2MappedAstData.Dispose()");
            }
        }