Compare commits

...

2 Commits

Author SHA1 Message Date
Bruder John
9b8155ebab added class identifier to member acces node
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-04 16:31:45 +02:00
Bruder John
2e3a7850a4 Fix Double Name 2024-07-04 16:29:42 +02:00
2 changed files with 15 additions and 11 deletions

View File

@ -614,7 +614,7 @@ public class SemanticAnalyzer implements SemanticVisitor {
start++; start++;
} }
} }
if(context.getClasses().get(memberAccessNode.identifiers.getFirst()) != null){ if(context.getClasses().get(memberAccessNode.identifiers.getFirst()) == null){
memberAccessNode.identifiers.addFirst(currentClass.identifier); memberAccessNode.identifiers.addFirst(currentClass.identifier);
start++; start++;
} }
@ -635,7 +635,8 @@ public class SemanticAnalyzer implements SemanticVisitor {
} else { } else {
if (currentType instanceof ReferenceType reference) { if (currentType instanceof ReferenceType reference) {
var currentTypeClass = context.getClass(reference.getIdentifier()); var currentTypeClass = context.getClass(reference.getIdentifier());
memberAccessNode.identifiers.add(i, reference.getIdentifier());
i++;
var currentField = currentTypeClass.getField(s); var currentField = currentTypeClass.getField(s);
if (currentField.getAccessModifier().accessType == EnumAccessModifierNode.PUBLIC) { if (currentField.getAccessModifier().accessType == EnumAccessModifierNode.PUBLIC) {
currentType = currentField.getType(); currentType = currentField.getType();

View File

@ -1,13 +1,16 @@
public class Klasse1 { public class Compiler {
public int test; Node node;
public int add(int i, int j) {
public int test1() { node = new Node();
test = 5; node.x = 1;
return 1; return i+j;
} }
}
public void test2() {
int testInt; public class Node {
testInt = this.test1(); public int x;
public void main() {
Compiler compiler = new Compiler();
int i = compiler.add(5, 8);
} }
} }