Skip to content

Commit

Permalink
Fix CheckStyle violations
Browse files Browse the repository at this point in the history
  • Loading branch information
Thushara-Piyasekara committed Mar 28, 2024
1 parent 9f31bba commit 4e00787
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
import static org.wso2.ballerinalang.compiler.bir.codegen.JvmConstants.MODULE_INIT_CLASS_NAME;
import static org.wso2.ballerinalang.compiler.bir.codegen.JvmConstants.MODULE_STARTED;
import static org.wso2.ballerinalang.compiler.bir.codegen.JvmConstants.MODULE_START_ATTEMPTED;
import static org.wso2.ballerinalang.compiler.bir.codegen.JvmConstants.MODULE_START_PARENT_ATTEMPTED;
import static org.wso2.ballerinalang.compiler.bir.codegen.JvmConstants.OBJECT_SELF_INSTANCE;
import static org.wso2.ballerinalang.compiler.bir.codegen.JvmConstants.STACK;
import static org.wso2.ballerinalang.compiler.bir.codegen.JvmConstants.STRAND;
Expand Down Expand Up @@ -392,11 +393,16 @@ public void genJMethodForBFunc(BIRFunction func, ClassWriter cw, BIRPackage modu
private void setFunctionInvocationVar(int localVarOffset, MethodVisitor mv, int invocationVarIndex,
int invocationCountArgVarIndex, PackageID packageID, String funcName) {

if (isModuleInitFunction(funcName) || isModuleStartFunction(funcName)) {
if (isModuleInitFunction(funcName)) {
String moduleClass = JvmCodeGenUtil.getModuleLevelClassName(packageID, MODULE_INIT_CLASS_NAME);
generateFunctionAttemptedBooleanCheck(MODULE_INIT_ATTEMPTED, mv, moduleClass);
}

if (isModuleStartFunction(funcName)) {
String moduleClass = JvmCodeGenUtil.getModuleLevelClassName(packageID, MODULE_INIT_CLASS_NAME);
generateFunctionAttemptedBooleanCheck(MODULE_START_PARENT_ATTEMPTED, mv, moduleClass);
}

if (invocationCountArgVarIndex == -1) {
mv.visitVarInsn(ALOAD, localVarOffset);
mv.visitInsn(DUP);
Expand All @@ -412,7 +418,8 @@ private void setFunctionInvocationVar(int localVarOffset, MethodVisitor mv, int
mv.visitVarInsn(ISTORE, invocationVarIndex);
}

private void generateFunctionAttemptedBooleanCheck(String staticFieldName, MethodVisitor mv, String moduleClassPath) {
private void generateFunctionAttemptedBooleanCheck(String staticFieldName, MethodVisitor mv,
String moduleClassPath) {
mv.visitFieldInsn(GETSTATIC, moduleClassPath, staticFieldName, "Z");
Label labelIf = new Label();
mv.visitJumpInsn(IFEQ, labelIf);
Expand Down

0 comments on commit 4e00787

Please sign in to comment.