forked from JavaTX/JavaCompilerCore
- getDescription ist nicht die Descripiton im Bytecode
This commit is contained in:
parent
943c4e6043
commit
45cad9f675
@ -993,7 +993,7 @@ public class Class extends GTVDeclarationContext implements AClassOrInterface, I
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription(ClassGenerator cg, TypeinferenceResultSet rs){
|
||||
public String getDescription(){
|
||||
return "class "+this.getName();
|
||||
}
|
||||
@Override
|
||||
|
@ -108,7 +108,7 @@ public abstract class Field extends GTVDeclarationContext implements TypeInserta
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription(ClassGenerator cg, TypeinferenceResultSet rs){
|
||||
public String getDescription(){
|
||||
return this.getIdentifier();
|
||||
}
|
||||
|
||||
|
@ -173,7 +173,7 @@ public class FieldDeclaration extends Field{
|
||||
*/
|
||||
public InstructionList genByteCode(ClassGenerator cg, TypeinferenceResultSet rs) {
|
||||
//Das Feld an die Klasse anfügen:
|
||||
FieldGen field = new FieldGen(0, this.getType().getBytecodeType(cg, rs), this.getDescription(cg, rs), cg.getConstantPool());
|
||||
FieldGen field = new FieldGen(0, this.getType().getBytecodeType(cg, rs), this.getDescription(), cg.getConstantPool());
|
||||
field.addAttribute(cg.getInstructionFactory().createSignatureAttribute(this.getType().getBytecodeSignature(cg, rs)));
|
||||
cg.addField(field.getField());
|
||||
|
||||
@ -187,7 +187,7 @@ public class FieldDeclaration extends Field{
|
||||
|
||||
FieldInstruction putFieldInstruction =
|
||||
cg.getInstructionFactory().createFieldAccess(this.getParentClass().getName().toString(),
|
||||
this.getDescription(cg, rs), this.getType().getBytecodeType(cg, rs), Constants.PUTFIELD);
|
||||
this.getDescription(), this.getType().getBytecodeType(cg, rs), Constants.PUTFIELD);
|
||||
il.append(putFieldInstruction );
|
||||
return il;
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ public class FormalParameter extends SyntaxTreeNode implements Typeable, TypeIns
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription(ClassGenerator cg, TypeinferenceResultSet rs){
|
||||
public String getDescription(){
|
||||
String ret = "";
|
||||
if(this.getType() != null && !(this.getType() instanceof TypePlaceholder)){
|
||||
ret += this.getType().getBytecodeSignature(null, null);
|
||||
|
@ -55,9 +55,11 @@ public abstract class SyntaxTreeNode implements IItemWithOffset{
|
||||
|
||||
/**
|
||||
* Eine Beschreibung/Name des SyntaxTree-Nodes
|
||||
* Hat nichts mit der Description im Bytecode zu tun,
|
||||
* wird für die Anzeige des AST im Plugin verwendet
|
||||
* @return
|
||||
*/
|
||||
public String getDescription(ClassGenerator cg, TypeinferenceResultSet rs){
|
||||
public String getDescription(){
|
||||
return this.toString();
|
||||
}
|
||||
|
||||
@ -66,7 +68,7 @@ public abstract class SyntaxTreeNode implements IItemWithOffset{
|
||||
public boolean equals(Object object){
|
||||
if(!(object instanceof SyntaxTreeNode))return false;
|
||||
SyntaxTreeNode equal = (SyntaxTreeNode)object;
|
||||
if(!equal.getDescription(null, null).equals(this.getDescription(null, null)))return false;
|
||||
if(!equal.getDescription().equals(this.getDescription()))return false;
|
||||
if(this.getParent()!=null)
|
||||
if(!this.getParent().equals(equal.getParent()))return false; //auch das Elternelement überprüfen.
|
||||
return true;
|
||||
|
@ -252,7 +252,7 @@ public class Block extends Statement
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription(ClassGenerator cg, TypeinferenceResultSet rs){
|
||||
public String getDescription(){
|
||||
return "Block";
|
||||
}
|
||||
|
||||
|
@ -379,7 +379,7 @@ public class LocalVarDecl extends Statement implements TypeInsertable
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription(ClassGenerator cg, TypeinferenceResultSet rs){
|
||||
public String getDescription(){
|
||||
if(this.getType() == null)return "no type " + declid.toString();
|
||||
if(this.getType() instanceof TypePlaceholder)return declid.toString();
|
||||
return this.getType().toString() + " " + declid.toString();
|
||||
|
@ -200,13 +200,16 @@ public class NewClass extends Expr
|
||||
il.append(_cg.getInstructionFactory().createNew(this.getType().getBytecodeType(_cg, rs).toString()));
|
||||
il.append(InstructionConstants.DUP);
|
||||
|
||||
String signature = getType().getBytecodeSignature(_cg, rs);
|
||||
String description = signature.substring(1, signature.length()-1);
|
||||
|
||||
if(arglist!=null){
|
||||
il.append(arglist.generateBytecode(_cg, rs));
|
||||
il.append(_cg.getInstructionFactory().createInvoke(this.getType().getDescription(_cg, rs), "<init>",
|
||||
il.append(_cg.getInstructionFactory().createInvoke(description, "<init>",
|
||||
org.apache.commons.bcel6.generic.Type.VOID,
|
||||
this.arglist.getBytecodeTypeList(_cg, rs), Constants.INVOKESPECIAL));
|
||||
}else{
|
||||
il.append(_cg.getInstructionFactory().createInvoke(this.getType().getDescription(_cg, rs), "<init>",
|
||||
il.append(_cg.getInstructionFactory().createInvoke(description, "<init>",
|
||||
org.apache.commons.bcel6.generic.Type.VOID,
|
||||
new org.apache.commons.bcel6.generic.Type[]{}, Constants.INVOKESPECIAL));
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ public abstract class Statement extends SyntaxTreeNode implements IItemWithOffse
|
||||
public abstract JavaCodeResult printJavaCode(ResultSet resultSet);
|
||||
|
||||
@Override
|
||||
public String getDescription(ClassGenerator cg, TypeinferenceResultSet rs){
|
||||
public String getDescription(){
|
||||
return this.printJavaCode(new ResultSet(new Menge<Pair>())).toString();
|
||||
}
|
||||
|
||||
|
@ -874,12 +874,6 @@ public class RefType extends ObjectType implements IMatchable
|
||||
public GenericClassType getGenericClassType(){
|
||||
return new GenericClassType(getName().toString(), getParaList(), parent, getOffset());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription(ClassGenerator cg, TypeinferenceResultSet rs) {
|
||||
String signature = getBytecodeSignature(cg, rs);
|
||||
return signature.substring(1, signature.length()-1);
|
||||
}
|
||||
}
|
||||
// ino.end
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
import java.lang.System;
|
||||
|
||||
class SystemOutPrintln{
|
||||
void method() {
|
||||
System.out.println("Hello World");
|
||||
|
Loading…
Reference in New Issue
Block a user