Пример #1
0
        private static Node GetRegisterServer(string typeName)
        {
            var logParamName = "log";

            var func = FunctionSignature.Generate(null, "RegisterServer", new[]
            {
                new FuncParamSig(logParamName, TypeModifier.ByReference, "log.Logger")
            }, null);
            var funcBody = new OpenDelimiter(BinaryDelimiterType.Brace);

            funcBody.AddChild(BinaryOpSequence.Generate(BinaryOperatorType.Assignment, new Identifier(LoggerVarName), new Identifier(logParamName)));
            funcBody.AddChild(new Terminal());

            funcBody.AddChild(FunctionCall.Generate("rpc.Register", new[]
            {
                new FuncCallParam(StructLiteral.Generate(typeName, null), TypeModifier.ByReference)
            }));

            funcBody.AddClosingDelimiter();
            func.AddChild(funcBody);

            return(func);
        }