Skip to content

Conversation

@Pichers
Copy link
Collaborator

@Pichers Pichers commented Jun 11, 2025

Description

Added support for function invocations in If conditions

Example

if (function(x)){ _logic_ }

Related Issue

Closes #22

Type of change

  • Bug fix
  • New feature
  • Documentation update
  • Code refactoring

How Has This Been Tested?

Added tests that verify the correct functionality

@Pichers Pichers requested a review from CatarinaGamboa June 11, 2025 17:25
@Pichers
Copy link
Collaborator Author

Pichers commented Jun 11, 2025

@CatarinaGamboa a verificação do return type da função adequa-se, ou não vale a pena tendo em conta que já é checked pelo compiler?

visitCtFieldRead((CtFieldRead<?>)condition);
} else if (condition instanceof CtInvocation) {
CtInvocation<?> invocation = (CtInvocation<?>) condition;
if (!invocation.getType().getQualifiedName().equals("boolean")) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to check this as the Java compiler already performs this check

}

public void test(@Free Object v1, boolean c1){
if (boolRead(c1)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now add more tests with methods that use the Objects with permissions like @Unique, and see if their changes are added to the context after the call.

@CatarinaGamboa
Copy link
Collaborator

@CatarinaGamboa a verificação do return type da função adequa-se, ou não vale a pena tendo em conta que já é checked pelo compiler?

Não é preciso fazermos porque estamos a trabalhar sobre o compilador de Java e por isso já sabemos que os tipos básicos fazem type check.

@Pichers Pichers self-assigned this Jun 15, 2025
@Pichers Pichers requested a review from CatarinaGamboa June 15, 2025 16:43
@Pichers Pichers merged commit f53f95e into main Jun 16, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for functions in If conditions

3 participants