Example #1
0
        public static Compilation Link(ExcessContext ctx, Compilation compilation, Dictionary <SyntaxTree, SyntaxTree> track = null)
        {
            Compilation result = compilation;

            foreach (var tree in compilation.SyntaxTrees)
            {
                SyntaxTree curr = ctx.fixErrors(tree, result, out result);

                var linker     = new Linker(ctx, result);
                var resultTree = linker.link(curr.GetRoot(), out result).SyntaxTree;
                if (track != null)
                {
                    track[tree] = resultTree;
                }
            }

            return(result);
        }
Example #2
0
        public static Compilation Link(ExcessContext ctx, Compilation compilation, IEnumerable <SyntaxTree> trees, Dictionary <SyntaxTree, SyntaxTree> track = null)
        {
            Compilation result = compilation;

            foreach (var tree in trees)
            {
                //add usings
                var        root       = tree.GetRoot() as CompilationUnitSyntax;
                var        actualTree = root.SyntaxTree;
                SyntaxTree curr       = ctx.fixErrors(actualTree, result, out result);

                Linker linker     = new Linker(ctx, result);
                var    resultTree = linker.link(curr.GetRoot(), out result).SyntaxTree;

                if (track != null)
                {
                    track[tree] = resultTree;
                }
            }

            return(result);
        }