public override void VisitMethodCPPModel(MethodCPPModel model)
        {
            Context.Method = model;

            var pars = string.Join(", ", model.Parameters.Select(arg =>
            {
                var pass = "";
                switch (arg.Pass)
                {
                case ArgumentPassCPPModel.Ref:
                    pass = "******";
                    break;

                case ArgumentPassCPPModel.Pointer:
                    pass = "******";
                    break;

                case ArgumentPassCPPModel.Raw:
                    pass = "******";
                    break;
                }
                return($"{TypeLookup.LookupCPPTypeName(arg.ParameterType)}{pass}{arg.Name}");
            }));

            AppendLine($"{TypeLookup.LookupCPPTypeName(model.ReturnType)} {Context.Class.Name}::{model.Name}({pars})");
            OpenBlock();
            VisitChildren(model.Members);
            CloseBlock();
        }
Пример #2
0
        public override void VisitMethodDeclaration(MethodDeclarationSyntax node)
        {
            _methodInfo = TypeResolver.ResolveMethodInfo(node);

            _method                        = new MethodCPPModel(Modifiers: new ModifiersCPPModel());
            _method.Name                   = node.Identifier.ToString();
            _method.ReturnType             = _methodInfo.ReturnType;
            _method.Modifiers.AccessType   = node.Modifiers.ExtractAccessType();
            _method.Modifiers.InstanceType = node.Modifiers.ExtractInstanceType();

            Visit(node.ParameterList);

            using (Context.WithCodeContainer(_method))
            {
                Invoke <BlockVisitor>(node.Body);
            }
        }
        public override void VisitMethodCPPModel(MethodCPPModel model)
        {
            var pars = string.Join(", ", model.Parameters.Select(arg =>
            {
                var pass = "";
                switch (arg.Pass)
                {
                case ArgumentPassCPPModel.Ref:
                    pass = "******";
                    break;

                case ArgumentPassCPPModel.Pointer:
                    pass = "******";
                    break;

                case ArgumentPassCPPModel.Raw:
                    pass = "******";
                    break;
                }
                return($"{TypeLookup.LookupCPPTypeName(arg.ParameterType)}{pass}{arg.Name}");
            }));

            AppendLine($"{CPPModelTools.Modifiers(model.Modifiers)} {TypeLookup.LookupCPPTypeName(model.ReturnType)} {model.Name}({pars});");
        }
Пример #4
0
 public override void VisitMethodCPPModel(MethodCPPModel model)
 {
     Invoke <ClassMethodCModelVisitor>(model);
 }