38 lines
725 B
C++
38 lines
725 B
C++
|
#include "StaticPass.hpp"
|
||
|
|
||
|
namespace jk
|
||
|
{
|
||
|
/*explicit*/ StaticPass::StaticPass(std::shared_ptr<SymTable> sym,
|
||
|
Logger& logger)
|
||
|
: m_sym { sym }
|
||
|
, m_logger { logger }
|
||
|
{
|
||
|
}
|
||
|
|
||
|
/*virtual*/ StaticPass::~StaticPass()
|
||
|
{
|
||
|
}
|
||
|
|
||
|
void StaticPass::pass(std::shared_ptr<Node> node)
|
||
|
{
|
||
|
switch (node->type())
|
||
|
{
|
||
|
case NODE_PROG: {
|
||
|
for (size_t i=0; i<node->size(); i++)
|
||
|
{
|
||
|
pass(node->child(i).lock());
|
||
|
}
|
||
|
} break;
|
||
|
|
||
|
case NODE_FUNCALL: {
|
||
|
|
||
|
} break;
|
||
|
|
||
|
default:
|
||
|
std::cerr << "cannot static_pass unknown node '"
|
||
|
<< NodeTypeStr[node->type()] << "'" << std::endl;
|
||
|
abort();
|
||
|
}
|
||
|
}
|
||
|
}
|