Skip to content

Commit

Permalink
Add syntax kind for client init and resource, remote functions
Browse files Browse the repository at this point in the history
  • Loading branch information
lnash94 committed Mar 21, 2024
1 parent 0096822 commit b7b57d1
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,13 @@
import static io.ballerina.compiler.syntax.tree.SyntaxKind.FINAL_KEYWORD;
import static io.ballerina.compiler.syntax.tree.SyntaxKind.FUNCTION_KEYWORD;
import static io.ballerina.compiler.syntax.tree.SyntaxKind.ISOLATED_KEYWORD;
import static io.ballerina.compiler.syntax.tree.SyntaxKind.OBJECT_METHOD_DEFINITION;
import static io.ballerina.compiler.syntax.tree.SyntaxKind.OPEN_BRACE_TOKEN;
import static io.ballerina.compiler.syntax.tree.SyntaxKind.OPEN_PAREN_TOKEN;
import static io.ballerina.compiler.syntax.tree.SyntaxKind.PUBLIC_KEYWORD;
import static io.ballerina.compiler.syntax.tree.SyntaxKind.QUESTION_MARK_TOKEN;
import static io.ballerina.compiler.syntax.tree.SyntaxKind.REMOTE_KEYWORD;
import static io.ballerina.compiler.syntax.tree.SyntaxKind.RESOURCE_ACCESSOR_DEFINITION;
import static io.ballerina.compiler.syntax.tree.SyntaxKind.RESOURCE_KEYWORD;
import static io.ballerina.compiler.syntax.tree.SyntaxKind.RETURNS_KEYWORD;
import static io.ballerina.compiler.syntax.tree.SyntaxKind.RETURN_KEYWORD;
Expand Down Expand Up @@ -323,8 +325,9 @@ private FunctionDefinitionNode createInitFunction() throws BallerinaOpenApiExcep
FunctionBodyNode functionBodyNode = getInitFunctionBodyNode();
NodeList<Token> qualifierList = createNodeList(createToken(PUBLIC_KEYWORD), createToken(ISOLATED_KEYWORD));
IdentifierToken functionName = createIdentifierToken("init");
return createFunctionDefinitionNode(null, getInitDocComment(), qualifierList, createToken(FUNCTION_KEYWORD),
functionName, createEmptyNodeList(), functionSignatureNode, functionBodyNode);
return createFunctionDefinitionNode(OBJECT_METHOD_DEFINITION, getInitDocComment(), qualifierList,
createToken(FUNCTION_KEYWORD), functionName, createEmptyNodeList(), functionSignatureNode,
functionBodyNode);
}

/**
Expand Down Expand Up @@ -588,7 +591,8 @@ private FunctionDefinitionNode getClientMethodFunctionDefinitionNode(List<Annota
createNodeList(GeneratorUtils.getRelativeResourcePath(path, operation.getValue(),
null, openAPI.getComponents(), false)) :
createEmptyNodeList();
return createFunctionDefinitionNode(null,
SyntaxKind kind = resourceMode ? RESOURCE_ACCESSOR_DEFINITION : OBJECT_METHOD_DEFINITION;
return createFunctionDefinitionNode(kind,
metadataNode, qualifierList, functionKeyWord, functionName, relativeResourcePath,
functionSignatureNode, functionBodyNode);
}
Expand Down

0 comments on commit b7b57d1

Please sign in to comment.