1 | #include "ast.hpp" |
---|---|
2 | |
3 | namespace Sass { |
4 | |
5 | #define IMPLEMENT_BASE_CAST(T) \ |
6 | template<> \ |
7 | T* Cast(AST_Node* ptr) { \ |
8 | return dynamic_cast<T*>(ptr); \ |
9 | }; \ |
10 | \ |
11 | template<> \ |
12 | const T* Cast(const AST_Node* ptr) { \ |
13 | return dynamic_cast<const T*>(ptr); \ |
14 | }; \ |
15 | |
16 | IMPLEMENT_BASE_CAST(AST_Node) |
17 | IMPLEMENT_BASE_CAST(Expression) |
18 | IMPLEMENT_BASE_CAST(Statement) |
19 | IMPLEMENT_BASE_CAST(ParentStatement) |
20 | IMPLEMENT_BASE_CAST(PreValue) |
21 | IMPLEMENT_BASE_CAST(Value) |
22 | IMPLEMENT_BASE_CAST(Color) |
23 | IMPLEMENT_BASE_CAST(List) |
24 | IMPLEMENT_BASE_CAST(String) |
25 | IMPLEMENT_BASE_CAST(String_Constant) |
26 | IMPLEMENT_BASE_CAST(SupportsCondition) |
27 | IMPLEMENT_BASE_CAST(Selector) |
28 | IMPLEMENT_BASE_CAST(SelectorComponent) |
29 | IMPLEMENT_BASE_CAST(SimpleSelector) |
30 | |
31 | } |
32 |