Exemple #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> >();
 }
        /*//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>>();
        }
Exemple #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, "");
        }