Fixed Tests. Doppelte TypeAssumptions beseitigt

This commit is contained in:
JanUlrich 2014-04-14 18:05:24 +02:00
parent 61e9c953c9
commit f0ef3017b9
25 changed files with 331 additions and 177 deletions

View File

@ -1330,7 +1330,6 @@ primitivetype :BOOLEAN
$$=$1;
}
referencetype :classorinterfacetype
{
org.apache.log4j.Logger.getLogger("parser").debug("T->Parser->referenctype: " + $1);

View File

@ -42,6 +42,7 @@ import org.apache.log4j.xml.DOMConfigurator;
import com.sun.corba.se.spi.orbutil.fsm.Guard.Result;
import com.sun.org.apache.xerces.internal.impl.xs.identity.Field;
import typinferenz.FunNInterface;
import typinferenz.ResultSet;
// ino.end
import typinferenz.assumptions.TypeAssumptions;
@ -521,7 +522,7 @@ public class MyCompiler implements MyCompilerAPI
inferencelog.info("# TypeReconstruction-Algorithmus - START #");
inferencelog.info("##########################################\n");
TypeAssumptions globalAssumptions = m_AbstractSyntaxTree.elementAt(0).makeBasicAssumptions();
TypeAssumptions globalAssumptions = makeFunNAssumptions();
Vector<TypeinferenceResultSet> result = new Vector<TypeinferenceResultSet>();
for(SourceFile srcFile : m_AbstractSyntaxTree){
result.addAll(srcFile.typeReconstruction(globalAssumptions));
@ -536,7 +537,24 @@ public class MyCompiler implements MyCompilerAPI
}
// ino.end
/**
* Erstellt die FunN-Assumptions
* Fun0-FunN (momentan für N = 6)
* @return
*/
private TypeAssumptions makeFunNAssumptions(){
TypeAssumptions ret = new TypeAssumptions();
//Basic Assumptions für die FunN Interfaces:
//TODO: Hier mehr als Fun1-Fun5 implementieren
for(int i = 0; i<6; i++){
FunNInterface funN = new FunNInterface(i);
ret.add(funN.getPublicFieldAssumptions());
}
return ret;
}
/**
* Author: J<EFBFBD>rg B<EFBFBD>uerle<br/>

View File

@ -1281,7 +1281,7 @@ public class SourceFile
*/
// ino.end
// ino.method.makeBasicAssumptions.21418.definition
public TypeAssumptions makeBasicAssumptions()
private TypeAssumptions makeBasicAssumptions()
// ino.end
// ino.method.makeBasicAssumptions.21418.body
{

View File

@ -844,7 +844,7 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface
//assumptions.setThisV(thisAssumption);
for(Field field : this.getFields()){
assumptions.add(field.createTypeAssumptions(this));
if(!field.isPublic())assumptions.add(field.createTypeAssumptions(this));
}
//Eine Assumption für den Standardkonstruktor:
@ -1267,10 +1267,10 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface
* @return
*/
public TypeAssumptions getPublicFieldAssumptions() {
TypeAssumptions ret = this.getPrivateFieldAssumptions();
TypeAssumptions ret = new TypeAssumptions();//this.getPrivateFieldAssumptions();
ret.addClassAssumption(new ClassAssumption(this));
for(Field f : this.getFields()){
ret.add(f.createTypeAssumptions(this));
if(f.isPublic())ret.add(f.createTypeAssumptions(this));
}
return ret;
}
@ -1314,6 +1314,7 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface
this.addField(standardKonstruktor);
}
//TODO: Umwandlung zu RefTypes funktioniert noch nicht richtig. (siehe LambdaTest2)
//Als RefType geparste Generische Variablen umwandeln:
this.wandleRefTypeAttributes2GenericAttributes();
}

View File

@ -27,6 +27,7 @@ public class ClassHelper
*/
// ino.end
// ino.method.findGenericType.23209.definition
@Deprecated
public static GenericTypeVar findGenericType(Type type, Vector<Type> paralist, Vector<GenericTypeVar> methodParaList)
// ino.end
// ino.method.findGenericType.23209.body

View File

@ -6,6 +6,7 @@ import mycompiler.SyntaxTreeNode;
import mycompiler.mybytecode.ClassFile;
import mycompiler.myexception.JVMCodeException;
import mycompiler.mytype.GenericTypeVar;
import mycompiler.mytype.RefType;
import mycompiler.mytype.Type;
import mycompiler.mytype.TypePlaceholder;
import mycompiler.mytypereconstruction.replacementlistener.CReplaceTypeEvent;
@ -114,9 +115,15 @@ public abstract class Field extends SyntaxTreeNode implements TypeInsertable, Ty
public void wandleRefTypeAttributes2GenericAttributes(Vector<Type> paralist){
// Zuerst Returntype untersuchen
Type type=getType();
GenericTypeVar pendantReturnType=ClassHelper.findGenericType(type, paralist,new Vector<GenericTypeVar>());
Type pendantReturnType = null;
if(type instanceof RefType)pendantReturnType = ((RefType)type).findGenericType(paralist, new Vector<GenericTypeVar>());//GenericTypeVar pendantReturnType=ClassHelper.findGenericType(type, paralist,new Vector<GenericTypeVar>());
if(pendantReturnType!=null){ //Wenn generisch, dann modifizieren
setType(pendantReturnType);
}
}
public boolean isPublic() {
//TODO: momentan ist jedes Feld public!
return true;
}
}

View File

