Merge remote-tracking branch 'origin/Endabgabe' into Endabgabe
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
This commit is contained in:
commit
ea97f34398
@ -253,6 +253,7 @@ public class SemanticAnalyzer implements SemanticVisitor {
|
|||||||
|
|
||||||
if (toCheck.memberAccess != null) {
|
if (toCheck.memberAccess != null) {
|
||||||
var result = toCheck.memberAccess.accept(this);
|
var result = toCheck.memberAccess.accept(this);
|
||||||
|
toCheck.identifier = toCheck.memberAccess.identifiers.getLast();
|
||||||
toCheck.setTypeNode(result.getType());
|
toCheck.setTypeNode(result.getType());
|
||||||
return result;
|
return result;
|
||||||
} else {
|
} else {
|
||||||
@ -608,11 +609,15 @@ public class SemanticAnalyzer implements SemanticVisitor {
|
|||||||
ITypeNode currentType = null;
|
ITypeNode currentType = null;
|
||||||
int start = 0;
|
int start = 0;
|
||||||
if(!memberAccessNode.identifiers.isEmpty()){
|
if(!memberAccessNode.identifiers.isEmpty()){
|
||||||
if(currentFields.get(memberAccessNode.identifiers.get(0)) != null){
|
if(currentFields.get(memberAccessNode.identifiers.getFirst()) != null){
|
||||||
memberAccessNode.identifiers.add(0, currentClass.identifier);
|
memberAccessNode.identifiers.addFirst(currentClass.identifier);
|
||||||
start = 1;
|
start++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(context.getClasses().get(memberAccessNode.identifiers.getFirst()) == null){
|
||||||
|
memberAccessNode.identifiers.addFirst(currentClass.identifier);
|
||||||
|
start++;
|
||||||
|
}
|
||||||
for (int i = start; i < memberAccessNode.identifiers.size(); i++) {
|
for (int i = start; i < memberAccessNode.identifiers.size(); i++) {
|
||||||
|
|
||||||
String s = memberAccessNode.identifiers.get(i);
|
String s = memberAccessNode.identifiers.get(i);
|
||||||
@ -630,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();
|
||||||
|
@ -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() {
|
public class Node {
|
||||||
int testInt;
|
public int x;
|
||||||
testInt = this.test1();
|
public void main() {
|
||||||
|
Compiler compiler = new Compiler();
|
||||||
|
int i = compiler.add(5, 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user