Skip to content

Commit

Permalink
Fix native method names
Browse files Browse the repository at this point in the history
  • Loading branch information
xpenatan committed Jan 24, 2024
1 parent 8b937ce commit c0195f5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ private static void setupAttributeMethod(IDLDefaultCodeParser idlParser, JParser
// When it's a get attribute method we pass a temp c++ object to copy to the returned temp c++ object.
}
isValue = false;
MethodDeclaration nativeMethod = IDLMethodParser.prepareNativeMethod(idlAttribute.isStatic, isValue, classDeclaration, methodDeclaration, "");
String methodName = methodDeclaration.getNameAsString();
MethodDeclaration nativeMethod = IDLMethodParser.prepareNativeMethod(idlAttribute.isStatic, isValue, classDeclaration, methodDeclaration, methodName, "");
if(nativeMethod != null) {
idlParser.onIDLAttributeGenerated(jParser, idlAttribute, isSet, classDeclaration, methodDeclaration, nativeMethod);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,14 @@ public static void generateMethod(IDLDefaultCodeParser idlParser, JParser jParse
}

private static void setupMethod(IDLDefaultCodeParser idlParser, JParser jParser, IDLMethod idlMethod, ClassOrInterfaceDeclaration classDeclaration, MethodDeclaration methodDeclaration) {
MethodDeclaration nativeMethodDeclaration = IDLMethodParser.prepareNativeMethod(idlMethod.isStaticMethod, idlMethod.isReturnValue, classDeclaration, methodDeclaration, idlMethod.operator);
MethodDeclaration nativeMethodDeclaration = IDLMethodParser.prepareNativeMethod(idlMethod.isStaticMethod, idlMethod.isReturnValue, classDeclaration, methodDeclaration, idlMethod.name, idlMethod.operator);
if(nativeMethodDeclaration != null) {
idlParser.onIDLMethodGenerated(jParser, idlMethod, classDeclaration, methodDeclaration, nativeMethodDeclaration);
}
}

public static MethodDeclaration prepareNativeMethod(boolean isStatic, boolean isReturnValue, ClassOrInterfaceDeclaration classDeclaration, MethodDeclaration methodDeclaration, String operator) {
MethodDeclaration nativeMethodDeclaration = generateNativeMethod(isReturnValue, methodDeclaration);
public static MethodDeclaration prepareNativeMethod(boolean isStatic, boolean isReturnValue, ClassOrInterfaceDeclaration classDeclaration, MethodDeclaration methodDeclaration, String methodName, String operator) {
MethodDeclaration nativeMethodDeclaration = generateNativeMethod(isReturnValue, methodDeclaration, methodName);
if(!JParserHelper.containsMethod(classDeclaration, nativeMethodDeclaration)) {
//Add native method if it does not exist
classDeclaration.getMembers().add(nativeMethodDeclaration);
Expand Down Expand Up @@ -322,8 +322,7 @@ private static String getFieldName(String type, int number, boolean isStatic) {
}
}

public static MethodDeclaration generateNativeMethod(boolean isReturnValue, MethodDeclaration methodDeclaration) {
String methodName = methodDeclaration.getNameAsString();
private static MethodDeclaration generateNativeMethod(boolean isReturnValue, MethodDeclaration methodDeclaration, String methodName) {
NodeList<Parameter> methodParameters = methodDeclaration.getParameters();
Type methodReturnType = methodDeclaration.getType();
boolean isStatic = methodDeclaration.isStatic();
Expand Down

0 comments on commit c0195f5

Please sign in to comment.