Type: Extend from Expression, compare with is().
41 files changed, 140 insertions(+), 118 deletions(-)

M src/main/java/nl/grauw/glass/expressions/Add.java
M src/main/java/nl/grauw/glass/expressions/And.java
M src/main/java/nl/grauw/glass/expressions/Annotation.java
M src/main/java/nl/grauw/glass/expressions/BinaryOperator.java
M src/main/java/nl/grauw/glass/expressions/CharacterLiteral.java
M src/main/java/nl/grauw/glass/expressions/Complement.java
M src/main/java/nl/grauw/glass/expressions/ContextLiteral.java
M src/main/java/nl/grauw/glass/expressions/Divide.java
M src/main/java/nl/grauw/glass/expressions/Equals.java
M src/main/java/nl/grauw/glass/expressions/ErrorLiteral.java
M src/main/java/nl/grauw/glass/expressions/Expression.java
M src/main/java/nl/grauw/glass/expressions/Flag.java
M src/main/java/nl/grauw/glass/expressions/FlagOrRegister.java
M src/main/java/nl/grauw/glass/expressions/GreaterOrEquals.java
M src/main/java/nl/grauw/glass/expressions/GreaterThan.java
M src/main/java/nl/grauw/glass/expressions/Group.java
M src/main/java/nl/grauw/glass/expressions/IfElse.java
M src/main/java/nl/grauw/glass/expressions/Instruction.java
M src/main/java/nl/grauw/glass/expressions/IntegerLiteral.java
M src/main/java/nl/grauw/glass/expressions/LessOrEquals.java
M src/main/java/nl/grauw/glass/expressions/LessThan.java
M src/main/java/nl/grauw/glass/expressions/LogicalAnd.java
M src/main/java/nl/grauw/glass/expressions/LogicalOr.java
M src/main/java/nl/grauw/glass/expressions/Modulo.java
M src/main/java/nl/grauw/glass/expressions/Multiply.java
M src/main/java/nl/grauw/glass/expressions/Negative.java
M src/main/java/nl/grauw/glass/expressions/Not.java
M src/main/java/nl/grauw/glass/expressions/NotEquals.java
M src/main/java/nl/grauw/glass/expressions/Or.java
M src/main/java/nl/grauw/glass/expressions/Passthrough.java
M src/main/java/nl/grauw/glass/expressions/Positive.java
M src/main/java/nl/grauw/glass/expressions/Register.java
M src/main/java/nl/grauw/glass/expressions/SectionContextLiteral.java
M src/main/java/nl/grauw/glass/expressions/Sequence.java
M src/main/java/nl/grauw/glass/expressions/ShiftLeft.java
M src/main/java/nl/grauw/glass/expressions/ShiftRight.java
M src/main/java/nl/grauw/glass/expressions/StringLiteral.java
M src/main/java/nl/grauw/glass/expressions/Subtract.java
M src/main/java/nl/grauw/glass/expressions/Type.java
M src/main/java/nl/grauw/glass/expressions/UnaryOperator.java
M src/main/java/nl/grauw/glass/expressions/Xor.java
M src/main/java/nl/grauw/glass/expressions/Add.java +5 -5
@@ 20,8 20,8 @@ public class Add extends BinaryOperator 
 	}
 
 	@Override
