forked from JavaTX/JavaCompilerCore
createTypeAssumptions für Field generiert
This commit is contained in:
parent
e31725f255
commit
bf341ab4f3
@ -80,15 +80,6 @@ public class MyCompiler implements MyCompilerAPI
|
|||||||
protected String OutputDir = "";
|
protected String OutputDir = "";
|
||||||
// ino.end
|
// ino.end
|
||||||
|
|
||||||
// ino.attribute.m_Singleton.21277.decldescription type=javadoc
|
|
||||||
/**
|
|
||||||
* Die Singleton-Instanz f<EFBFBD>r den Compiler
|
|
||||||
* <br/>Autor: J<EFBFBD>rg B<EFBFBD>uerle
|
|
||||||
*/
|
|
||||||
// ino.end
|
|
||||||
// ino.attribute.m_Singleton.21277.declaration
|
|
||||||
private static MyCompiler m_Singleton = null;
|
|
||||||
// ino.end
|
|
||||||
|
|
||||||
// ino.attribute.m_AbstractSyntaxTree.21280.decldescription type=javadoc
|
// ino.attribute.m_AbstractSyntaxTree.21280.decldescription type=javadoc
|
||||||
/**
|
/**
|
||||||
@ -130,10 +121,7 @@ public class MyCompiler implements MyCompilerAPI
|
|||||||
// ino.end
|
// ino.end
|
||||||
// ino.method.getAPI.21286.body
|
// ino.method.getAPI.21286.body
|
||||||
{
|
{
|
||||||
if(m_Singleton==null){
|
return new MyCompiler();
|
||||||
m_Singleton = new MyCompiler();
|
|
||||||
}
|
|
||||||
return m_Singleton;
|
|
||||||
}
|
}
|
||||||
// ino.end
|
// ino.end
|
||||||
|
|
||||||
|
@ -1258,6 +1258,9 @@ public class Class extends SyntaxTreeNode implements AClassOrInterface
|
|||||||
*/
|
*/
|
||||||
public TypeAssumptions getPublicFieldAssumptions() {
|
public TypeAssumptions getPublicFieldAssumptions() {
|
||||||
TypeAssumptions ret = this.getTypeAssumptions();
|
TypeAssumptions ret = this.getTypeAssumptions();
|
||||||
|
for(Field f : this.getFields()){
|
||||||
|
ret.add(f.createTypeAssumptions(this));
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,8 @@ import typinferenz.JavaCodeResult;
|
|||||||
import typinferenz.OderConstraint;
|
import typinferenz.OderConstraint;
|
||||||
import typinferenz.ResultSet;
|
import typinferenz.ResultSet;
|
||||||
import typinferenz.SingleConstraint;
|
import typinferenz.SingleConstraint;
|
||||||
|
import typinferenz.TypinferenzException;
|
||||||
|
import typinferenz.assumptions.FieldAssumption;
|
||||||
import typinferenz.assumptions.TypeAssumptions;
|
import typinferenz.assumptions.TypeAssumptions;
|
||||||
import mycompiler.SyntaxTreeNode;
|
import mycompiler.SyntaxTreeNode;
|
||||||
import mycompiler.mybytecode.ClassFile;
|
import mycompiler.mybytecode.ClassFile;
|
||||||
@ -71,15 +73,16 @@ public class FieldDeclaration extends Field{
|
|||||||
* TODO: Der Feld-Assumption muss ein TPH als Typ hinzugefügt werden, falls er Typlos initialisiert wurde. Dies kann auch der Type-Algorithmus der Inst/FieldVar - Klasse machen.
|
* TODO: Der Feld-Assumption muss ein TPH als Typ hinzugefügt werden, falls er Typlos initialisiert wurde. Dies kann auch der Type-Algorithmus der Inst/FieldVar - Klasse machen.
|
||||||
* Wird das Feld mit einem Typ initialisiert so muss dieser auch in die Assumptions.
|
* Wird das Feld mit einem Typ initialisiert so muss dieser auch in die Assumptions.
|
||||||
*/
|
*/
|
||||||
if(this.getType() == null)this.setType(TypePlaceholder.fresh(this));
|
if(this.getType() == null)throw new TypinferenzException("Der Typ eines Feldes darf nicht null sein");
|
||||||
//assumptions.add(TypeAssumptions.createFieldVarAssumption(classmember.getName(), this.getName(), this.getType()));
|
//assumptions.add(TypeAssumptions.createFieldVarAssumption(classmember.getName(), this.getName(), this.getType()));
|
||||||
|
assumptions.addFieldAssumption(new FieldAssumption(this,classmember));
|
||||||
return assumptions;
|
return assumptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void parserPostProcessing(SyntaxTreeNode parent){
|
public void parserPostProcessing(SyntaxTreeNode parent){
|
||||||
super.parserPostProcessing(parent);
|
super.parserPostProcessing(parent);
|
||||||
|
if(this.getType() == null)this.setType(TypePlaceholder.fresh(this));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,41 +1,11 @@
|
|||||||
Class DEBUG [Typeinference] Erstellte Assumptions: this: WhileTestMethod Assumptions:
|
Class DEBUG [Typeinference] Erstellte Assumptions: this: LambdaTest1Method Assumptions:
|
||||||
[typinferenz.assumptions.MethodAssumption@33e8c1e4, typinferenz.assumptions.MethodAssumption@76117a5b]
|
[typinferenz.assumptions.MethodAssumption@1e54f9f6, typinferenz.assumptions.MethodAssumption@5ce69508]
|
||||||
FieldVar Assumptions:
|
FieldVar Assumptions:
|
||||||
[]
|
[typinferenz.assumptions.FieldAssumption@26426fde]
|
||||||
LocalVar Assumptions:
|
LocalVar Assumptions:
|
||||||
[]
|
[]
|
||||||
Parameter Assumptions:
|
Parameter Assumptions:
|
||||||
[]
|
[]
|
||||||
|
|
||||||
Block DEBUG [Typeinference] Prozessing statement: no type [var]
|
Block DEBUG [Typeinference] Prozessing statement: null Return null (( [ String text, ]) -> null { [null Return toAppend])
|
||||||
Block DEBUG [Typeinference] Prozessing statement: WHILE null { [(var = mycompiler.mystatement.StringLiteral@25cc8345)]
|
Block DEBUG [Typeinference] Prozessing statement: null Return toAppend
|
||||||
Block DEBUG [Typeinference] Prozessing statement: (var = mycompiler.mystatement.StringLiteral@25cc8345)
|
|
||||||
Block DEBUG [Typeinference] Prozessing statement: void(var: TPH C = mycompiler.mystatement.StringLiteral@25cc8345)
|
|
||||||
Block DEBUG [Typeinference] Prozessing statement: WHILE void { [void(var: TPH C = mycompiler.mystatement.StringLiteral@25cc8345)]
|
|
||||||
Block DEBUG [Typeinference] Prozessing statement: TPH C [var]
|
|
||||||
Class DEBUG [Typeinference] Erstellte Constraints: boolean < boolean
|
|
||||||
String < TPH C
|
|
||||||
TPH C < TPH D
|
|
||||||
void < TPH A
|
|
||||||
|
|
||||||
SourceFile DEBUG [Typeinference] Karthesisches Produkt der Constraints: [[(boolean <. boolean), (String <. TPH C), (TPH C <. TPH D), (void <. TPH A)]]
|
|
||||||
SourceFile DEBUG [Typeinference] Unifiziertes Ergebnis: [[(TPH D = String), (TPH C = String), (TPH A = void)]]
|
|
||||||
SourceFile DEBUG [Typeinference]
|
|
||||||
JavaFiles:
|
|
||||||
|
|
||||||
SourceFile DEBUG [Typeinference] JavaFile für ResultSet Unified Constraints: [(TPH D = String), (TPH C = String), (TPH A = void)]
|
|
||||||
|
|
||||||
SourceFile DEBUG [Typeinference] class <B>WhileTest extends Object
|
|
||||||
{
|
|
||||||
void method()
|
|
||||||
{
|
|
||||||
String var;
|
|
||||||
while(true){
|
|
||||||
var = "String";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
B WhileTest()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user