diff gen/dvalue.cpp @ 1180:f5729209a1d4

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.
author Frits van Bommel <fvbommel wxs.nl>
date Tue, 31 Mar 2009 01:18:35 +0200
parents 3cf0066e6faf
children
line wrap: on
line diff
--- a/gen/dvalue.cpp	Mon Mar 30 16:34:36 2009 +0200
+++ b/gen/dvalue.cpp	Tue Mar 31 01:18:35 2009 +0200
@@ -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 @@
 /////////////////////////////////////////////////////////////////////////////////////////////////
 
 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()
 {