Esempio n. 1
0
void FunctionAnalyzer::visitComputedProperty(const ComputedPropertyPtr& node)
{
    CodeBlockPtr didSet = node->getDidSet();
    CodeBlockPtr willSet = node->getWillSet();
    CodeBlockPtr getter = node->getGetter();
    CodeBlockPtr setter = node->getSetter();
    TypePtr type = declarationAnalyzer->resolveType(node->getDeclaredType(), true);
    assert(type != nullptr);

    shared_ptr<ComposedComputedProperty> property = static_pointer_cast<ComposedComputedProperty>(node);
    //prepare type for getter/setter
    /*
    std::vector<Parameter> params;
    TypePtr getterType = Type::newFunction(params, type, nullptr);
    params.push_back(Parameter(type));
    TypePtr setterType = Type::newFunction(params, symbolRegistry->getGlobalScope()->Void(), false);

    */
    SCOPED_SET(ctx->flags, (ctx->flags & (~SemanticContext::FLAG_PROCESS_DECLARATION)) | SemanticContext::FLAG_PROCESS_IMPLEMENTATION);
    if(!property->hasModifier(DeclarationModifiers::_Generated))
    {
        if(property->functions.getter)
            property->functions.getter->accept(semanticAnalyzer);
        if(property->functions.setter)
            property->functions.setter->accept(semanticAnalyzer);
        if(property->functions.willSet)
            property->functions.willSet->accept(semanticAnalyzer);
        if(property->functions.didSet)
            property->functions.didSet->accept(semanticAnalyzer);
    }
}
Esempio n. 2
0
void NodeVisitor::visitComputedProperty(const ComputedPropertyPtr& node)
{
    ACCEPT(node->getInitializer());
    ACCEPT(node->getGetter());
    ACCEPT(node->getSetter());
    ACCEPT(node->getWillSet());
    ACCEPT(node->getDidSet());
}