Esempio n. 1
0
        public void Parse(IAstVisitor visitor, string path)
        {
            using (TextReader reader = File.OpenText(path))
            {
                IParser parser = _parserFactory.CreateCSharpParser(reader);
                parser.ParseMethodBodies = true;
                parser.Parse();

                _typeResolver.Clear();
                visitor.VisitCompilationUnit(parser.CompilationUnit, null);
                _cache.Add(path, parser);
            }
        }
Esempio n. 2
0
        public void Parse()
        {
            var unit = new CompilationUnit();

            using (mocks.Unordered())
            {
                Expect.Call(parserFactory.CreateCSharpParser(null)).Constraints(Is.NotNull()).Return(parser);
                parser.ParseMethodBodies = true;
                parser.Parse();
                typeResolver.Clear();
                Expect.Call(parser.CompilationUnit).Return(unit);
                Expect.Call(visitor.VisitCompilationUnit(unit, null)).Return(null);
                sources.Add(path, parser);
            }

            mocks.ReplayAll();
            service.Parse(visitor, path);
            mocks.VerifyAll();
        }