/**
* @file lspstm.cc
* @brief For createSymMap and other functions specific to Lsp in *stm classes.
* @author Supakorn 'Jamie' Rassameemasmuang (jamievlin at outlook.com)
*/
// FIXME: How do we get the position of the actual variable name?
// Right now, we only get the starting position of the type declaration
declCtx->symMap.varDec.emplace(
std::piecewise_construct, std::forward_as_tuple(varName),
std::forward_as_tuple(
varName, static_cast<std::string>(*start),
start->getPos().LineColumn()
)
);
set->createSymMap(symContext);
body->createSymMap(declCtx);
}
if (onFalse) {
onFalse->createSymMap(symContext);
}
}
DEC_CREATE_SYM_MAP_FUNCTION_STM(whileStm)
{
// while (<xyz>) { <body> }
// the <xyz> part belongs in the main context as the while statement,
// as it cannot declare new variables and only knows the symbols from that
// context.
test->createSymMap(symContext);
// for the body part, { <body> } are encapsulated in
// the blockStm, while <body> are direct statements.
// If the while block does not use { <body> }, then the body
// can be considered the same context as it cannot declare new variables and
// again, can only uses the variable already known before this while
// statement.