forked from qt-creator/qt-creator
Improved ObjC parsing, and added semantic checks.
This commit is contained in:
@@ -69,6 +69,7 @@ public:
|
||||
control(control),
|
||||
skipFunctionBodies(false),
|
||||
visibility(Symbol::Public),
|
||||
ojbcVisibility(Symbol::Protected),
|
||||
methodKey(Function::NormalMethod),
|
||||
checkSpecifier(0),
|
||||
checkDeclaration(0),
|
||||
@@ -92,6 +93,7 @@ public:
|
||||
Control *control;
|
||||
bool skipFunctionBodies;
|
||||
int visibility;
|
||||
int ojbcVisibility;
|
||||
int methodKey;
|
||||
CheckSpecifier *checkSpecifier;
|
||||
CheckDeclaration *checkDeclaration;
|
||||
@@ -132,6 +134,9 @@ FullySpecifiedType Semantic::check(PtrOperatorAST *ptrOperators, FullySpecifiedT
|
||||
Scope *scope)
|
||||
{ return d->checkDeclarator->check(ptrOperators, type, scope); }
|
||||
|
||||
FullySpecifiedType Semantic::check(ObjCMethodPrototypeAST *methodPrototype, Scope *scope)
|
||||
{ return d->checkDeclarator->check(methodPrototype, scope); }
|
||||
|
||||
FullySpecifiedType Semantic::check(ExpressionAST *expression, Scope *scope)
|
||||
{ return d->checkExpression->check(expression, scope); }
|
||||
|
||||
@@ -144,6 +149,9 @@ Name *Semantic::check(NameAST *name, Scope *scope)
|
||||
Name *Semantic::check(NestedNameSpecifierAST *name, Scope *scope)
|
||||
{ return d->checkName->check(name, scope); }
|
||||
|
||||
Name *Semantic::check(ObjCSelectorAST *args, Scope *scope)
|
||||
{ return d->checkName->check(args, scope); }
|
||||
|
||||
bool Semantic::skipFunctionBodies() const
|
||||
{ return d->skipFunctionBodies; }
|
||||
|
||||
@@ -160,6 +168,16 @@ int Semantic::switchVisibility(int visibility)
|
||||
return previousVisibility;
|
||||
}
|
||||
|
||||
int Semantic::currentObjCVisibility() const
|
||||
{ return d->ojbcVisibility; }
|
||||
|
||||
int Semantic::switchObjCVisibility(int visibility)
|
||||
{
|
||||
int previousOjbCVisibility = d->ojbcVisibility;
|
||||
d->ojbcVisibility = visibility;
|
||||
return previousOjbCVisibility;
|
||||
}
|
||||
|
||||
int Semantic::currentMethodKey() const
|
||||
{ return d->methodKey; }
|
||||
|
||||
@@ -186,6 +204,35 @@ int Semantic::visibilityForAccessSpecifier(int tokenKind) const
|
||||
}
|
||||
}
|
||||
|
||||
int Semantic::visibilityForObjCAccessSpecifier(int tokenKind) const
|
||||
{
|
||||
switch (tokenKind) {
|
||||
case T_AT_PUBLIC:
|
||||
return Symbol::Public;
|
||||
case T_AT_PROTECTED:
|
||||
return Symbol::Protected;
|
||||
case T_AT_PRIVATE:
|
||||
return Symbol::Private;
|
||||
case T_AT_PACKAGE:
|
||||
return Symbol::Package;
|
||||
default:
|
||||
return Symbol::Protected;
|
||||
}
|
||||
}
|
||||
|
||||
bool Semantic::isObjCClassMethod(int tokenKind) const
|
||||
{
|
||||
switch (tokenKind) {
|
||||
case T_PLUS:
|
||||
return true;
|
||||
case T_MINUS:
|
||||
return false;
|
||||
default:
|
||||
// TODO EV: assert here?
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
int Semantic::visibilityForClassKey(int tokenKind) const
|
||||
{
|
||||
switch (tokenKind) {
|
||||
|
Reference in New Issue
Block a user