Remove some redundancy from the DValue hierarchy: all subclasses had a 'type'

field and identical implementations of virtual function getType().
Move these to DValue itself, and make getType() non-virtual.
This commit is contained in:
Frits van Bommel
2009-03-31 01:18:35 +02:00
parent b602a13811
commit df8547a40f
2 changed files with 14 additions and 31 deletions

View File

@@ -12,18 +12,12 @@
/////////////////////////////////////////////////////////////////////////////////////////////////
DVarValue::DVarValue(Type* t, VarDeclaration* vd, LLValue* llvmValue)
{
var = vd;
val = llvmValue;
type = t;
}
: DValue(t), var(vd), val(llvmValue)
{}
DVarValue::DVarValue(Type* t, LLValue* llvmValue)
{
var = 0;
val = llvmValue;
type = t;
}
: DValue(t), var(0), val(llvmValue)
{}
LLValue* DVarValue::getLVal()
{
@@ -54,12 +48,8 @@ LLValue* DSliceValue::getRVal()
/////////////////////////////////////////////////////////////////////////////////////////////////
DFuncValue::DFuncValue(FuncDeclaration* fd, LLValue* v, LLValue* vt)
{
func = fd;
type = func->type;
val = v;
vthis = vt;
}
: DValue(fd->type), func(fd), val(v), vthis(vt)
{}
LLValue* DFuncValue::getRVal()
{