Commit c7d4d297 authored by Custom2043's avatar Custom2043

yea.

parent 2da3d75d
......@@ -37,7 +37,7 @@ public class MethodUse implements Operation
public HigherInfo apply(HigherInfo onInfo, OperationList on, HigherInfo refInfos) {
if (dec != null) {
HigherInfo info = NoInfo.instance;
HigherInfo info = on.getInfos(refInfos, false).setValue(VariableValue.thisValue);
for (int i=0;i<this.dec.args.getVariableList().length;i++)
info = new AndInfo(info, this.args[i].getInfos(refInfos, false).setValue(this.dec.args.originalValues[i]));
......@@ -54,7 +54,7 @@ public class MethodUse implements Operation
public AndInfo knowing(HigherInfo resultInfo, OperationList resultList, OperationList callerList, HigherInfo refInfos) {
if (dec != null) {
HigherInfo info = NoInfo.instance;
HigherInfo info = callerList.getInfos(refInfos, false).setValue(VariableValue.thisValue);
for (int i=0;i<this.dec.args.getVariableList().length;i++)
info = new AndInfo(info, this.args[i].getInfos(refInfos, false).setValue(this.dec.args.originalValues[i]));
......
......@@ -4,6 +4,8 @@ import compiler.Variable;
public class VariableValue implements Value
{
public static final VariableValue thisValue = new VariableValue(null);
public Variable possessedBy = null;
public VariableValue(Variable var) {
......
......@@ -9,6 +9,7 @@ import converter.TypeConverter;
import inflow.AndInfo;
import inflow.HigherInfo;
import inflow.NoInfo;
import inflow.VariableValue;
import language.parser.parser.*;
import namingSpace.ClassNamingSpace;
import namingSpace.MethodNamingSpace;
......@@ -363,6 +364,9 @@ public class MethodDeclaration extends Token
public HigherInfo apply(HigherInfo refInfos)
{
if (this.cons != null)
return this.namingSpace.getCurrentInfo().getInfosOn(VariableValue.thisValue);
HigherInfo info = NoInfo.instance;
for (ReturnStatement st : this.getTokensIn(ReturnStatement.class))
......@@ -373,6 +377,9 @@ public class MethodDeclaration extends Token
public AndInfo knowing(HigherInfo resultInfo, HigherInfo refInfos)
{
if (this.cons != null)
return new AndInfo(NoInfo.instance, NoInfo.instance);
HigherInfo info = NoInfo.instance;
for (ReturnStatement st : this.getTokensIn(ReturnStatement.class))
......
......@@ -223,12 +223,14 @@ public class Reference extends ExpressionPart
OperationList list;
if (this.exp != null)
list = this.exp.toOperationList();
else if (this.isFirstField())
list = new OperationList(VariableValue.thisValue);
else if (this.variables[0] == null)
return new OperationList();
else
list = new OperationList(this.variables[0].getValue());
for (int i = this.exp != null ? 0 : 1;i<this.names.length;i++)
for (int i = (this.exp != null || this.isFirstField()) ? 0 : 1;i<this.names.length;i++)
if (this.methods[i] != null)
{
OperationEnum opType = OperationEnum.getOperationFromReference(this, i);
......@@ -238,7 +240,12 @@ public class Reference extends ExpressionPart
list = list.apply(new MethodUse(opType, this.calls[i]));
}
else
return list = list.apply(new FieldAccess(this.variables[i]));
{
if (this.variables[i].dec.isClassArg())
list = list.apply(new FieldAccess(this.variables[i]));
else
list = new OperationList();
}
return list;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment