Ejemplo n.º 1
0
/*
  GRAMMAR OF A DEINITIALIZER DECLARATION
 
 ‌ deinitializer-declaration → attributes opt deinit code-block
*/
DeclarationPtr Parser::parseDeinit(const std::vector<AttributePtr>& attrs)
{
    Token token;
    expect(Keyword::Deinit, token);
    DeinitializerDefPtr ret = nodeFactory->createDeinitializer(token.state);
    ret->setAttributes(attrs);
    CodeBlockPtr body = parseCodeBlock();
    ret->setBody(body);
    return ret;
}
Ejemplo n.º 2
0
USE_SWALLOW_NS


#define ACCEPT(node) do { \
        Node* n = node.get(); \
        if(n) { \
            n->accept(this); \
        } \
    } while(0);

void NodeVisitor::visitDeinit(const DeinitializerDefPtr& node)
{
    ACCEPT(node->getBody());
}
Ejemplo n.º 3
0
void FunctionAnalyzer::visitDeinit(const DeinitializerDefPtr& node)
{
    TypePtr funcType = ctx->currentType->getDeinit()->getType();
    SCOPED_SET(ctx->currentFunction, funcType);
    node->getBody()->accept(semanticAnalyzer);
}