Exemplo n.º 1
0
        public static Func <SyntaxNode, SyntaxNode> GetSyntaxMap(
            SourceWithMarkedNodes source0,
            SourceWithMarkedNodes source1
            )
        {
            var map0 = source0.MapMarksToSyntaxNodes();
            var map1 = source1.MapSyntaxNodesToMarks();

#if DUMP
            Console.WriteLine("========");
#endif
            return(new Func <SyntaxNode, SyntaxNode>(
                       node1 =>
            {
                if (
                    map1.TryGetValue(node1, out var mark) &&
                    map0.TryGetValue(mark, out var result)
                    )
                {
                    return result;
                }

#if DUMP
                Console.WriteLine($"? {node1.RawKind} [[{node1}]]");
#endif
                return null;
            }
                       ));
        }
Exemplo n.º 2
0
        public static Func <SyntaxNode, SyntaxNode> GetSyntaxMap(SourceWithMarkedNodes source0, SourceWithMarkedNodes source1)
        {
            var map0 = source0.MapMarksToSyntaxNodes();
            var map1 = source1.MapSyntaxNodesToMarks();

            return(new Func <SyntaxNode, SyntaxNode>(node1 =>
            {
                int mark;
                var result = map1.TryGetValue(node1, out mark) ? map0[mark] : null;
                return result;
            }));
        }
Exemplo n.º 3
0
        public static Func <SyntaxNode, SyntaxNode> GetSyntaxMap(SourceWithMarkedNodes source0, SourceWithMarkedNodes source1)
        {
            var map0 = source0.MapMarksToSyntaxNodes();
            var map1 = source1.MapSyntaxNodesToMarks();

            return(new Func <SyntaxNode, SyntaxNode>(node1 =>
            {
                int mark;
                SyntaxNode result;
                return map1.TryGetValue(node1, out mark) && map0.TryGetValue(mark, out result) ? result : null;
            }));
        }
Exemplo n.º 4
0
        public static Func<SyntaxNode, SyntaxNode> GetSyntaxMap(SourceWithMarkedNodes source0, SourceWithMarkedNodes source1)
        {
            var map0 = source0.MapMarksToSyntaxNodes();
            var map1 = source1.MapSyntaxNodesToMarks();
#if DUMP
            Console.WriteLine("========");
#endif
            return new Func<SyntaxNode, SyntaxNode>(node1 =>
            {
                int mark;
                SyntaxNode result;
                if (map1.TryGetValue(node1, out mark) && map0.TryGetValue(mark, out result))
                {
                    return result;
                }

#if DUMP
                Console.WriteLine($"? {node1.RawKind} [[{node1}]]");
#endif
                return null;
            });
        }
Exemplo n.º 5
0
 internal static Func<SyntaxNode, SyntaxNode> GetSyntaxMapFromMarkers(SourceWithMarkedNodes source0, SourceWithMarkedNodes source1)
 {
     return SourceWithMarkedNodes.GetSyntaxMap(source0, source1);
 }
Exemplo n.º 6
0
        public static Func<SyntaxNode, SyntaxNode> GetSyntaxMap(SourceWithMarkedNodes source0, SourceWithMarkedNodes source1)
        {
            var map0 = source0.MapMarksToSyntaxNodes();
            var map1 = source1.MapSyntaxNodesToMarks();

            return new Func<SyntaxNode, SyntaxNode>(node1 =>
            {
                int mark;
                var result = map1.TryGetValue(node1, out mark) ? map0[mark] : null;
                return result;
            });
        }
        public static Func<SyntaxNode, SyntaxNode> GetSyntaxMap(SourceWithMarkedNodes source0, SourceWithMarkedNodes source1)
        {
            var map0 = source0.MapMarksToSyntaxNodes();
            var map1 = source1.MapSyntaxNodesToMarks();

            return new Func<SyntaxNode, SyntaxNode>(node1 =>
            {
                int mark;
                SyntaxNode result;
                return map1.TryGetValue(node1, out mark) && map0.TryGetValue(mark, out result) ? result : null;
            });
        }