1 /// Author: Aziz Köksal 2 /// License: GPL3 3 /// $(Maturity very high) 4 module dil.ast.Expression; 5 6 import dil.ast.Node; 7 import dil.semantic.Types, 8 dil.semantic.Symbol; 9 import common; 10 11 /// The root class of all expressions. 12 abstract class Expression : Node 13 { 14 Type type; /// The semantic type of this expression. 15 Symbol symbol; /// Semantic symbol. 16 17 /// Returns true if the member 'type' is not null. 18 bool hasType() 19 { 20 return type !is null; 21 } 22 23 /// Returns true if the member 'symbol' is not null. 24 bool hasSymbol() 25 { 26 return symbol !is null; 27 } 28 29 /// Returns true if the expression's type is semantically resolved. 30 /// That is, if the type isn't null and it isn't Types.DontKnowYet. 31 bool isChecked() 32 { 33 return hasType() && type !is Types.DontKnowYet; 34 } 35 36 override abstract Expression copy(); 37 }