-	public boolean is(Type type) {
-		if (type == Type.REGISTER) {
+	public boolean is(Expression type) {
+		if (type.is(Type.REGISTER)) {
 			if (term1.is(Type.REGISTER)) {
 				Register register = term1.getRegister();
 				return register.isIndex() && register.isPair();

          
@@ 32,10 32,10 @@ public class Add extends BinaryOperator 
 	}
 
 	@Override
-	public Expression get(Type type) {
-		if (type == Type.INTEGER)
+	public Expression get(Expression type) {
+		if (type.is(Type.INTEGER))
 			return IntegerLiteral.of(term1.getInteger() + term2.getInteger());
-		if (type == Type.REGISTER) {
+		if (type.is(Type.REGISTER)) {
 			if (term1.is(Type.REGISTER)) {
 				Register register = term1.getRegister();
 				if (register.isIndex() && register.isPair()) {

          
M src/main/java/nl/grauw/glass/expressions/And.java +2 -2
@@ 12,8 12,8 @@ public class And extends BinaryOperator 
 	}
 
 	@Override
-	public Expression get(Type type) {
-		if (type == Type.INTEGER)
+	public Expression get(Expression type) {
+		if (type.is(Type.INTEGER))
 			return IntegerLiteral.of(term1.getInteger() & term2.getInteger());
 		return super.get(type);
 	}

          
M src/main/java/nl/grauw/glass/expressions/Annotation.java +4 -4
@@ 24,13 24,13 @@ public class Annotation extends Expressi
 	}
 
 	@Override
-	public boolean is(Type type) {
-		return type == Type.ANNOTATION;
+	public boolean is(Expression type) {
+		return type.is(Type.ANNOTATION);
 	}
 
 	@Override
-	public Expression get(Type type) {
-		if (type == Type.ANNOTATION)
+	public Expression get(Expression type) {
+		if (type.is(Type.ANNOTATION))
 			return this;
 		return super.get(type);
 	}

          
M src/main/java/nl/grauw/glass/expressions/BinaryOperator.java +2 -2
@@ 21,8 21,8 @@ public abstract class BinaryOperator ext
 	}
 
 	@Override
-	public boolean is(Type type) {
-		return type == Type.INTEGER && term1.is(type) && term2.is(type);
+	public boolean is(Expression type) {
+		return type.is(Type.INTEGER) && term1.is(type) && term2.is(type);
 	}
 
 	public String toString() {

          
M src/main/java/nl/grauw/glass/expressions/CharacterLiteral.java +4 -4
@@ 18,13 18,13 @@ public class CharacterLiteral extends Li
 	}
 
 	@Override
-	public boolean is(Type type) {
-		return type == Type.INTEGER;
+	public boolean is(Expression type) {
+		return type.is(Type.INTEGER);
 	}
 
 	@Override
-	public Expression get(Type type) {
-		if (type == Type.INTEGER)
+	public Expression get(Expression type) {
+		if (type.is(Type.INTEGER))
 			return IntegerLiteral.of(character);
 		return super.get(type);
 	}

          
M src/main/java/nl/grauw/glass/expressions/Complement.java +2 -2
@@ 12,8 12,8 @@ public class Complement extends UnaryOpe
 	}
 
 	@Override
-	public Expression get(Type type) {
-		if (type == Type.INTEGER)
+	public Expression get(Expression type) {
+		if (type.is(Type.INTEGER))
 			return IntegerLiteral.of(~term.getInteger());
 		return super.get(type);
 	}

          
M src/main/java/nl/grauw/glass/expressions/ContextLiteral.java +5 -5
@@ 19,15 19,15 @@ public class ContextLiteral extends Lite
 	}
 
 	@Override
-	public boolean is(Type type) {
-		return type == Type.INTEGER || type == Type.CONTEXT;
+	public boolean is(Expression type) {
+		return type.is(Type.INTEGER) || type.is(Type.CONTEXT);
 	}
 
 	@Override
-	public Expression get(Type type) {
-		if (type == Type.CONTEXT)
+	public Expression get(Expression type) {
+		if (type.is(Type.CONTEXT))
 			return this;
-		if (type == Type.INTEGER)
+		if (type.is(Type.INTEGER))
 			return context.getAddress();
 		return super.get(type);
 	}

          
M src/main/java/nl/grauw/glass/expressions/Divide.java +2 -2
@@ 20,8 20,8 @@ public class Divide extends BinaryOperat
 	}
 
 	@Override
-	public Expression get(Type type) {
-		if (type == Type.INTEGER) {
+	public Expression get(Expression type) {
+		if (type.is(Type.INTEGER)) {
 			int divisor = term2.getInteger();
 			if (divisor == 0)
 				throw new EvaluationException("Division by zero.");

          
M src/main/java/nl/grauw/glass/expressions/Equals.java +2 -2
@@ 12,8 12,8 @@ public class Equals extends BinaryOperat
 	}
 
 	@Override
-	public Expression get(Type type) {
-		if (type == Type.INTEGER)
+	public Expression get(Expression type) {
+		if (type.is(Type.INTEGER))
 			return IntegerLiteral.of(term1.getInteger() == term2.getInteger());
 		return super.get(type);
 	}

          
M src/main/java/nl/grauw/glass/expressions/ErrorLiteral.java +2 -2
@@ 14,12 14,12 @@ public class ErrorLiteral extends Litera
 	}
 
 	@Override
-	public boolean is(Type type) {
+	public boolean is(Expression type) {
 		return true;
 	}
 
 	@Override
-	public Expression get(Type type) {
+	public Expression get(Expression type) {
 		throw exception;
 	}
 

          
M src/main/java/nl/grauw/glass/expressions/Expression.java +2 -2
@@ 11,9 11,9 @@ public abstract class Expression {
 
 	public abstract Expression copy(Context context);
 
-	public abstract boolean is(Type type);
+	public abstract boolean is(Expression type);
 
-	public Expression get(Type type) {
+	public Expression get(Expression type) {
 		return new ErrorLiteral(new EvaluationException("Not of type " + type)).get(type);
 	}
 

          
M src/main/java/nl/grauw/glass/expressions/Flag.java +4 -4
@@ 29,13 29,13 @@ public class Flag extends Literal {
 	}
 
 	@Override
-	public boolean is(Type type) {
-		return type == Type.FLAG;
+	public boolean is(Expression type) {
+		return type.is(Type.FLAG);
 	}
 
 	@Override
-	public Expression get(Type type) {
-		if (type == Type.FLAG)
+	public Expression get(Expression type) {
+		if (type.is(Type.FLAG))
 			return this;
 		return super.get(type);
 	}

          
M src/main/java/nl/grauw/glass/expressions/FlagOrRegister.java +5 -5
@@ 28,15 28,15 @@ public class FlagOrRegister extends Lite
 	}
 
 	@Override
-	public boolean is(Type type) {
-		return type == Type.FLAG || type == Type.REGISTER;
+	public boolean is(Expression type) {
+		return type.is(Type.FLAG) || type.is(Type.REGISTER);
 	}
 
 	@Override
-	public Expression get(Type type) {
-		if (type == Type.FLAG)
+	public Expression get(Expression type) {
+		if (type.is(Type.FLAG))
 			return flag;
-		if (type == Type.REGISTER)
+		if (type.is(Type.REGISTER))
 			return register;
 		return super.get(type);
 	}

          
M src/main/java/nl/grauw/glass/expressions/GreaterOrEquals.java +2 -2
@@ 12,8 12,8 @@ public class GreaterOrEquals extends Bin
 	}
 
 	@Override
-	public Expression get(Type type) {
-		if (type == Type.INTEGER)
+	public Expression get(Expression type) {
+		if (type.is(Type.INTEGER))
 			return IntegerLiteral.of(term1.getInteger() >= term2.getInteger());
 		return super.get(type);
 	}

          
M src/main/java/nl/grauw/glass/expressions/GreaterThan.java +2 -2
@@ 12,8 12,8 @@ public class GreaterThan extends BinaryO
 	}
 
 	@Override
-	public Expression get(Type type) {
-		if (type == Type.INTEGER)
+	public Expression get(Expression type) {
+		if (type.is(Type.INTEGER))
 			return IntegerLiteral.of(term1.getInteger() > term2.getInteger());
 		return super.get(type);
 	}

          
M src/main/java/nl/grauw/glass/expressions/Group.java +2 -2
@@ 23,8 23,8 @@ public class Group extends Passthrough {
 	}
 
 	@Override
-	public boolean is(Type type) {
-		return type == Type.GROUP || super.is(type);
+	public boolean is(Expression type) {
+		return type.is(Type.GROUP) || super.is(type);
 	}
 
 	public String toString() {

          
M src/main/java/nl/grauw/glass/expressions/IfElse.java +1 -1
@@ 39,7 39,7 @@ public class IfElse extends Passthrough 
 	}
 
 	@Override
-	public boolean is(Type type) {
+	public boolean is(Expression type) {
 		return (trueTerm.is(type) && falseTerm.is(type)) || super.is(type);
 	}
 

          
M src/main/java/nl/grauw/glass/expressions/Instruction.java +5 -5
@@ 23,15 23,15 @@ public class Instruction extends Express
 	}
 
 	@Override
-	public boolean is(Type type) {
-		return type == Type.INSTRUCTION || type == Type.CONTEXT;
+	public boolean is(Expression type) {
+		return type.is(Type.INSTRUCTION) || type.is(Type.CONTEXT);
 	}
 
 	@Override
-	public Expression get(Type type) {
-		if (type == Type.INSTRUCTION)
+	public Expression get(Expression type) {
+		if (type.is(Type.INSTRUCTION))
 			return this;
-		if (type == Type.CONTEXT)
+		if (type.is(Type.CONTEXT))
 			return new ContextLiteral(context);
 		return super.get(type);
 	}

          
M src/main/java/nl/grauw/glass/expressions/IntegerLiteral.java +4 -4
@@ 31,13 31,13 @@ public class IntegerLiteral extends Lite
 	}
 
 	@Override
-	public boolean is(Type type) {
-		return type == Type.INTEGER;
+	public boolean is(Expression type) {
+		return type.is(Type.INTEGER);
 	}
 
 	@Override
-	public Expression get(Type type) {
-		if (type == Type.INTEGER)
+	public Expression get(Expression type) {
+		if (type.is(Type.INTEGER))
 			return this;
 		return super.get(type);
 	}

          
M src/main/java/nl/grauw/glass/expressions/LessOrEquals.java +2 -2
@@ 12,8 12,8 @@ public class LessOrEquals extends Binary
 	}
 
 	@Override
-	public Expression get(Type type) {
-		if (type == Type.INTEGER)
+	public Expression get(Expression type) {
+		if (type.is(Type.INTEGER))
 			return IntegerLiteral.of(term1.getInteger() <= term2.getInteger());
 		return super.get(type);
 	}

          
M src/main/java/nl/grauw/glass/expressions/LessThan.java +2 -2
@@ 12,8 12,8 @@ public class LessThan extends BinaryOper
 	}
 
 	@Override
-	public Expression get(Type type) {
-		if (type == Type.INTEGER)
+	public Expression get(Expression type) {
+		if (type.is(Type.INTEGER))
 			return IntegerLiteral.of(term1.getInteger() < term2.getInteger());
 		return super.get(type);
 	}

          
M src/main/java/nl/grauw/glass/expressions/LogicalAnd.java +2 -2
@@ 12,8 12,8 @@ public class LogicalAnd extends BinaryOp
 	}
 
 	@Override
-	public Expression get(Type type) {
-		if (type == Type.INTEGER) {
+	public Expression get(Expression type) {
+		if (type.is(Type.INTEGER)) {
 			int value1 = term1.getInteger();
 			return IntegerLiteral.of(value1 == 0 ? value1 : term2.getInteger());
 		}

          
M src/main/java/nl/grauw/glass/expressions/LogicalOr.java +2 -2
@@ 12,8 12,8 @@ public class LogicalOr extends BinaryOpe
 	}
 
 	@Override
-	public Expression get(Type type) {
-		if (type == Type.INTEGER) {
+	public Expression get(Expression type) {
+		if (type.is(Type.INTEGER)) {
 			int value1 = term1.getInteger();
 			return IntegerLiteral.of(value1 != 0 ? value1 : term2.getInteger());
 		}

          
M src/main/java/nl/grauw/glass/expressions/Modulo.java +2 -2
@@ 20,8 20,8 @@ public class Modulo extends BinaryOperat
 	}
 
 	@Override
-	public Expression get(Type type) {
-		if (type == Type.INTEGER) {
+	public Expression get(Expression type) {
+		if (type.is(Type.INTEGER)) {
 			int divisor = term2.getInteger();
 			if (divisor == 0)
 				throw new EvaluationException("Division by zero.");

          
M src/main/java/nl/grauw/glass/expressions/Multiply.java +2 -2
@@ 20,8 20,8 @@ public class Multiply extends BinaryOper
 	}
 
 	@Override
-	public Expression get(Type type) {
-		if (type == Type.INTEGER)
+	public Expression get(Expression type) {
+		if (type.is(Type.INTEGER))
 			return IntegerLiteral.of(term1.getInteger() * term2.getInteger());
 		return super.get(type);
 	}

          
M src/main/java/nl/grauw/glass/expressions/Negative.java +2 -2
@@ 12,8 12,8 @@ public class Negative extends UnaryOpera
 	}
 
 	@Override
-	public Expression get(Type type) {
-		if (type == Type.INTEGER)
+	public Expression get(Expression type) {
+		if (type.is(Type.INTEGER))
 			return IntegerLiteral.of(-term.getInteger());
 		return super.get(type);
 	}

          
M src/main/java/nl/grauw/glass/expressions/Not.java +5 -5
@@ 14,15 14,15 @@ public class Not extends UnaryOperator {
 	}
 
 	@Override
-	public boolean is(Type type) {
-		return type == Type.FLAG && term.is(Type.FLAG) || super.is(type);
+	public boolean is(Expression type) {
+		return type.is(Type.FLAG) && term.is(Type.FLAG) || super.is(type);
 	}
 
 	@Override
-	public Expression get(Type type) {
-		if (type == Type.INTEGER)
+	public Expression get(Expression type) {
+		if (type.is(Type.INTEGER))
 			return IntegerLiteral.of(term.getInteger() == 0);
-		if (type == Type.FLAG) {
+		if (type.is(Type.FLAG)) {
 			Flag flag = term.getFlag();
 			if (flag == Flag.NZ)
 				return Flag.Z;

          
M src/main/java/nl/grauw/glass/expressions/NotEquals.java +2 -2
@@ 12,8 12,8 @@ public class NotEquals extends BinaryOpe
 	}
 
 	@Override
-	public Expression get(Type type) {
-		if (type == Type.INTEGER)
+	public Expression get(Expression type) {
+		if (type.is(Type.INTEGER))
 			return IntegerLiteral.of(term1.getInteger() != term2.getInteger());
 		return super.get(type);
 	}

          
M src/main/java/nl/grauw/glass/expressions/Or.java +2 -2
@@ 12,8 12,8 @@ public class Or extends BinaryOperator {
 	}
 
 	@Override
-	public Expression get(Type type) {
-		if (type == Type.INTEGER)
+	public Expression get(Expression type) {
+		if (type.is(Type.INTEGER))
 			return IntegerLiteral.of(term1.getInteger() | term2.getInteger());
 		return super.get(type);
 	}

          
M src/main/java/nl/grauw/glass/expressions/Passthrough.java +2 -2
@@ 5,12 5,12 @@ public abstract class Passthrough extend
 	public abstract Expression resolve();
 
 	@Override
-	public boolean is(Type type) {
+	public boolean is(Expression type) {
 		return resolve().is(type);
 	}
 
 	@Override
-	public Expression get(Type type) {
+	public Expression get(Expression type) {
 		return resolve().get(type);
 	}
 

          
M src/main/java/nl/grauw/glass/expressions/Positive.java +2 -2
@@ 12,8 12,8 @@ public class Positive extends UnaryOpera
 	}
 
 	@Override
-	public Expression get(Type type) {
-		if (type == Type.INTEGER)
+	public Expression get(Expression type) {
+		if (type.is(Type.INTEGER))
 			return IntegerLiteral.of(+term.getInteger());
 		return super.get(type);
 	}

          
M src/main/java/nl/grauw/glass/expressions/Register.java +4 -4
@@ 95,13 95,13 @@ public class Register extends Literal {
 	}
 
 	@Override
-	public boolean is(Type type) {
-		return type == Type.REGISTER;
+	public boolean is(Expression type) {
+		return type.is(Type.REGISTER);
 	}
 
 	@Override
-	public Expression get(Type type) {
-		if (type == Type.REGISTER)
+	public Expression get(Expression type) {
+		if (type.is(Type.REGISTER))
 			return this;
 		return super.get(type);
 	}

          
M src/main/java/nl/grauw/glass/expressions/SectionContextLiteral.java +4 -4
@@ 15,13 15,13 @@ public class SectionContextLiteral exten
 	}
 
 	@Override
-	public boolean is(Type type) {
-		return type == Type.SECTIONCONTEXT || super.is(type);
+	public boolean is(Expression type) {
+		return type.is(Type.SECTIONCONTEXT) || super.is(type);
 	}
 
 	@Override
-	public Expression get(Type type) {
-		if (type == Type.SECTIONCONTEXT)
+	public Expression get(Expression type) {
+		if (type.is(Type.SECTIONCONTEXT))
 			return this;
 		return super.get(type);
 	}

          
M src/main/java/nl/grauw/glass/expressions/Sequence.java +4 -4
@@ 22,13 22,13 @@ public class Sequence extends BinaryOper
 	}
 
 	@Override
-	public boolean is(Type type) {
-		return type == Type.SEQUENCE;
+	public boolean is(Expression type) {
+		return type.is(Type.SEQUENCE);
 	}
 
 	@Override
-	public Expression get(Type type) {
-		if (type == Type.SEQUENCE)
+	public Expression get(Expression type) {
+		if (type.is(Type.SEQUENCE))
 			return this;
 		return super.get(type);
 	}

          
M src/main/java/nl/grauw/glass/expressions/ShiftLeft.java +2 -2
@@ 12,8 12,8 @@ public class ShiftLeft extends BinaryOpe
 	}
 
 	@Override
-	public Expression get(Type type) {
-		if (type == Type.INTEGER)
+	public Expression get(Expression type) {
+		if (type.is(Type.INTEGER))
 			return IntegerLiteral.of(term1.getInteger() << term2.getInteger());
 		return super.get(type);
 	}

          
M src/main/java/nl/grauw/glass/expressions/ShiftRight.java +2 -2
@@ 12,8 12,8 @@ public class ShiftRight extends BinaryOp
 	}
 
 	@Override
-	public Expression get(Type type) {
-		if (type == Type.INTEGER)
+	public Expression get(Expression type) {
+		if (type.is(Type.INTEGER))
 			return IntegerLiteral.of(term1.getInteger() >> term2.getInteger());
 		return super.get(type);
 	}

          
M src/main/java/nl/grauw/glass/expressions/StringLiteral.java +8 -8
@@ 18,19 18,19 @@ public class StringLiteral extends Liter
 	}
 
 	@Override
-	public boolean is(Type type) {
-		return type == Type.STRING ||
-			(type == Type.INTEGER && string.length() == 1) ||
-			(type == Type.SEQUENCE && string.length() > 1);
+	public boolean is(Expression type) {
+		return type.is(Type.STRING) ||
+			(type.is(Type.INTEGER) && string.length() == 1) ||
+			(type.is(Type.SEQUENCE) && string.length() > 1);
 	}
 
 	@Override
-	public Expression get(Type type) {
-		if (type == Type.STRING)
+	public Expression get(Expression type) {
+		if (type.is(Type.STRING))
 			return this;
-		if (type == Type.INTEGER && string.length() == 1)
+		if (type.is(Type.INTEGER) && string.length() == 1)
 			return new CharacterLiteral(string.charAt(0));
-		if (type == Type.SEQUENCE && string.length() > 1) {
+		if (type.is(Type.SEQUENCE) && string.length() > 1) {
 			Expression tail = new CharacterLiteral(string.charAt(string.length() - 1));
 			for (int i = string.length() - 2; i >= 0; i--)
 				tail = new Sequence(new CharacterLiteral(string.charAt(i)), tail);

          
M src/main/java/nl/grauw/glass/expressions/Subtract.java +5 -5
@@ 20,8 20,8 @@ public class Subtract extends BinaryOper
 	}
 
 	@Override
-	public boolean is(Type type) {
-		if (type == Type.REGISTER) {
+	public boolean is(Expression type) {
+		if (type.is(Type.REGISTER)) {
 			if (term1.is(Type.REGISTER) && term2.is(Type.INTEGER)) {
 				Register register = term1.getRegister();
 				return register.isIndex() && register.isPair();

          
@@ 32,10 32,10 @@ public class Subtract extends BinaryOper
 	}
 
 	@Override
-	public Expression get(Type type) {
-		if (type == Type.INTEGER)
+	public Expression get(Expression type) {
+		if (type.is(Type.INTEGER))
 			return IntegerLiteral.of(term1.getInteger() - term2.getInteger());
-		if (type == Type.REGISTER) {
+		if (type.is(Type.REGISTER)) {
 			if (term1.is(Type.REGISTER) && term2.is(Type.INTEGER)) {
 				Register register = term1.getRegister();
 				if (register.isIndex() && register.isPair()) {

          
M src/main/java/nl/grauw/glass/expressions/Type.java +23 -1
@@ 1,6 1,6 @@ 
 package nl.grauw.glass.expressions;
 
-public class Type {
+public class Type extends Expression {
 
 	public static final Type INTEGER = new Type("Integer");
 	public static final Type STRING = new Type("String");

          
@@ 20,8 20,30 @@ public class Type {
 	}
 
 	@Override
+	public Expression copy(Context context) {
+		return this;
+	}
+
+	@Override
+	public boolean is(Expression type) {
+		return type == this;
+	}
+
+	@Override
+	public Expression get(Expression type) {
+		if (type == this)
+			return this;
+		return super.get(type);
+	}
+
+	@Override
 	public String toString() {
 		return name;
 	}
 
+	@Override
+	public String toDebugString() {
+		return toString();
+	}
+
 }

          
M src/main/java/nl/grauw/glass/expressions/UnaryOperator.java +2 -2
@@ 15,8 15,8 @@ public abstract class UnaryOperator exte
 	}
 
 	@Override
-	public boolean is(Type type) {
-		return type == Type.INTEGER && term.is(type);
+	public boolean is(Expression type) {
+		return type.is(Type.INTEGER) && term.is(type);
 	}
 
 	public String toString() {

          
M src/main/java/nl/grauw/glass/expressions/Xor.java +2 -2
@@ 12,8 12,8 @@ public class Xor extends BinaryOperator 
 	}
 
 	@Override
-	public Expression get(Type type) {
-		if (type == Type.INTEGER)
+	public Expression get(Expression type) {
+		if (type.is(Type.INTEGER))
 			return IntegerLiteral.of(term1.getInteger() ^ term2.getInteger());
 		return super.get(type);
 	}