本文整理汇总了C++中ObjCClass::setEndOffset方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjCClass::setEndOffset方法的具体用法?C++ ObjCClass::setEndOffset怎么用?C++ ObjCClass::setEndOffset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjCClass
的用法示例。
在下文中一共展示了ObjCClass::setEndOffset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: visit
bool CheckDeclaration::visit(ObjCClassDeclarationAST *ast)
{
unsigned sourceLocation;
if (ast->class_name)
sourceLocation = ast->class_name->firstToken();
else
sourceLocation = ast->firstToken();
Name *className = semantic()->check(ast->class_name, _scope);
ObjCClass *klass = control()->newObjCClass(sourceLocation, className);
klass->setStartOffset(tokenAt(ast->firstToken()).offset);
klass->setEndOffset(tokenAt(ast->lastToken()).offset);
ast->symbol = klass;
klass->setInterface(ast->interface_token != 0);
if (ast->category_name) {
Name *categoryName = semantic()->check(ast->category_name, _scope);
klass->setCategoryName(categoryName);
}
if (ast->superclass) {
Name *superClassName = semantic()->check(ast->superclass, _scope);
ObjCBaseClass *superKlass = control()->newObjCBaseClass(ast->superclass->firstToken(), superClassName);
klass->setBaseClass(superKlass);
}
if (ast->protocol_refs && ast->protocol_refs->identifier_list) {
for (IdentifierListAST *iter = ast->protocol_refs->identifier_list; iter; iter = iter->next) {
NameAST* name = iter->name;
Name *protocolName = semantic()->check(name, _scope);
ObjCBaseProtocol *baseProtocol = control()->newObjCBaseProtocol(name->firstToken(), protocolName);
klass->addProtocol(baseProtocol);
}
}
_scope->enterSymbol(klass);
int previousObjCVisibility = semantic()->switchObjCVisibility(Function::Protected);
if (ast->inst_vars_decl) {
for (DeclarationListAST *it = ast->inst_vars_decl->instance_variables; it; it = it->next) {
semantic()->check(it->declaration, klass->members());
}
}
(void) semantic()->switchObjCVisibility(Function::Public);
for (DeclarationListAST *it = ast->member_declarations; it; it = it->next) {
semantic()->check(it->declaration, klass->members());
}
(void) semantic()->switchObjCVisibility(previousObjCVisibility);
return false;
}