comparison ast/Exp.d @ 107:189c049cbfcc new_gen

Cleanup of codegen, better support for operators a few bugfixes
author Anders Halager <halager@gmail.com>
date Sun, 25 May 2008 14:40:14 +0200
parents 7f9240d4ddc1
children d1f68bfb58ae
comparison
equal deleted inserted replaced
103:09b4d74cb3f5 107:189c049cbfcc
25 AssignExp, 25 AssignExp,
26 CallExp, 26 CallExp,
27 CastExp, 27 CastExp,
28 } 28 }
29 29
30 class Exp 30 abstract class Exp
31 { 31 {
32 this(ExpType expType, SLoc loc) 32 this(ExpType expType, SLoc loc)
33 { 33 {
34 this.expType = expType; 34 this.expType = expType;
35 this.loc = loc; 35 this.loc = loc;
36 } 36 }
37 37
38 /// Get the type of the expression 38 /// Get the type of the expression
39 DType type() { return null; } 39 DType type();
40 40
41 /// Indicates which type the expression is - to avoid a lot of casts 41 /// Indicates which type the expression is - to avoid a lot of casts
42 ExpType expType; 42 ExpType expType;
43 43
44 /// The environment of the expression 44 /// The environment of the expression
57 SourceLocation startLoc() { return loc; } 57 SourceLocation startLoc() { return loc; }
58 58
59 /// Get the full extents of the expression 59 /// Get the full extents of the expression
60 SourceRange sourceRange() { return SourceRange(loc, loc + 1); } 60 SourceRange sourceRange() { return SourceRange(loc, loc + 1); }
61 61
62 Exp simplify() 62 /// Do some simplifications
63 { 63 Exp simplify() { return this; }
64 return this;
65 }
66 } 64 }
67 65
68 class CallExp : Exp 66 class CallExp : Exp
69 { 67 {
70 this(Exp exp, Exp[] args) 68 this(Exp exp, Exp[] args)
282 exp = exp.simplify; 280 exp = exp.simplify;
283 return this; 281 return this;
284 } 282 }
285 283
286 override DType type() 284 override DType type()
287 { 285 {
288 return exp.type().asPointer.pointerOf; 286 return exp.type().asPointer.pointerOf;
289 } 287 }
290 288
291 override SourceRange sourceRange() 289 override SourceRange sourceRange()
292 { 290 {