From 0aab2d9f53be29bb693edf9a0d433a630918b8a7 Mon Sep 17 00:00:00 2001 From: "pl@gohorb.ba-horb.de" Date: Fri, 4 Jun 2021 00:52:50 +0200 Subject: [PATCH] modified: ../../../../main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator/StatementGenerator.java this wird nicht als Field betrachtet new file: ../../javFiles/packageTest/Pair2.jav new file: ../../javFiles/packageTest/de/test/Pair.jav --- .../SyntaxTreeGenerator/StatementGenerator.java | 4 +++- src/test/resources/javFiles/packageTest/Pair2.jav | 14 ++++++++++++++ .../javFiles/packageTest/de/test/Pair.jav | 12 ++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 src/test/resources/javFiles/packageTest/Pair2.jav create mode 100644 src/test/resources/javFiles/packageTest/de/test/Pair.jav diff --git a/src/main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator/StatementGenerator.java b/src/main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator/StatementGenerator.java index 90ba659c..2b3c99fd 100644 --- a/src/main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator/StatementGenerator.java +++ b/src/main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator/StatementGenerator.java @@ -272,8 +272,10 @@ public class StatementGenerator { whole+="."; } - if(parts.length < 2){ + if(parts.length < 2 || parts[0].contentEquals("this") ){ receiver = new This(offset); + } else if (parts[0].contentEquals("super")) { + receiver = new Super(offset); }else if(receiver == null){ //Handelt es sich um keinen Statischen Klassennamen: String part = expression.substring(0,expression.length() - (1 + parts[parts.length-1].length())); receiver = generateLocalOrFieldVarOrClassName(part, offset); diff --git a/src/test/resources/javFiles/packageTest/Pair2.jav b/src/test/resources/javFiles/packageTest/Pair2.jav new file mode 100644 index 00000000..d62474ea --- /dev/null +++ b/src/test/resources/javFiles/packageTest/Pair2.jav @@ -0,0 +1,14 @@ +import de.test.Pair; + +class Pairs { + setfst(fst) { + return new Pair<>(snd, fst); + } + + swap () { + return new Pair<> (snd, fst); } + + polyrec(p) { + return polyrec (p.swap()); + } +} \ No newline at end of file diff --git a/src/test/resources/javFiles/packageTest/de/test/Pair.jav b/src/test/resources/javFiles/packageTest/de/test/Pair.jav new file mode 100644 index 00000000..dbde6636 --- /dev/null +++ b/src/test/resources/javFiles/packageTest/de/test/Pair.jav @@ -0,0 +1,12 @@ +package de.test; + +class Pair { + fst; + snd; + + Pair(fst, snd) { + this.fst = fst; + this.snd = snd; + } +} +