Felder (Field) müssen nun immer mit einem Offset initialisiert werden. Fehler behoben. Parser modifiziert. VariableTypeInsertTest läuft erfolgreich

This commit is contained in:
JanUlrich 2014-03-09 12:10:03 +01:00
parent 1872b8aac4
commit 4786345f7b
9 changed files with 183 additions and 163 deletions

View File

@ -821,7 +821,7 @@ classmemberdeclaration : fielddeclaration
staticinitializer : STATIC block
{
Method STAT = new Method();
Method STAT = new Method($1.getOffset());
DeclId DST = new DeclId();
DST.set_Name($1.getLexem());
STAT.set_DeclId(DST);
@ -869,7 +869,7 @@ Dieses Problem ist bei Feldern nicht der Fall.
*/
fielddeclarator : variabledeclarator '=' expression
{
FieldDeclaration ret = new FieldDeclaration();
FieldDeclaration ret = new FieldDeclaration($1.getOffset());
ret.set_DeclId($1);
ret.setWert($3);
$$=ret;
@ -1197,8 +1197,9 @@ type : primitivetype
}
variabledeclarators : variabledeclarator
{
FieldDeclaration IVD = new FieldDeclaration();
FieldDeclaration IVD = new FieldDeclaration($1.getOffset());
IVD.getDeclIdVector().addElement( $1 );
IVD.setOffset($1.getOffset());
$$ = IVD;
}
| variabledeclarators ',' variabledeclarator
@ -1267,7 +1268,7 @@ classtypelist : classtype
methoddeclarator :IDENTIFIER '(' ')'
{
Method met = new Method();
Method met = new Method($1.getOffset());
/* #JB# 10.04.2005 */
/* ########################################################### */
met.setLineNumber($1.getLineNumber());
@ -1280,7 +1281,7 @@ methoddeclarator :IDENTIFIER '(' ')'
}
|IDENTIFIER '(' formalparameterlist ')'
{
Method met_para = new Method();
Method met_para = new Method($1.getOffset());
/* #JB# 10.04.2005 */
/* ########################################################### */
met_para.setLineNumber($1.getLineNumber());

View File

@ -50,10 +50,12 @@ public class Constant extends Method
// ino.end
// ino.method.Constant.23228.definition
@Deprecated
public Constant(String name, Modifiers mod)
// ino.end
// ino.method.Constant.23228.body
{
super(0); //Nur ein Workaraound. Da Constant = Deprecated
this.name = name;
this.mod = mod;
}

View File

@ -26,11 +26,13 @@ public class Constructor extends Method {
* Diese Klasse beherbegt den als Methode geparsten Konstruktor und wandelt sein verhalten zu dem eines Konstruktors ab.
*/
public Constructor(Method methode){
super(methode.getOffset());
this.methode = methode;
this.setDeclIdVector(methode.getDeclIdVector());
this.methode.setType(new RefType(this.methode.getParentClass().getName(),0));
}
@Override
public void setGenericMethodParameters(
Vector<GenericTypeVar> genericMethodParameters) {

View File

@ -22,6 +22,10 @@ public abstract class Field extends SyntaxTreeNode implements TypeInsertable, Ty
private int offset;
public Field(int offset){
this.offset = offset;
}
@Override
public void setOffset(int offset){
this.offset = offset;

View File

@ -29,6 +29,10 @@ public class FieldDeclaration extends Field{
private Expr wert;
//private Type type;
public FieldDeclaration(int offset){
super(offset);
}
public void setWert(Expr initialExpression){
this.wert = initialExpression;
}

View File

@ -100,6 +100,10 @@ public class Method extends Field implements ITypeReplacementListener, IItemWith
protected static Logger parserlog = Logger.getLogger("parser");
// ino.end
public Method(int offset){
super(offset);
}
// ino.method.setGenericMethodParameters.23521.definition
public void setGenericMethodParameters(Vector<GenericTypeVar> genericMethodParameters)
// ino.end
@ -684,7 +688,7 @@ public class Method extends Field implements ITypeReplacementListener, IItemWith
}
public static Method createEmptyMethod(String withSignature, Class parent){
Method ret = new Method();
Method ret = new Method(0);
DeclId DImethod = new DeclId();
DImethod.set_Name(withSignature);
ret.set_DeclId(DImethod);

File diff suppressed because it is too large Load Diff

View File

@ -821,7 +821,7 @@ classmemberdeclaration : fielddeclaration
staticinitializer : STATIC block
{
Method STAT = new Method();
Method STAT = new Method($1.getOffset());
DeclId DST = new DeclId();
DST.set_Name($1.getLexem());
STAT.set_DeclId(DST);
@ -869,7 +869,7 @@ Dieses Problem ist bei Feldern nicht der Fall.
*/
fielddeclarator : variabledeclarator '=' expression
{
FieldDeclaration ret = new FieldDeclaration();
FieldDeclaration ret = new FieldDeclaration($1.getOffset());
ret.set_DeclId($1);
ret.setWert($3);
$$=ret;
@ -1197,8 +1197,9 @@ type : primitivetype
}
variabledeclarators : variabledeclarator
{
FieldDeclaration IVD = new FieldDeclaration();
FieldDeclaration IVD = new FieldDeclaration($1.getOffset());
IVD.getDeclIdVector().addElement( $1 );
IVD.setOffset($1.getOffset());
$$ = IVD;
}
| variabledeclarators ',' variabledeclarator
@ -1267,7 +1268,7 @@ classtypelist : classtype
methoddeclarator :IDENTIFIER '(' ')'
{
Method met = new Method();
Method met = new Method($1.getOffset());
/* #JB# 10.04.2005 */
/* ########################################################### */
met.setLineNumber($1.getLineNumber());
@ -1280,7 +1281,7 @@ methoddeclarator :IDENTIFIER '(' ')'
}
|IDENTIFIER '(' formalparameterlist ')'
{
Method met_para = new Method();
Method met_para = new Method($1.getOffset());
/* #JB# 10.04.2005 */
/* ########################################################### */
met_para.setLineNumber($1.getLineNumber());

View File

@ -12,6 +12,7 @@ public class FunNMethod extends Method{
* @param N - Anzahl der Parameter (Beispiel: Fun2<R, T1, T2>)
*/
public FunNMethod(int N){
super(0); //Hat keinen Offset, da nur theoretisch gedachte Methode
this.setType(TypePlaceholder.fresh(this));
ParameterList pl = new ParameterList();
Vector<FormalParameter> fpList = new Vector<FormalParameter>();