| 31 | } |
| 32 | |
| 33 | ASTNode* ASTNode::Copy() const |
| 34 | { |
| 35 | ASTNode* result = new ASTNode( m_nodeType, m_location, m_scope, &m_token ); |
| 36 | result->m_symbol = m_symbol; |
| 37 | result->m_type = m_type; |
| 38 | for( auto it = m_children.begin(); it != m_children.end(); ++it ) |
| 39 | { |
| 40 | if( *it ) |
| 41 | { |
| 42 | result->m_children.push_back( ( *it )->Copy() ); |
| 43 | } |
| 44 | else |
| 45 | { |
| 46 | result->m_children.push_back( nullptr ); |
| 47 | } |
| 48 | } |
| 49 | return result; |
| 50 | } |
| 51 | |
| 52 | void ASTNode::AddChild( ASTNode* child ) |
| 53 | { |
no test coverage detected