source: icGREP/icgrep-devel/icgrep/pablo/ps_while.cpp @ 5082

Last change on this file since 5082 was 5037, checked in by nmedfort, 3 years ago

UnicodeSet? bug fix and compile warning clean-up.

File size: 1.1 KB
Line 
1#include <pablo/ps_while.h>
2#include <pablo/codegenstate.h>
3
4namespace pablo {
5
6While::VariantAllocator While::mVariantAllocator;
7
8While::While(PabloAST * expr, const std::initializer_list<Next *> nextVars, PabloBlock * body)
9: Statement(ClassTypeId::While, {expr}, nullptr)
10, mBody(body)
11, mVariant(nextVars.begin(), nextVars.end(), mVariantAllocator) {
12    mBody->setBranch(this);
13    mBody->setParent(getParent());
14    for (Next * variant : nextVars) {
15        variant->addUser(this);
16        this->addUser(variant);
17    }
18}
19
20While::While(PabloAST * expr, const std::vector<Next *> & nextVars, PabloBlock * body)
21: Statement(ClassTypeId::While, {expr}, nullptr)
22, mBody(body)
23, mVariant(nextVars.begin(), nextVars.end(), mVariantAllocator) {
24    mBody->setBranch(this);
25    mBody->setParent(getParent());
26    for (Next * variant : nextVars) {
27        variant->addUser(this);
28        this->addUser(variant);
29    }
30}
31
32PabloBlock * While::setBody(PabloBlock * body) {
33    body->setParent(mBody->getParent());
34    std::swap(mBody, body);
35    body->setParent(nullptr);
36    return body;
37}
38
39}
Note: See TracBrowser for help on using the repository browser.