Beispiel #1
0
        protected override IASTWalker CreateASTWalker(CSharpSyntaxNode node, SemanticModel semanticModel)
        {
            var walker = ProgramDefinitionASTWalker.Create(node, null, semanticModel);

            walker.Logger = this.Logger;

            return(walker);
        }
Beispiel #2
0
        private static string GetTranslation(string source)
        {
            // Getting the AST node
            CSharpSyntaxTree tree = ASTExtractor.Extract(source);

            SyntaxNode            node = new NodeLocator(tree).LocateLast(typeof(CompilationUnitSyntax));
            CompilationUnitSyntax compilationUnitNode = node as CompilationUnitSyntax;

            // Creating the walker
            var astWalker = ProgramDefinitionASTWalker.Create(compilationUnitNode);

            // Getting the translation unit
            ITranslationUnit translationUnit = astWalker.Walk();

            return(translationUnit.Translate());
        }
Beispiel #3
0
        private static string GetTranslation(string source)
        {
            // Getting the AST node
            CSharpSyntaxTree tree = ASTExtractor.Extract(source);

            var node = new NodeLocator(tree).LocateLast(typeof(CompilationUnitSyntax)) as CSharpSyntaxNode;

            // Transforming
            new ScriptNamespaceBasedASTTransformer().Transform(ref tree);

            var programNode = node as CompilationUnitSyntax;

            // Creating the walker
            var astWalker = ProgramDefinitionASTWalker.Create(programNode);

            // Getting the translation unit
            ITranslationUnit translationUnit = astWalker.Walk();

            return(translationUnit.Translate());
        }