Example #1
0
bool Scope::isObjCMethodScope() const
{
    ObjCMethod *m = 0;
    if (_owner && 0 != (m = _owner->asObjCMethod()))
        return m->arguments() != this;
    return false;
}
Example #2
0
bool CheckDeclarator::visit(ObjCMethodPrototypeAST *ast)
{
    FullySpecifiedType returnType = semantic()->check(ast->type_name, _scope);

    unsigned location = ast->firstToken();

    Name *name = semantic()->check(ast->selector, _scope);

    ObjCMethod *method = control()->newObjCMethod(location, name);
    ast->symbol = method;
    method->setSourceLocation(location);
    method->setScope(_scope);
    method->setVisibility(semantic()->currentVisibility());
    method->setReturnType(returnType);

    if (ast->selector && ast->selector->asObjCSelectorWithArguments()) {
        // TODO: add arguments (EV)
        for (ObjCMessageArgumentDeclarationListAST *it = ast->arguments; it; it = it->next) {
            ObjCMessageArgumentDeclarationAST *argDecl = it->argument_declaration;

            semantic()->check(argDecl, method->arguments());
        }

        if (ast->dot_dot_dot_token)
            method->setVariadic(true);
    }

    _fullySpecifiedType = FullySpecifiedType(method);

    // TODO: check which specifiers are allowed here (EV)

    return false;
}