Exemplo n.º 1
0
        public RootNode CreateTree(Type t)
        {
            var node = new RootNode
              {
            Type = t
              };

              _recursionStack.Push(t);

              var members = GetMembers(t);

              node.Children = ProcessMembers(members);

              return node;
        }
Exemplo n.º 2
0
        public Delegate Generate(RootNode root)
        {
            var ctx = new DeserializerTypeContext
              {
            Type = root.Type
              };

              InitializeVars(ctx);

              var @switch = GetSwitchStatement(ctx, root.Children);

              ctx.BlockInsideLoop = GetInnerLoopTemplate(ctx, @switch);

              var lambda = GetTemplate(ctx);

              var del = CompileExpression(root.Type, lambda);

              _treeBuilder.AddKnownType(root.Type, del);

              return del;
        }