Exemplo n.º 1
0
        public override void EndStruct(Udbus.Parsing.BuildContext context, Udbus.Parsing.IParamCodeTypeHandler paramtypeHandler)
        {
            base.EndStruct(context, paramtypeHandler);
            //CodeStatement
            if (this.methodStatements.Count > 0) // If got field statements
            {
                this.method.Statements.Add(new CodeVariableDeclarationStatement(CodeBuilderCommon.typerefResult, CodeBuilderCommon.nameResult));
                // Got all the field assignment statements. Now put them in the method with result tests.
                CodeExpression exprTest = new CodeBinaryOperatorExpression(new CodeVariableReferenceExpression(CodeBuilderCommon.nameResult)
                    , CodeBinaryOperatorType.IdentityEquality, CodeBuilderCommon.exprReadResultSuccessValue
                );
                CodeStatement[] assignFields = CodeBuilderCommon.NestedExpression(exprTest, this.methodStatements).ToArray();
                this.method.Statements.AddRange(assignFields);
                this.method.Statements.Add(new CodeMethodReturnStatement(CodeBuilderCommon.varrefResult));

            } // Ends if got field statements
            else // Else no fields
            {
                // No statements ? No implementation.
                // return 0;
                this.method.Statements.Add(new CodeMethodReturnStatement(CodeBuilderCommon.exprBuildResultSuccessValue));

            } // Ends else no fields

            // Marshalling code needs the name, nothing else.
            paramtypeHandler.HandleStruct(new Udbus.Parsing.CodeParamType(new CodeTypeReference(this.fullname)),
                this.name,
                CodeBuilderCommon.GetScopedName(CodeBuilderCommon.nsDbusMarshalCustom, context.declarationHolder.Name)
            );

            System.Diagnostics.Trace.WriteLine(string.Format("InParam Ending Struct {0}", this.name));
            context.declarationHolder.Add(this.method);
        }
Exemplo n.º 2
0
 public override void EndStruct(Udbus.Parsing.BuildContext context, Udbus.Parsing.IParamCodeTypeHandler paramtypeHandler)
 {
     base.EndStruct(context, paramtypeHandler);
     context.declarationHolder.Add(this.declaration);
     paramtypeHandler.HandleStruct(new Udbus.Parsing.CodeParamDeclaredType(this.declaration), this.name,
         CodeBuilderCommon.GetScopedName(CodeBuilderCommon.nsDbusMarshalCustom, context.declarationHolder.Name)
     );
 }