Microsoft.Zing.Splicer.GenerateInterfaceMethod C# (CSharp) Method

GenerateInterfaceMethod() private method

private GenerateInterfaceMethod ( ZMethod zMethod ) : Class
zMethod ZMethod
return Class
        private Class GenerateInterfaceMethod(ZMethod zMethod)
        {
            this.currentMethod = zMethod;

            Class newClass = (Class)Templates.GetTypeTemplateByName("InterfaceMethod");

            Debug.Assert(!zMethod.IsStatic);
            GenerateThisParameter(newClass);

            Class inputsClass = (Class)Templates.GetMemberByName(newClass.Members, "InputVars");
            GenerateInputs(zMethod, inputsClass);

            Class outputsClass = (Class)Templates.GetMemberByName(newClass.Members, "OutputVars");
            GenerateOutputs(zMethod, outputsClass);

            Replacer.Replace(newClass, newClass.Name, zMethod.Name);

            // If this method doesn't return concrete bool, then remove the helper
            // property for accessing bool return values.
            if (zMethod.ReturnType == SystemTypes.Boolean)
            {
                Property boolRetValProp = (Property)Templates.GetTypeTemplateByName("BooleanReturnValueProperty").Members[0];
                newClass.Members.Add(boolRetValProp);
                boolRetValProp.DeclaringType = newClass;
                newClass.Members.Add(boolRetValProp.Getter);
                boolRetValProp.Getter.DeclaringType = newClass;
            }

            // Clear the "Activated" attribute if we aren't...
            if (!zMethod.Activated)
                newClass.Attributes = new AttributeList(0);

            this.currentMethod = null;

            return newClass;
        }