added MemberAccess to Assignable
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run

This commit is contained in:
Bruder John 2024-07-02 15:47:33 +02:00
parent 3996082fa7
commit f7338a06b3
4 changed files with 16 additions and 3 deletions

View File

@ -50,7 +50,7 @@ public class MethodCodeGen implements bytecode.visitor.MethodVisitor {
@Override
public void visit(ConstructorNode constructorNode) {
methodVisitor =
classWriter.visitMethod(mapper.mapAccessTypeToOpcode(constructorNode.accessType),
classWriter.visitMethod(mapper.mapAccessTypeToOpcode(constructorNode.accesModifier),
"<init>",
mapper.generateMethodDescriptor(new BaseType(TypeEnum.VOID), constructorNode.parameters),
null,

View File

@ -246,6 +246,9 @@ public class SemanticAnalyzer implements SemanticVisitor {
if (currentFields.get(toCheck.identifier) != null) {
var type = currentFields.get(toCheck.identifier);
toCheck.setTypeNode(type);
MemberAccessNode memberAccessNode = new MemberAccessNode(false);
memberAccessNode.identifiers.add(currentClass.identifier);
toCheck.memberAccess = memberAccessNode;
return new TypeCheckResult(true, type);
} else if (currentScope.getLocalVar(toCheck.identifier) != null) {
var type = currentScope.getLocalVar(toCheck.identifier);

View File

@ -0,0 +1,10 @@
// @expected: TypeMismatchException
public class AllFeaturesClassExample {
int x;
public boolean test(boolean x){
return this.x;
}
}

View File

@ -2,8 +2,8 @@
public class AllFeaturesClassExample {
int x;
public boolean test(boolean x){
return x;
public void test(){
x = 1;
}
}