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 @Override
public void visit(ConstructorNode constructorNode) { public void visit(ConstructorNode constructorNode) {
methodVisitor = methodVisitor =
classWriter.visitMethod(mapper.mapAccessTypeToOpcode(constructorNode.accessType), classWriter.visitMethod(mapper.mapAccessTypeToOpcode(constructorNode.accesModifier),
"<init>", "<init>",
mapper.generateMethodDescriptor(new BaseType(TypeEnum.VOID), constructorNode.parameters), mapper.generateMethodDescriptor(new BaseType(TypeEnum.VOID), constructorNode.parameters),
null, null,

View File

@ -246,6 +246,9 @@ public class SemanticAnalyzer implements SemanticVisitor {
if (currentFields.get(toCheck.identifier) != null) { if (currentFields.get(toCheck.identifier) != null) {
var type = currentFields.get(toCheck.identifier); var type = currentFields.get(toCheck.identifier);
toCheck.setTypeNode(type); toCheck.setTypeNode(type);
MemberAccessNode memberAccessNode = new MemberAccessNode(false);
memberAccessNode.identifiers.add(currentClass.identifier);
toCheck.memberAccess = memberAccessNode;
return new TypeCheckResult(true, type); return new TypeCheckResult(true, type);
} else if (currentScope.getLocalVar(toCheck.identifier) != null) { } else if (currentScope.getLocalVar(toCheck.identifier) != null) {
var type = currentScope.getLocalVar(toCheck.identifier); 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 { public class AllFeaturesClassExample {
int x; int x;
public boolean test(boolean x){ public void test(){
return x; x = 1;
} }
} }