Ejemplo n.º 1
0
/*
 ‌ didSet-clause → attributes opt didSet setter-name opt code-block
*/
void Parser::parseDidSetClause(const ComputedPropertyPtr& property, bool opt)
{
    Token token;
    if(!peek(token))
        return;
    if(opt && token.type == TokenType::CloseBrace)
        return;
    Attributes attrs;
    parseAttributes(attrs);
    expect(Keyword::DidSet);
    if(match(L"("))
    {
        expect_identifier(token);
        property->setDidSetSetter(token.token);
        expect(L")");
    }
    CodeBlockPtr cb = parseCodeBlock();
    property->setDidSet(cb);
}