@ -503,7 +503,9 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable
{
// Zuerst Returntype untersuchen
Type returnType=getType();
GenericTypeVar pendantReturnType=ClassHelper.findGenericType(returnType, paralist,genericMethodParameters);
Type pendantReturnType = null;
if(returnType instanceof RefType)pendantReturnType = ((RefType)returnType).findGenericType(paralist, new Vector<GenericTypeVar>());
//GenericTypeVar pendantReturnType=ClassHelper.findGenericType(returnType, paralist,genericMethodParameters);
if(pendantReturnType!=null){ //Wenn generisch, dann modifizieren
setReturnType(pendantReturnType);
}
@ -513,7 +515,9 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable
FormalParameter fp=parameterlist.formalparameter.get(par);
Type fpType=fp.getType();
// Nur wenn es sich um ein RefType-Field handelt
GenericTypeVar pendantPara=ClassHelper.findGenericType(fpType,paralist,genericMethodParameters);
Type pendantPara = null;
if(fpType instanceof RefType)pendantPara = ((RefType)fpType).findGenericType(paralist, new Vector<GenericTypeVar>());
//GenericTypeVar pendantPara=ClassHelper.findGenericType(fpType,paralist,genericMethodParameters);
if(pendantPara!=null){ //Wenn generisch, dann modifizieren
fp.setType(pendantPara);
}
@ -537,7 +541,9 @@ public class Method extends Field implements IItemWithOffset, TypeInsertable
public ConstraintsSet TYPE(TypeAssumptions ass) {
if((this.returntype instanceof RefType))this.returntype = ass.getTypeFor((RefType)this.returntype);
if((this.returntype instanceof RefType) &&
!(this.returntype instanceof mycompiler.mytype.Void))//Sonderfall der Methode: Ihr Typ darf Void definiert werden.
this.returntype = ass.getTypeFor((RefType)this.returntype);
ConstraintsSet ret = new ConstraintsSet();
TypeAssumptions localAss = new TypeAssumptions();
localAss.add(ass); //Die globalen Assumptions anhängen

View File

@ -1972,7 +1972,7 @@ case 150:
}
break;
case 151:
// line 1335 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1334 "./../src/mycompiler/myparser/JavaParser.jay"
{
org.apache.log4j.Logger.getLogger("parser").debug("T->Parser->referenctype: " + ((UsedId)yyVals[0+yyTop]));
RefType RT = new RefType(((UsedId)yyVals[0+yyTop]).getOffset());
@ -1992,25 +1992,25 @@ case 151:
}
break;
case 152:
// line 1355 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1354 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((DeclId)yyVals[0+yyTop]);
}
break;
case 153:
// line 1376 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1375 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((LocalVarDecl)yyVals[0+yyTop]);
}
break;
case 154:
// line 1380 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1379 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((Statement)yyVals[0+yyTop]);
}
break;
case 155:
// line 1385 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1384 "./../src/mycompiler/myparser/JavaParser.jay"
{
FormalParameter FP = new FormalParameter(((DeclId)yyVals[0+yyTop]));
FP.setType(((Type)yyVals[-1+yyTop]));
@ -2019,7 +2019,7 @@ case 155:
}
break;
case 156:
// line 1410 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1409 "./../src/mycompiler/myparser/JavaParser.jay"
{
org.apache.log4j.Logger.getLogger("parser").debug("\nFunktionsdeklaration mit typlosen Parametern: " + ((DeclId)yyVals[0+yyTop]).name);
@ -2039,7 +2039,7 @@ case 156:
}
break;
case 157:
// line 1429 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1428 "./../src/mycompiler/myparser/JavaParser.jay"
{
ArgumentList AL = new ArgumentList();
AL.expr.addElement(((Expr)yyVals[0+yyTop]));
@ -2047,20 +2047,20 @@ case 157:
}
break;
case 158:
// line 1435 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1434 "./../src/mycompiler/myparser/JavaParser.jay"
{
((ArgumentList)yyVals[-2+yyTop]).expr.addElement(((Expr)yyVals[0+yyTop]));
yyVal=((ArgumentList)yyVals[-2+yyTop]);
}
break;
case 159:
// line 1441 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1440 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((BaseType)yyVals[0+yyTop]);
}
break;
case 160:
// line 1446 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1445 "./../src/mycompiler/myparser/JavaParser.jay"
{
DeclId DI = new DeclId();
/* #JB# 10.04.2005 */
@ -2073,61 +2073,61 @@ case 160:
}
break;
case 161:
// line 1458 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1457 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((Expr)yyVals[0+yyTop]);
}
break;
case 162:
// line 1463 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1462 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((LocalVarDecl)yyVals[-1+yyTop]);
}
break;
case 163:
// line 1468 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1467 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((Statement)yyVals[0+yyTop]);
}
break;
case 164:
// line 1472 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1471 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((IfStmt)yyVals[0+yyTop]);
}
break;
case 165:
// line 1476 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1475 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((IfStmt)yyVals[0+yyTop]);
}
break;
case 166:
// line 1480 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1479 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((WhileStmt)yyVals[0+yyTop]);
}
break;
case 167:
// line 1484 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1483 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((ForStmt)yyVals[0+yyTop]);
}
break;
case 168:
// line 1489 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1488 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((Expr)yyVals[0+yyTop]);
}
break;
case 169:
// line 1493 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1492 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((NewClass)yyVals[0+yyTop]);
}
break;
case 170:
// line 1498 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1497 "./../src/mycompiler/myparser/JavaParser.jay"
{
IntegerType IT = new IntegerType();
/* #JB# 05.04.2005 */
@ -2138,7 +2138,7 @@ case 170:
}
break;
case 171:
// line 1507 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1506 "./../src/mycompiler/myparser/JavaParser.jay"
{
CharacterType CT = new CharacterType();
/* #JB# 05.04.2005 */
@ -2149,7 +2149,7 @@ case 171:
}
break;
case 172:
// line 1517 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1516 "./../src/mycompiler/myparser/JavaParser.jay"
{
org.apache.log4j.Logger.getLogger("parser").debug("P -> Lokale Variable angelegt!");
LocalVarDecl LVD = new LocalVarDecl(((Type)yyVals[-1+yyTop]).getOffset(),((Type)yyVals[-1+yyTop]).getVariableLength());
@ -2159,7 +2159,7 @@ case 172:
}
break;
case 173:
// line 1528 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1527 "./../src/mycompiler/myparser/JavaParser.jay"
{
org.apache.log4j.Logger.getLogger("parser").debug("P -> Lokale Variable angelegt!");
LocalVarDecl LVD = new LocalVarDecl(((FieldDeclaration)yyVals[0+yyTop]).getOffset(),((FieldDeclaration)yyVals[0+yyTop]).getVariableLength());
@ -2169,31 +2169,31 @@ case 173:
}
break;
case 174:
// line 1538 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1537 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((Block)yyVals[0+yyTop]);
}
break;
case 175:
// line 1542 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1541 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((EmptyStmt)yyVals[0+yyTop]);
}
break;
case 176:
// line 1546 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1545 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((ExprStmt)yyVals[0+yyTop]);
}
break;
case 177:
// line 1550 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1549 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((Return)yyVals[0+yyTop]);
}
break;
case 178:
// line 1555 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1554 "./../src/mycompiler/myparser/JavaParser.jay"
{
IfStmt Ifst = new IfStmt(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength());
Ifst.set_Expr(((Expr)yyVals[-2+yyTop]));
@ -2202,7 +2202,7 @@ case 178:
}
break;
case 179:
// line 1563 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1562 "./../src/mycompiler/myparser/JavaParser.jay"
{
IfStmt IfstElst = new IfStmt(((Expr)yyVals[-4+yyTop]).getOffset(),((Expr)yyVals[-4+yyTop]).getVariableLength());
IfstElst.set_Expr(((Expr)yyVals[-4+yyTop]));
@ -2212,7 +2212,7 @@ case 179:
}
break;
case 180:
// line 1572 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1571 "./../src/mycompiler/myparser/JavaParser.jay"
{
WhileStmt Whlst = new WhileStmt(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength());
Whlst.set_Expr(((Expr)yyVals[-2+yyTop]));
@ -2221,7 +2221,7 @@ case 180:
}
break;
case 181:
// line 1583 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1582 "./../src/mycompiler/myparser/JavaParser.jay"
{
ForStmt Fst = new ForStmt(((Expr)yyVals[-6+yyTop]).getOffset(),((Expr)yyVals[-6+yyTop]).getVariableLength());
Fst.set_head_Initializer(((Expr)yyVals[-6+yyTop]));
@ -2234,7 +2234,7 @@ case 181:
}
break;
case 182:
// line 1595 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1594 "./../src/mycompiler/myparser/JavaParser.jay"
{
ForStmt Fst = new ForStmt(((Expr)yyVals[-5+yyTop]).getOffset(),((Expr)yyVals[-5+yyTop]).getVariableLength());
Fst.set_head_Initializer(((Expr)yyVals[-5+yyTop]));
@ -2246,7 +2246,7 @@ case 182:
}
break;
case 183:
// line 1606 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1605 "./../src/mycompiler/myparser/JavaParser.jay"
{
ForStmt Fst = new ForStmt(((Expr)yyVals[-5+yyTop]).getOffset(),((Expr)yyVals[-5+yyTop]).getVariableLength());
Fst.set_head_Initializer(((Expr)yyVals[-5+yyTop]));
@ -2258,7 +2258,7 @@ case 183:
}
break;
case 184:
// line 1617 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1616 "./../src/mycompiler/myparser/JavaParser.jay"
{
ForStmt Fst = new ForStmt(((Expr)yyVals[-4+yyTop]).getOffset(),((Expr)yyVals[-4+yyTop]).getVariableLength());
Fst.set_head_Condition(((Expr)yyVals[-4+yyTop]));
@ -2270,7 +2270,7 @@ case 184:
}
break;
case 185:
// line 1628 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1627 "./../src/mycompiler/myparser/JavaParser.jay"
{
ForStmt Fst = new ForStmt(((Expr)yyVals[-4+yyTop]).getOffset(),((Expr)yyVals[-4+yyTop]).getVariableLength());
Fst.set_head_Initializer(((Expr)yyVals[-4+yyTop]));
@ -2281,7 +2281,7 @@ case 185:
}
break;
case 186:
// line 1638 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1637 "./../src/mycompiler/myparser/JavaParser.jay"
{
ForStmt Fst = new ForStmt(((Expr)yyVals[-3+yyTop]).getOffset(),((Expr)yyVals[-3+yyTop]).getVariableLength());
Fst.set_head_Condition(((Expr)yyVals[-3+yyTop]));
@ -2292,7 +2292,7 @@ case 186:
}
break;
case 187:
// line 1648 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1647 "./../src/mycompiler/myparser/JavaParser.jay"
{
ForStmt Fst = new ForStmt(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength());
Fst.set_head_Loop_expr(((Expr)yyVals[-2+yyTop]));
@ -2303,7 +2303,7 @@ case 187:
}
break;
case 188:
// line 1658 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1657 "./../src/mycompiler/myparser/JavaParser.jay"
{
ForStmt Fst = new ForStmt(((Statement)yyVals[0+yyTop]).getOffset(),((Statement)yyVals[0+yyTop]).getVariableLength());
Fst.set_body_Loop_block(((Statement)yyVals[0+yyTop]));
@ -2313,40 +2313,40 @@ case 188:
}
break;
case 189:
// line 1667 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1666 "./../src/mycompiler/myparser/JavaParser.jay"
{
org.apache.log4j.Logger.getLogger("parser").debug("conditionalexpression");
yyVal=((Expr)yyVals[0+yyTop]);
}
break;
case 190:
// line 1672 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1671 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((Assign)yyVals[0+yyTop]);
}
break;
case 191:
// line 1678 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1677 "./../src/mycompiler/myparser/JavaParser.jay"
{
EmptyStmt Empst = new EmptyStmt();
yyVal=Empst;
}
break;
case 192:
// line 1684 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1683 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((Expr)yyVals[-1+yyTop]);
}
break;
case 193:
// line 1689 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1688 "./../src/mycompiler/myparser/JavaParser.jay"
{
Return ret = new Return(-1,-1);
yyVal= ret;
}
break;
case 194:
// line 1694 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1693 "./../src/mycompiler/myparser/JavaParser.jay"
{
Return retexp = new Return(((Expr)yyVals[-1+yyTop]).getOffset(),((Expr)yyVals[-1+yyTop]).getVariableLength());
retexp.set_ReturnExpr(((Expr)yyVals[-1+yyTop]));
@ -2354,31 +2354,31 @@ case 194:
}
break;
case 195:
// line 1701 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1700 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((Statement)yyVals[0+yyTop]);
}
break;
case 196:
// line 1705 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1704 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((IfStmt)yyVals[0+yyTop]);
}
break;
case 197:
// line 1709 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1708 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((WhileStmt)yyVals[0+yyTop]);
}
break;
case 198:
// line 1714 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1713 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((Expr)yyVals[0+yyTop]);
}
break;
case 199:
// line 1720 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1719 "./../src/mycompiler/myparser/JavaParser.jay"
{
org.apache.log4j.Logger.getLogger("parser").debug("\nParser --> Zuweisung1!\n");
Assign Ass = new Assign(((UsedId)yyVals[-2+yyTop]).getOffset(),((UsedId)yyVals[-2+yyTop]).getVariableLength());
@ -2405,7 +2405,7 @@ case 199:
}
break;
case 200:
// line 1745 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1744 "./../src/mycompiler/myparser/JavaParser.jay"
{
Assign Ass =new Assign(((UsedId)yyVals[-2+yyTop]).getOffset(),((UsedId)yyVals[-2+yyTop]).getVariableLength());
LocalOrFieldVar LOFV = new LocalOrFieldVar(((UsedId)yyVals[-2+yyTop]).getOffset(),((UsedId)yyVals[-2+yyTop]).getVariableLength());
@ -2429,43 +2429,43 @@ case 200:
}
break;
case 201:
// line 1768 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1767 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((Assign)yyVals[0+yyTop]);
}
break;
case 202:
// line 1772 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1771 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((Expr)yyVals[0+yyTop]);
}
break;
case 203:
// line 1776 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1775 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((Expr)yyVals[0+yyTop]);
}
break;
case 204:
// line 1780 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1779 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((Expr)yyVals[0+yyTop]);
}
break;
case 205:
// line 1784 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1783 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((Expr)yyVals[0+yyTop]);
}
break;
case 206:
// line 1788 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1787 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((MethodCall)yyVals[0+yyTop]);
}
break;
case 207:
// line 1799 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1798 "./../src/mycompiler/myparser/JavaParser.jay"
{
IfStmt IfElno = new IfStmt(((Expr)yyVals[-4+yyTop]).getOffset(),((Expr)yyVals[-4+yyTop]).getVariableLength());
IfElno.set_Expr(((Expr)yyVals[-4+yyTop]));
@ -2475,7 +2475,7 @@ case 207:
}
break;
case 208:
// line 1808 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1807 "./../src/mycompiler/myparser/JavaParser.jay"
{
WhileStmt Whstno = new WhileStmt(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength());
Whstno.set_Expr(((Expr)yyVals[-2+yyTop]));
@ -2484,13 +2484,13 @@ case 208:
}
break;
case 209:
// line 1816 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1815 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((Expr)yyVals[0+yyTop]);
}
break;
case 210:
// line 1820 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1819 "./../src/mycompiler/myparser/JavaParser.jay"
{
Binary LogOr = new Binary(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength());
OrOp OrO = new OrOp(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength());
@ -2502,19 +2502,19 @@ case 210:
}
break;
case 211:
// line 1833 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1832 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=null;
}
break;
case 212:
// line 1838 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1837 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((Block)yyVals[0+yyTop]);
}
break;
case 213:
// line 1842 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1841 "./../src/mycompiler/myparser/JavaParser.jay"
{
/*Lambdabody kann auch nur aus einer Expression bestehen. In diesem Fall wird ein Block erstellt, welcher als einziges Statement ein return statment mit der expression hat.*/
/*Bsp.: Aus der Expression |var=="hallo"| wird: |{return var=="hallo";}|*/
@ -2525,19 +2525,19 @@ case 213:
}
break;
case 214:
// line 1852 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1851 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=null;
}
break;
case 215:
// line 1856 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1855 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((ParameterList)yyVals[-1+yyTop]);
}
break;
case 216:
// line 1861 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1860 "./../src/mycompiler/myparser/JavaParser.jay"
{
LambdaExpression lambda = new LambdaExpression(/*((ParameSterList)$2).getOffset(),((ParameterList)$2).getVariableLength()*/0,0);
if(((ParameterList)yyVals[-2+yyTop])!=null)lambda.setParameterList(((ParameterList)yyVals[-2+yyTop]));
@ -2546,54 +2546,54 @@ case 216:
}
break;
case 217:
// line 1880 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1879 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((UsedId)yyVals[0+yyTop]);
}
break;
case 218:
// line 1885 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1884 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=null;
}
break;
case 219:
// line 1889 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1888 "./../src/mycompiler/myparser/JavaParser.jay"
{
TimesOp TEO = new TimesOp(-1,-1);
yyVal=TEO;
}
break;
case 220:
// line 1894 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1893 "./../src/mycompiler/myparser/JavaParser.jay"
{
DivideOp DEO = new DivideOp(-1,-1);
yyVal=DEO;
}
break;
case 221:
// line 1899 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1898 "./../src/mycompiler/myparser/JavaParser.jay"
{
ModuloOp MEO = new ModuloOp(-1,-1);
yyVal=MEO;
}
break;
case 222:
// line 1904 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1903 "./../src/mycompiler/myparser/JavaParser.jay"
{
PlusOp PEO = new PlusOp(-1,-1);
yyVal=PEO;
}
break;
case 223:
// line 1909 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1908 "./../src/mycompiler/myparser/JavaParser.jay"
{
MinusOp MEO = new MinusOp(-1,-1);
yyVal=MEO;
}
break;
case 224:
// line 1921 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1920 "./../src/mycompiler/myparser/JavaParser.jay"
{
PreIncExpr PRINC = new PreIncExpr(((Expr)yyVals[0+yyTop]).getOffset(),((Expr)yyVals[0+yyTop]).getVariableLength());
PRINC.set_Expr(((Expr)yyVals[0+yyTop]));
@ -2601,7 +2601,7 @@ case 224:
}
break;
case 225:
// line 1928 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1927 "./../src/mycompiler/myparser/JavaParser.jay"
{
PreDecExpr PRDEC = new PreDecExpr(((Expr)yyVals[0+yyTop]).getOffset(),((Expr)yyVals[0+yyTop]).getVariableLength());
PRDEC.set_Expr(((Expr)yyVals[0+yyTop]));
@ -2609,7 +2609,7 @@ case 225:
}
break;
case 226:
// line 1935 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1934 "./../src/mycompiler/myparser/JavaParser.jay"
{
PostIncExpr PIE = new PostIncExpr(((Expr)yyVals[-1+yyTop]).getOffset(),((Expr)yyVals[-1+yyTop]).getVariableLength());
PIE.set_Expr(((Expr)yyVals[-1+yyTop]));
@ -2617,7 +2617,7 @@ case 226:
}
break;
case 227:
// line 1942 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1941 "./../src/mycompiler/myparser/JavaParser.jay"
{
PostDecExpr PDE = new PostDecExpr(((Expr)yyVals[-1+yyTop]).getOffset(),((Expr)yyVals[-1+yyTop]).getVariableLength());
PDE.set_Expr(((Expr)yyVals[-1+yyTop]));
@ -2625,7 +2625,7 @@ case 227:
}
break;
case 228:
// line 1950 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1949 "./../src/mycompiler/myparser/JavaParser.jay"
{
org.apache.log4j.Logger.getLogger("parser").debug("M1");
MethodCall MC = new MethodCall(((UsedId)yyVals[-2+yyTop]).getOffset(),((UsedId)yyVals[-2+yyTop]).getVariableLength());
@ -2657,7 +2657,7 @@ case 228:
}
break;
case 229:
// line 1980 "./../src/mycompiler/myparser/JavaParser.jay"
// line 1979 "./../src/mycompiler/myparser/JavaParser.jay"
{
org.apache.log4j.Logger.getLogger("parser").debug("M2");
MethodCall MCarg = new MethodCall(((UsedId)yyVals[-3+yyTop]).getOffset(),((UsedId)yyVals[-3+yyTop]).getVariableLength());
@ -2690,7 +2690,7 @@ case 229:
}
break;
case 230:
// line 2011 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2010 "./../src/mycompiler/myparser/JavaParser.jay"
{
org.apache.log4j.Logger.getLogger("parser").debug("M3");
MethodCall MCpr = new MethodCall(((Expr)yyVals[-4+yyTop]).getOffset(),((Expr)yyVals[-4+yyTop]).getVariableLength());
@ -2711,7 +2711,7 @@ case 230:
}
break;
case 231:
// line 2030 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2029 "./../src/mycompiler/myparser/JavaParser.jay"
{
org.apache.log4j.Logger.getLogger("parser").debug("M4");
MethodCall MCPA = new MethodCall(((Expr)yyVals[-5+yyTop]).getOffset(),((Expr)yyVals[-5+yyTop]).getVariableLength());
@ -2733,7 +2733,7 @@ case 231:
}
break;
case 232:
// line 2053 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2052 "./../src/mycompiler/myparser/JavaParser.jay"
{
NewClass NC = new NewClass(((UsedId)yyVals[-2+yyTop]).getOffset(),((UsedId)yyVals[-2+yyTop]).getVariableLength());
NC.set_UsedId(((UsedId)yyVals[-2+yyTop]));
@ -2743,7 +2743,7 @@ case 232:
}
break;
case 233:
// line 2061 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2060 "./../src/mycompiler/myparser/JavaParser.jay"
{
NewClass NCarg = new NewClass(((UsedId)yyVals[-3+yyTop]).getOffset(),((UsedId)yyVals[-3+yyTop]).getVariableLength());
NCarg.set_UsedId(((UsedId)yyVals[-3+yyTop]));
@ -2754,13 +2754,13 @@ case 233:
}
break;
case 234:
// line 2071 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2070 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((Expr)yyVals[0+yyTop]);
}
break;
case 235:
// line 2075 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2074 "./../src/mycompiler/myparser/JavaParser.jay"
{
Binary And = new Binary(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength());
AndOp AndO = new AndOp(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength());
@ -2772,19 +2772,19 @@ case 235:
}
break;
case 236:
// line 2091 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2090 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((Expr)yyVals[0+yyTop]);
}
break;
case 237:
// line 2095 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2094 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((Expr)yyVals[0+yyTop]);
}
break;
case 238:
// line 2099 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2098 "./../src/mycompiler/myparser/JavaParser.jay"
{
PositivExpr POSEX=new PositivExpr(((Expr)yyVals[0+yyTop]).getOffset(),((Expr)yyVals[0+yyTop]).getVariableLength());
UnaryPlus UP= new UnaryPlus();
@ -2794,7 +2794,7 @@ case 238:
}
break;
case 239:
// line 2107 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2106 "./../src/mycompiler/myparser/JavaParser.jay"
{
NegativeExpr NEGEX=new NegativeExpr(((Expr)yyVals[0+yyTop]).getOffset(),((Expr)yyVals[0+yyTop]).getVariableLength());
UnaryMinus UM=new UnaryMinus();
@ -2804,19 +2804,19 @@ case 239:
}
break;
case 240:
// line 2115 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2114 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((Expr)yyVals[0+yyTop]);
}
break;
case 241:
// line 2120 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2119 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((Expr)yyVals[0+yyTop]);
}
break;
case 242:
// line 2124 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2123 "./../src/mycompiler/myparser/JavaParser.jay"
{
if (((UsedId)yyVals[0+yyTop]).get_Name().size() > 1) {
@ -2836,37 +2836,37 @@ case 242:
}
break;
case 243:
// line 2142 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2141 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((Expr)yyVals[0+yyTop]);
}
break;
case 244:
// line 2146 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2145 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((Expr)yyVals[0+yyTop]);
}
break;
case 245:
// line 2151 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2150 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((Expr)yyVals[0+yyTop]);
}
break;
case 246:
// line 2156 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2155 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((Expr)yyVals[0+yyTop]);
}
break;
case 248:
// line 2162 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2161 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((Literal)yyVals[0+yyTop]);
}
break;
case 249:
// line 2166 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2165 "./../src/mycompiler/myparser/JavaParser.jay"
{
This T = new This(((Token)yyVals[0+yyTop]).getOffset(),((Token)yyVals[0+yyTop]).getLexem().length());
UsedId UT = new UsedId(((Token)yyVals[0+yyTop]).getOffset());
@ -2876,23 +2876,23 @@ case 249:
}
break;
case 250:
// line 2187 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2186 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((MethodCall)yyVals[0+yyTop]);
}
break;
case 251:
// line 2191 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2190 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((Expr)yyVals[0+yyTop]);
}
break;
case 252:
// line 2196 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2195 "./../src/mycompiler/myparser/JavaParser.jay"
{yyVal=((Expr)yyVals[0+yyTop]);}
break;
case 253:
// line 2198 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2197 "./../src/mycompiler/myparser/JavaParser.jay"
{NotExpr NE=new NotExpr(((Expr)yyVals[0+yyTop]).getOffset(),((Expr)yyVals[0+yyTop]).getVariableLength());
UnaryNot UN=new UnaryNot();
NE.set_UnaryNot(UN);
@ -2901,36 +2901,36 @@ case 253:
}
break;
case 254:
// line 2204 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2203 "./../src/mycompiler/myparser/JavaParser.jay"
{yyVal=((CastExpr)yyVals[0+yyTop]);}
break;
case 255:
// line 2206 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2205 "./../src/mycompiler/myparser/JavaParser.jay"
{yyVal=((Expr)yyVals[0+yyTop]);}
break;
case 257:
// line 2211 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2210 "./../src/mycompiler/myparser/JavaParser.jay"
{IntLiteral IL = new IntLiteral();
IL.set_Int(((Token)yyVals[0+yyTop]).String2Int());
yyVal = IL;
}
break;
case 258:
// line 2216 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2215 "./../src/mycompiler/myparser/JavaParser.jay"
{BoolLiteral BL = new BoolLiteral();
BL.set_Bool(((Token)yyVals[0+yyTop]).String2Bool());
yyVal = BL;
}
break;
case 259:
// line 2220 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2219 "./../src/mycompiler/myparser/JavaParser.jay"
{CharLiteral CL = new CharLiteral();
CL.set_Char(((Token)yyVals[0+yyTop]).CharInString());
yyVal=CL;
}
break;
case 260:
// line 2225 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2224 "./../src/mycompiler/myparser/JavaParser.jay"
{
StringLiteral ST = new StringLiteral();
ST.set_String(((Token)yyVals[0+yyTop]).get_String());
@ -2938,14 +2938,14 @@ case 260:
}
break;
case 261:
// line 2230 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2229 "./../src/mycompiler/myparser/JavaParser.jay"
{ LongLiteral LL = new LongLiteral();
LL.set_Long(((Token)yyVals[0+yyTop]).String2Long());
yyVal = LL;
}
break;
case 262:
// line 2234 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2233 "./../src/mycompiler/myparser/JavaParser.jay"
{
FloatLiteral FL = new FloatLiteral();
FL.set_Float(((Token)yyVals[0+yyTop]).String2Float());
@ -2953,7 +2953,7 @@ case 262:
}
break;
case 263:
// line 2239 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2238 "./../src/mycompiler/myparser/JavaParser.jay"
{
DoubleLiteral DL = new DoubleLiteral();
DL.set_Double(((Token)yyVals[0+yyTop]).String2Double());
@ -2961,14 +2961,14 @@ case 263:
}
break;
case 264:
// line 2245 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2244 "./../src/mycompiler/myparser/JavaParser.jay"
{
Null NN = new Null();
yyVal=NN;
}
break;
case 265:
// line 2251 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2250 "./../src/mycompiler/myparser/JavaParser.jay"
{
CastExpr CaEx=new CastExpr(((Expr)yyVals[0+yyTop]).getOffset(),((Expr)yyVals[0+yyTop]).getVariableLength());
CaEx.set_Type(((BaseType)yyVals[-2+yyTop]));
@ -2977,24 +2977,24 @@ case 265:
}
break;
case 266:
// line 2260 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2259 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((Expr)yyVals[0+yyTop]);
}
break;
case 267:
// line 2264 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2263 "./../src/mycompiler/myparser/JavaParser.jay"
{
}
break;
case 268:
// line 2268 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2267 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((Expr)yyVals[0+yyTop]);
}
break;
case 269:
// line 2272 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2271 "./../src/mycompiler/myparser/JavaParser.jay"
{
Binary EQ = new Binary(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength());
EqualOp EO = new EqualOp(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength());
@ -3006,7 +3006,7 @@ case 269:
}
break;
case 270:
// line 2282 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2281 "./../src/mycompiler/myparser/JavaParser.jay"
{
Binary NEQ = new Binary(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength());
NotEqualOp NEO = new NotEqualOp(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength());
@ -3018,13 +3018,13 @@ case 270:
}
break;
case 271:
// line 2293 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2292 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((Expr)yyVals[0+yyTop]);
}
break;
case 272:
// line 2297 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2296 "./../src/mycompiler/myparser/JavaParser.jay"
{
Binary LO = new Binary(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength());
LessOp LOO = new LessOp(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength());
@ -3036,7 +3036,7 @@ case 272:
}
break;
case 273:
// line 2307 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2306 "./../src/mycompiler/myparser/JavaParser.jay"
{
Binary GO = new Binary(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength());
GreaterOp GOO = new GreaterOp(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength());
@ -3048,7 +3048,7 @@ case 273:
}
break;
case 274:
// line 2317 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2316 "./../src/mycompiler/myparser/JavaParser.jay"
{
Binary LE = new Binary(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength());
LessEquOp LEO = new LessEquOp(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength());
@ -3060,7 +3060,7 @@ case 274:
}
break;
case 275:
// line 2327 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2326 "./../src/mycompiler/myparser/JavaParser.jay"
{
Binary GE = new Binary(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength());
GreaterEquOp GEO = new GreaterEquOp(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength());
@ -3072,7 +3072,7 @@ case 275:
}
break;
case 276:
// line 2337 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2336 "./../src/mycompiler/myparser/JavaParser.jay"
{
InstanceOf ISO=new InstanceOf(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength());
ISO.set_Expr(((Expr)yyVals[-2+yyTop]));
@ -3081,19 +3081,19 @@ case 276:
}
break;
case 277:
// line 2345 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2344 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((Expr)yyVals[0+yyTop]);
}
break;
case 278:
// line 2350 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2349 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((Expr)yyVals[0+yyTop]);
}
break;
case 279:
// line 2354 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2353 "./../src/mycompiler/myparser/JavaParser.jay"
{
Binary AD = new Binary(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength());
PlusOp PO = new PlusOp(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength());
@ -3105,7 +3105,7 @@ case 279:
}
break;
case 280:
// line 2364 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2363 "./../src/mycompiler/myparser/JavaParser.jay"
{
Binary MI = new Binary(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength());
MinusOp MO = new MinusOp(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength());
@ -3117,13 +3117,13 @@ case 280:
}
break;
case 281:
// line 2375 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2374 "./../src/mycompiler/myparser/JavaParser.jay"
{
yyVal=((Expr)yyVals[0+yyTop]);
}
break;
case 282:
// line 2379 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2378 "./../src/mycompiler/myparser/JavaParser.jay"
{
Binary ML = new Binary(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength());
TimesOp TO = new TimesOp(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength());
@ -3135,7 +3135,7 @@ case 282:
}
break;
case 283:
// line 2389 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2388 "./../src/mycompiler/myparser/JavaParser.jay"
{
Binary DV = new Binary(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength());
DivideOp DO = new DivideOp(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength());
@ -3147,7 +3147,7 @@ case 283:
}
break;
case 284:
// line 2399 "./../src/mycompiler/myparser/JavaParser.jay"
// line 2398 "./../src/mycompiler/myparser/JavaParser.jay"
{
Binary MD = new Binary(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength());
ModuloOp MO = new ModuloOp(((Expr)yyVals[-2+yyTop]).getOffset(),((Expr)yyVals[-2+yyTop]).getVariableLength());

View File

@ -1330,7 +1330,6 @@ primitivetype :BOOLEAN
$$=$1;
}
referencetype :classorinterfacetype
{
org.apache.log4j.Logger.getLogger("parser").debug("T->Parser->referenctype: " + $1);

View File

@ -26,6 +26,7 @@ import mycompiler.myexception.JVMCodeException;
import mycompiler.myexception.SCStatementException;
import mycompiler.mytype.DoubleType;
import mycompiler.mytype.GenericTypeVar;
import mycompiler.mytype.RefType;
import mycompiler.mytype.Type;
import mycompiler.mytype.TypePlaceholder;
import mycompiler.mytypereconstruction.CSupportData;
@ -85,7 +86,10 @@ public class LambdaExpression extends Expr{
Block block = this.method_body;
// Zuerst Returntype untersuchen
Type returnType=getType();
GenericTypeVar pendantReturnType=ClassHelper.findGenericType(returnType, paralist,genericMethodParameters);
Type pendantReturnType = null;
if(returnType instanceof RefType)
pendantReturnType = ((RefType)returnType).findGenericType(paralist, new Vector<GenericTypeVar>());
//GenericTypeVar pendantReturnType=ClassHelper.findGenericType(returnType, paralist,genericMethodParameters);
if(pendantReturnType!=null){ //Wenn generisch, dann modifizieren
setType(pendantReturnType);
}
@ -94,7 +98,10 @@ public class LambdaExpression extends Expr{
for(FormalParameter fp : params){
Type fpType=fp.getType();
// Nur wenn es sich um ein RefType-Field handelt
GenericTypeVar pendantPara=ClassHelper.findGenericType(fpType,paralist,genericMethodParameters);
Type pendantPara = null;
if(fpType instanceof RefType)
pendantPara = ((RefType)fpType).findGenericType(paralist, new Vector<GenericTypeVar>());
//GenericTypeVar pendantPara=ClassHelper.findGenericType(fpType,paralist,genericMethodParameters);
if(pendantPara!=null){ //Wenn generisch, dann modifizieren
fp.setType(pendantPara);
}

View File

@ -427,7 +427,10 @@ public class LocalVarDecl extends Statement implements TypeInsertable
Type fpType=getType();
// Nur wenn es sich um ein RefType-Field handelt
GenericTypeVar pendantPara=ClassHelper.findGenericType(fpType,paralist,genericMethodParameters);
Type pendantPara = null;
if(fpType instanceof RefType)
pendantPara = ((RefType)fpType).findGenericType(paralist, new Vector<GenericTypeVar>());
//GenericTypeVar pendantPara=ClassHelper.findGenericType(fpType,paralist,genericMethodParameters);
if(pendantPara!=null){ //Wenn generisch, dann modifizieren
setType(pendantPara);
}

View File

@ -18,6 +18,7 @@ import org.apache.log4j.Logger;
// ino.end
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
import typinferenz.JavaCodeResult;
import typinferenz.ResultSet;
@ -209,6 +210,41 @@ public class RefType extends Type implements IMatchable
this.set_ParaList(paralist);
}
/**
* HOTI
* Diese Methode sucht in der Klassendefinition nach einen GTV, die
* so heißt wie die im RefType definierte Variable. Wenn sie diese gefunden
* hat, wird sie zurückgeben. Wenn dies nicht der Fall war, schaut sie, falls
* angegeben in den Methodenparametern nach. Findet sie dort auch nichts, liefert
* die Methode <b>null</b>.
* @param type
* @return
*/
public GenericTypeVar findGenericType(Vector<Type> paralist, Vector<GenericTypeVar> methodParaList)
{
for(int i=0;i<paralist.size();i++){
if(paralist.get(i) instanceof GenericTypeVar){
GenericTypeVar gtv=(GenericTypeVar)paralist.get(i);
if(gtv.getName().equals(this.getName())){
return gtv;
}
}
}
if(methodParaList!=null){
for(int i=0;i<methodParaList.size();i++){
GenericTypeVar gtv=methodParaList.elementAt(i);
if(gtv.getName().equals(this.getName())){
return gtv;
}
}
}
//Auch die Parameterliste nach GenericTypeVars durchsuchen:
if(this.get_ParaList() != null)for(Type t : this.get_ParaList()){
if(t instanceof RefType)((RefType)t).findGenericType(paralist, methodParaList);
}
return(null);
}
// ino.method.setName.26655.definition
public void setName( String name )
// ino.end

View File

@ -2,6 +2,7 @@ package typinferenz;
import java.util.Vector;
import typinferenz.assumptions.ClassAssumption;
import typinferenz.assumptions.MethodAssumption;
import typinferenz.assumptions.TypeAssumptions;
import mycompiler.mytype.*;
@ -40,6 +41,7 @@ public class FunNInterface extends Class{
//return super.getPublicFieldAssumptions();
TypeAssumptions ret = new TypeAssumptions();
ret.addAssumption(new MethodAssumption(this.getApplyFunction(), this));
ret.addClassAssumption(new ClassAssumption(this));
return ret;
}

View File

@ -25,4 +25,11 @@ public class ClassAssumption{
public String toString(){
return this.classType.getName();
}
public boolean equals(Object obj){
if(!(obj instanceof ClassAssumption))return false;
ClassAssumption equals = (ClassAssumption)obj;
if(!equals.classType.equals(this.classType))return false;
return true;
}
}

View File

@ -10,5 +10,12 @@ public class ConstructorAssumption extends MethodAssumption{
super(assumedMethod, parentClass);
}
@Override
public boolean equals(Object obj) {
if(!(obj instanceof ConstructorAssumption))return false;
return super.equals(obj);
}
}

View File

@ -27,6 +27,15 @@ public class FieldAssumption extends Assumption {
public String toString(){
return "FieldAssumption: "+this.field.getType()+" "+this.getIdentifier();
}
@Override
public boolean equals(Object obj) {
if(!(obj instanceof FieldAssumption))return false;
FieldAssumption equals = (FieldAssumption)obj;
if(!equals.field.equals(this.field))return false;
if(!equals.parentClass.equals(this.parentClass))return false;
return true;
}
}

View File

@ -16,4 +16,5 @@ public class LocalVarAssumption extends Assumption {
public Type getAssumedType() {
return this.localVar.getType();
}
}

View File

@ -214,11 +214,18 @@ public class TypeAssumptions {
}
public void addAssumption(Assumption ass){
if(ass instanceof MethodAssumption)this.methodAssumptions.add((MethodAssumption)ass);//if(!this.methodAssumptions.contains(ass))this.methodAssumptions.add((MethodAssumption)ass);
if(ass instanceof FieldAssumption)this.fieldAssumptions.add((FieldAssumption)ass);//if(!this.fieldAssumptions.contains(ass))this.fieldAssumptions.add((FieldAssumption)ass);
if(ass instanceof LocalVarAssumption)this.localVarAssumptions.add((LocalVarAssumption)ass);//if(!this.localVarAssumptions.contains(ass))this.localVarAssumptions.add((LocalVarAssumption)ass);
if(ass instanceof ConstructorAssumption){
if(!this.constructorAssumptions.contains(ass))this.constructorAssumptions.add((ConstructorAssumption)ass);//this.constructorAssumptions.add((ConstructorAssumption)ass);
return;
}
if(ass instanceof MethodAssumption){
if(!this.methodAssumptions.contains(ass))this.methodAssumptions.add((MethodAssumption)ass);//this.methodAssumptions.add((MethodAssumption)ass);//
return;
}
if(ass instanceof LocalVarAssumption)if(!this.localVarAssumptions.contains(ass))this.localVarAssumptions.add((LocalVarAssumption)ass);//this.localVarAssumptions.add((LocalVarAssumption)ass);//
if(ass instanceof ParameterAssumption)if(!this.parameterAssumptions.contains(ass))this.parameterAssumptions.add((ParameterAssumption)ass);//this.parameterAssumptions.add((ParameterAssumption)ass);
if(ass instanceof ConstructorAssumption)if(!this.constructorAssumptions.contains(ass))this.constructorAssumptions.add((ConstructorAssumption)ass);//this.constructorAssumptions.add((ConstructorAssumption)ass);
if(ass instanceof FieldAssumption)if(!this.fieldAssumptions.contains(ass))this.fieldAssumptions.add((FieldAssumption)ass);//this.fieldAssumptions.add((FieldAssumption)ass);
}
private void addAllAssumptions(Vector<Assumption> assumptions){
@ -309,7 +316,8 @@ public class TypeAssumptions {
* @param classAssumption
*/
public void addClassAssumption(ClassAssumption classAssumption) {
this.classAssumptions.add(classAssumption);
if(!this.classAssumptions.contains(classAssumption))//throw new TypinferenzException("Die Klasse "+classAssumption.getAssumedClass().getName()+" wurde bereits deklariert");
this.classAssumptions.add(classAssumption);
}
/**

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
class VariableTypeInsertTest{
String var;
void methode(String test){
void methode(java.lang.String test){
var = test;
}
}

View File

@ -9,10 +9,10 @@ class FunNInsertTest{
var3 = c;
};
o2p = () -> (a, b, c) -> {
var1 = a;
var2 = b;
var3 = c;
};
}
}
class Object1{}
class Object2{}
class Object3{}

View File

@ -1,5 +1,5 @@
class LambdaTest{
class LambdaTest<R,S>{
Fun1<Fun1<K, Fun2<LambdaTest, C>>, C> op = (m) -> (f) -> f.apply(this,m);
Fun1<Fun1<R, Fun2<R, LambdaTest<R,S>, S>>, S> op = (m) -> (f) -> f.apply(this,m);
}

View File

@ -11,7 +11,7 @@ public class LambdaTest2 {
@Test
public void run(){
Vector<String> mustContain = new Vector<String>();
mustContain.add("C m");
mustContain.add("S m");
MultipleTypesInsertTester.test(this.TEST_FILE, mustContain);
}

View File

@ -0,0 +1,5 @@
class LambdaTest<A>{
Fun1<A, A> op = (var) -> {return var;};
}

View File

@ -0,0 +1,18 @@
package plugindevelopment.TypeInsertTests;
import java.util.Vector;
import org.junit.Test;
public class LambdaTest5 {
private static final String TEST_FILE = "LambdaTest5.jav";
@Test
public void run(){
Vector<String> mustContain = new Vector<String>();
mustContain.add("A var");
MultipleTypesInsertTester.test(this.TEST_FILE, mustContain);
}
}