Kleine Änderung

This commit is contained in:
Fayez Abu Alia 2018-02-21 11:44:03 +01:00
parent 6cf98f200b
commit 7c2f7c54dd
5 changed files with 25 additions and 4 deletions

View File

@ -435,11 +435,10 @@ public class BytecodeGenMethod implements StatementVisitor{
@Override
public void visit(Literal literal) {
System.out.println(resultSet.resolveType(literal.getType()).resolvedType.acceptTV(new TypeToDescriptor()));
Object value = literal.value;
switch (resultSet.resolveType(literal.getType()).resolvedType.acceptTV(new TypeToDescriptor())) {
case "java/lang/String":
mv.visitLdcInsn((String) value);
mv.visitLdcInsn(value);
break;
case "java/lang/Boolean":
visitBooleanLiteral((Boolean) value);

View File

@ -132,7 +132,8 @@ public class Signature {
break;
case "TPH":
RefTypeOrTPHOrWildcardOrGeneric r = resultSet.resolveType(t).resolvedType;
sv.visitInterface().visitClassType(r.acceptTV(new TypeToSignature()));
if(!r.acceptTV(new TypeToSignature()).substring(0, 4).equals("TPH "))
sv.visitInterface().visitClassType(r.acceptTV(new TypeToSignature()));
// sv.visitClassType(r.acceptTV(new TypeToSignature()));
System.out.println(r.getClass()+" Signature TPH: "+r.acceptTV(new TypeToSignature()));
break;

View File

@ -10,7 +10,7 @@ import java.lang.Character;
class AssignToLit {
void m(){
String s = "String";
String s = "Test";
Boolean b = false;
Byte byte1 = 5;
Byte byte2 = 55;

14
test/bytecode/Methods.jav Normal file
View File

@ -0,0 +1,14 @@
import java.lang.Integer;
class Methods {
m(a,b){
var c=a+b;
return c;
}
method2(x){
Integer i = this.m(x,2);
return i;
}
}

View File

@ -0,0 +1,7 @@
package bytecode;
public class MethodsTest extends JavaTXCompilerTest {
public MethodsTest() {
this.fileName = "Methods";
}
}