(method ComponentDefinitionMethod, w LanguageWriter, NameSpace string, ClassName string, implementationLines []string, isGlobal bool)
| 760 | } |
| 761 | |
| 762 | func writeMethod(method ComponentDefinitionMethod, w LanguageWriter, NameSpace string, ClassName string, implementationLines []string, isGlobal bool) error { |
| 763 | preCallLines := []string{} |
| 764 | checkCallLines := []string{} |
| 765 | postCallLines := []string{} |
| 766 | |
| 767 | retVals := "" |
| 768 | pythonInParams := "" |
| 769 | |
| 770 | wrapperReference := "self" |
| 771 | selfReference := "None" |
| 772 | if (!isGlobal) { |
| 773 | wrapperReference = "self._wrapper" |
| 774 | selfReference = "self" |
| 775 | } |
| 776 | cArguments := "" |
| 777 | if (!isGlobal) { |
| 778 | cArguments = "self._handle" |
| 779 | } |
| 780 | cCheckArguments := "" |
| 781 | if (!isGlobal) { |
| 782 | cCheckArguments = "self._handle" |
| 783 | } |
| 784 | doCheckCall := false |
| 785 | for k:=0; k<len(method.Params); k++ { |
| 786 | param := method.Params[k] |
| 787 | |
| 788 | cParams, err := generateCTypesParameter(param, ClassName, method.MethodName, NameSpace) |
| 789 | if (err != nil) { |
| 790 | return err |
| 791 | } |
| 792 | |
| 793 | switch param.ParamPass { |
| 794 | case "out", "return": |
| 795 | if (cArguments != "") { |
| 796 | cArguments = cArguments + ", "; |
| 797 | } |
| 798 | if (cCheckArguments != "") { |
| 799 | cCheckArguments = cCheckArguments + ", " |
| 800 | } |
| 801 | switch param.ParamType { |
| 802 | case "class", "optionalclass": { |
| 803 | if (retVals != "") { |
| 804 | retVals = retVals + ", "; |
| 805 | } |
| 806 | preCallLines = append(preCallLines, fmt.Sprintf("%sHandle = %s()", param.ParamName, cParams[0].ParamCallType)) |
| 807 | newArgument := fmt.Sprintf("%sHandle", param.ParamName) |
| 808 | cArguments = cArguments + newArgument |
| 809 | cCheckArguments = cCheckArguments + newArgument |
| 810 | |
| 811 | theWrapperReference := wrapperReference |
| 812 | subNameSpace, paramClassName, _ := decomposeParamClassName(param.ParamClass) |
| 813 | if len(subNameSpace) > 0 { |
| 814 | theWrapperReference = theWrapperReference + "._" + subNameSpace + "Wrapper" |
| 815 | subNameSpace = subNameSpace + "." |
| 816 | } |
| 817 | postCallLines = append(postCallLines, fmt.Sprintf("if %sHandle:", param.ParamName)) |
| 818 | postCallLines = append(postCallLines, |
| 819 | fmt.Sprintf(" %sObject = %s%s(%sHandle, %s)", |
no test coverage detected