2 // Compiler implementation of the D programming language
3 // Copyright (c) 1999-2006 by Digital Mars
5 // written by Walter Bright
6 // http://www.digitalmars.com
7 // License for redistribution is by either the Artistic License
8 // in artistic.txt, or the GNU General Public License in gnu.txt.
9 // See the included readme.txt for details.
11 /* NOTE: This file has been patched from the original DMD distribution to
12 work with the GDC compiler.
14 Modified by David Friedman, December 2006
23 #include "declaration.h"
24 #include "expression.h"
27 static void indent(int indent
)
31 for (i
= 0; i
< indent
; i
++)
35 static char *type_print(Type
*type
)
37 return type
? type
->toChars() : (char *) "null";
40 void dumpExpressions(int i
, Expressions
*exps
)
42 for (size_t j
= 0; j
< exps
->dim
; j
++)
43 { Expression
*e
= (Expression
*)exps
->data
[j
];
52 void Expression::dump(int i
)
55 printf("%p %s type=%s\n", this, Token::toChars(op
), type_print(type
));
58 void IntegerExp::dump(int i
)
61 printf("%p %"PRIdMAX
" type=%s\n", this, (intmax_t)value
, type_print(type
));
64 void IdentifierExp::dump(int i
)
67 printf("%p ident '%s' type=%s\n", this, ident
->toChars(), type_print(type
));
70 void DsymbolExp::dump(int i
)
73 printf("%p %s type=%s\n", this, s
->toChars(), type_print(type
));
76 void VarExp::dump(int i
)
79 printf("%p %s var=%s type=%s\n", this, Token::toChars(op
), var
->toChars(), type_print(type
));
82 void UnaExp::dump(int i
)
85 printf("%p %s type=%s e1=%p\n", this, Token::toChars(op
), type_print(type
), e1
);
90 void CallExp::dump(int i
)
93 dumpExpressions(i
, arguments
);
96 void SliceExp::dump(int i
)
99 printf("%p %s type=%s e1=%p\n", this, Token::toChars(op
), type_print(type
), e1
);
108 void DotIdExp::dump(int i
)
111 printf("%p %s type=%s ident=%s e1=%p\n", this, Token::toChars(op
), type_print(type
), ident
->toChars(), e1
);
116 void DotVarExp::dump(int i
)
119 printf("%p %s type=%s var='%s' e1=%p\n", this, Token::toChars(op
), type_print(type
), var
->toChars(), e1
);
124 void DotTemplateInstanceExp::dump(int i
)
127 printf("%p %s type=%s ti='%s' e1=%p\n", this, Token::toChars(op
), type_print(type
), ti
->toChars(), e1
);
132 void DelegateExp::dump(int i
)
135 printf("%p %s func=%s type=%s e1=%p\n", this, Token::toChars(op
), func
->toChars(), type_print(type
), e1
);
140 void BinExp::dump(int i
)
143 printf("%p %s type=%s e1=%p e2=%p\n", this, Token::toChars(op
), type_print(type
), e1
, e2
);