Commit 69272ec8 authored by Allan MILHOMME's avatar Allan MILHOMME

b

parent 6ee4ca44
......@@ -2,7 +2,13 @@ package compiler;
import java.util.Arrays;
import language.parser.tokens.*;
import language.parser.tokens.GenericArgs;
import language.parser.tokens.LiteralValue;
import language.parser.tokens.MethodDeclaration;
import language.parser.tokens.MyType;
import language.parser.tokens.Reference;
import language.parser.tokens.UnitDeclaration;
import main.Logger;
import namingSpace.NamingSpace;
import namingSpace.UnitNamingSpace;
......@@ -96,9 +102,10 @@ public class ReferenceCompiler {
.toString(currentSpace.getTopLevelSuperSpace(), this.ref.names[i].toString(), types));
return MyType.unknownType;
}
else if (!dec.asserts.check(dec.args, this.ref.calls[i].exp, currentSpace.getCurrentInfo()))
else if (!dec.asserts.check(dec.args, this.ref.calls[i].exp, currentSpace.getCurrentInfo())) {
UnitCompiler.report("Assert non verifie : " + MethodDeclaration
.toString(currentSpace.getTopLevelSuperSpace(), this.ref.names[i].toString(), types));
}
this.ref.methods[i] = dec;
......
......@@ -68,7 +68,7 @@ public class StructureCompiler {
whi.space = new NamingSpace(space, false);
MethodNamingSpace methodSpace = space.getFirstUpperNamingSpace(MethodNamingSpace.class);
methodSpace.inflow.newNullInflow();
methodSpace.inflow.newLoopInflow();
MyType t = this.unit.expressionCompiler.compile(space, whi.condition);
if (!t.isType(Access.booleanAccess))
......@@ -82,7 +82,7 @@ public class StructureCompiler {
fo.space = new NamingSpace(space, false);
MethodNamingSpace methodSpace = space.getFirstUpperNamingSpace(MethodNamingSpace.class);
methodSpace.inflow.newNullInflow();
methodSpace.inflow.newLoopInflow();
if (fo.exp1 != null)
this.unit.expressionCompiler.compile(fo.space, fo.exp1);
......
......@@ -7,6 +7,7 @@ import language.parser.tokens.Access;
import language.parser.tokens.ClassDeclaration;
import language.parser.tokens.ImportStatement;
import language.parser.tokens.UnitDeclaration;
import main.Logger;
public abstract class UnitSystem {
public static boolean ok = true;
......@@ -28,7 +29,7 @@ public abstract class UnitSystem {
}
catch (Exception e) {
System.out.println("Couldn't read class : " + access.getTotal());
Logger.debug("Couldn't read class : " + access.getTotal());
e.printStackTrace();
}
}
......
......@@ -9,6 +9,7 @@ import inflow.Inflow;
import inflow.VariableValue;
import language.parser.tokens.MyType;
import language.parser.tokens.VariableDeclaration;
import main.Logger;
import namingSpace.MethodNamingSpace;
public class Variable {
......
......@@ -22,6 +22,10 @@ public class BasicInflow extends Inflow {
this.childInflow = new IfInflow(this, ifElse, conditions);
}
public void newLoopInflow() {
this.childInflow = new LoopInflow(this);
}
public void newNullInflow() {
this.childInflow = new NullInflow(this);
}
......
......@@ -21,7 +21,7 @@ public class ValueInfo extends HigherInfo {
@Override
public HigherInfo getInfosOn(Value var, HigherInfo info) {
if (this.value.equals(var))
if (this.value != null && this.value.equals(var))
return this;
return NoInfo.instance;
}
......
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