42
42
* Tree node representing an inline assembly block.
43
43
* Example: \code asm { movl ecx eax } \endcode */
44
44
class CT_AsmBlock : public CT_Statement {
45
CTree *sons[3]; // key, begin, end
51
49
* \param k The keyword 'asm'.
52
50
* \param b Left brace.
53
51
* \param e Right brace. */
54
CT_AsmBlock (CTree *k, CTree *b, CTree *e) :
55
_key (k), _begin (b), _end (e) {}
52
CT_AsmBlock (CTree *k, CTree *b, CTree *e) {
53
AddSon (sons[0], k); AddSon (sons[1], b); AddSon (sons[2], e);
56
55
/** Get the identifier for this node type. Can be compared with NodeName(). */
57
56
static const char *NodeId ();
58
57
/** Get the name of the node. Can be compared with NodeId(). */
59
58
const char *NodeName () const { return NodeId (); }
60
59
/** Get the number of sons. */
61
virtual int Sons () const { return 3; }
60
int Sons () const { return 3; }
62
61
/** Get the n-th son.
63
62
* \param n The index of the son.
64
63
* \return The n-th son or NULL. */
65
virtual CTree *Son (int n) const {
68
case 1: return _begin;
70
default: return (CTree*)0;
64
CTree *Son (int n) const { return CTree::Son (sons, 3, n); }
74
66
* \param old_son The son to replace.
75
67
* \param new_son The new son. */
76
68
virtual void ReplaceSon (CTree *old_son, CTree *new_son) {
77
if (old_son == _key) _key = new_son;
78
else if (old_son == _begin) _begin = new_son;
79
else if (old_son == _end) _end = new_son;
69
CTree::ReplaceSon (sons, 3, old_son, new_son);