diff options
Diffstat (limited to 'parser.d')
| -rw-r--r-- | parser.d | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -34,6 +34,8 @@ abstract class Form { bool evaluate; int line; + ValueType returnType = ValueType.ANY; + //ubyte compile(Chunk chunk); //ubyte[] asBytecode(); //abstract void compile(Chunk chunk); @@ -170,6 +172,7 @@ class And : Form { this(int line) { this.line = line; this.type = FormType.AND; + this.returnType = ValueType.BOOLEAN; } void addClause(Form clause) { @@ -184,6 +187,7 @@ class Or : Form { this(int line) { this.line = line; this.type = FormType.OR; + this.returnType = ValueType.BOOLEAN; } void addClause(Form clause) { @@ -240,6 +244,7 @@ class Atom : Form { this.line = line; this.type = FormType.ATOM; this.evaluate = false; + this.returnType = this.value.type; } this(double value, int line) { @@ -247,6 +252,7 @@ class Atom : Form { this.line = line; this.type = FormType.ATOM; this.evaluate = false; + this.returnType = this.value.type; } this(bool value, int line) { @@ -254,6 +260,7 @@ class Atom : Form { this.line = line; this.type = FormType.ATOM; this.evaluate = false; + this.returnType = this.value.type; } } @@ -264,6 +271,8 @@ enum ValueType { BOOLEAN, TYPE, OBJ, + ANY, + NIL, } union As { |
