25: Start adding Float Type

This commit is contained in:
Marvin Kaiser
2020-03-03 20:45:55 +01:00
parent db8146ed8a
commit 0316a7d4bf
14 changed files with 658 additions and 98 deletions

View File

@@ -1,12 +1,20 @@
package de.hsrm.compiler.Klang;
import de.hsrm.compiler.Klang.types.Type;
public class Value {
public Type type;
private Object value;
public Value(Object value) {
this.value = value;
}
public Value(Object value, Type type) {
this.value = value;
this.type = type;
}
public Object asObject() {
return this.value;
}
@@ -14,6 +22,10 @@ public class Value {
public int asInteger() {
return (int) this.value;
}
public double asFloat() {
return (double) this.value;
}
public boolean asBoolean() {
return (boolean) this.value;