From 05e4968adb716e0b80db101e9766ea1831339669 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Pl=C3=BCmicke?= Date: Fri, 30 Jun 2017 13:04:56 +0200 Subject: [PATCH] new bransch --- src/de/dhbwstuttgart/parser/JavaTXParser.java | 6 +++++- src/de/dhbwstuttgart/syntaxtree/statement/Expression.java | 2 ++ test/javFiles/Faculty.jav | 6 +++++- test/typeinference/JavaTXCompilerTest.java | 3 ++- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/de/dhbwstuttgart/parser/JavaTXParser.java b/src/de/dhbwstuttgart/parser/JavaTXParser.java index 8d320ecb..9e486ba8 100644 --- a/src/de/dhbwstuttgart/parser/JavaTXParser.java +++ b/src/de/dhbwstuttgart/parser/JavaTXParser.java @@ -33,7 +33,11 @@ public class JavaTXParser { } //TODO: Wieso muss man das händisch anhängen? ret.add("java.lang.Object"); - + ret.add("java.lang.Long"); + ret.add("java.lang.Integer"); + ret.add("java.lang.Boolean"); + ret.add("java.lang.String"); + ret.add("java.lang.Class"); return ret; } } diff --git a/src/de/dhbwstuttgart/syntaxtree/statement/Expression.java b/src/de/dhbwstuttgart/syntaxtree/statement/Expression.java index 07db361e..9a59db84 100755 --- a/src/de/dhbwstuttgart/syntaxtree/statement/Expression.java +++ b/src/de/dhbwstuttgart/syntaxtree/statement/Expression.java @@ -23,4 +23,6 @@ public abstract class Expression extends SyntaxTreeNode } public abstract void accept(StatementVisitor visitor); + + public String toString() { return this.getClass().getName() + ":" + type.toString(); } } diff --git a/test/javFiles/Faculty.jav b/test/javFiles/Faculty.jav index 0889314a..45988212 100644 --- a/test/javFiles/Faculty.jav +++ b/test/javFiles/Faculty.jav @@ -1,8 +1,12 @@ class Faculty { + Integer mul(Integer x, Integer y) { + return x; + } + m () { auto fact = (Integer x) -> { - return fact.apply(x); + return mul(x, fact.apply(x)); }; return fact; } diff --git a/test/typeinference/JavaTXCompilerTest.java b/test/typeinference/JavaTXCompilerTest.java index f62dd5b5..f1af81cd 100644 --- a/test/typeinference/JavaTXCompilerTest.java +++ b/test/typeinference/JavaTXCompilerTest.java @@ -26,7 +26,8 @@ public class JavaTXCompilerTest { @Test public void test() throws IOException, ClassNotFoundException { - filesToTest.add(new File(rootDirectory+"mathStruc.jav")); + filesToTest.add(new File(rootDirectory+"Faculty.jav")); + //filesToTest.add(new File(rootDirectory+"mathStruc.jav")); //filesToTest.add(new File(rootDirectory+"Lambda.jav")); //filesToTest.add(new File(rootDirectory+"Lambda2.jav")); //filesToTest.add(new File(rootDirectory+"Lambda3.jav"));