summaryrefslogtreecommitdiff
path: root/src/shared/cplusplus/CheckDeclaration.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/cplusplus/CheckDeclaration.cpp')
-rw-r--r--src/shared/cplusplus/CheckDeclaration.cpp270
1 files changed, 165 insertions, 105 deletions
diff --git a/src/shared/cplusplus/CheckDeclaration.cpp b/src/shared/cplusplus/CheckDeclaration.cpp
index 1e7afdd166..c6f747d3dd 100644
--- a/src/shared/cplusplus/CheckDeclaration.cpp
+++ b/src/shared/cplusplus/CheckDeclaration.cpp
@@ -56,6 +56,7 @@
#include "Symbols.h"
#include "Control.h"
#include "Literals.h"
+#include <string>
#include <cassert>
using namespace CPlusPlus;
@@ -136,7 +137,7 @@ unsigned CheckDeclaration::locationOfDeclaratorId(DeclaratorAST *declarator) con
bool CheckDeclaration::visit(SimpleDeclarationAST *ast)
{
- FullySpecifiedType ty = semantic()->check(ast->decl_specifier_seq, _scope);
+ FullySpecifiedType ty = semantic()->check(ast->decl_specifier_list, _scope);
FullySpecifiedType qualTy = ty.qualifiedType();
if (_templateParameters && ty) {
@@ -145,15 +146,15 @@ bool CheckDeclaration::visit(SimpleDeclarationAST *ast)
}
}
- if (! ast->declarators && ast->decl_specifier_seq && ! ast->decl_specifier_seq->next) {
- if (ElaboratedTypeSpecifierAST *elab_type_spec = ast->decl_specifier_seq->asElaboratedTypeSpecifier()) {
+ if (! ast->declarator_list && ast->decl_specifier_list && ! ast->decl_specifier_list->next) {
+ if (ElaboratedTypeSpecifierAST *elab_type_spec = ast->decl_specifier_list->value->asElaboratedTypeSpecifier()) {
unsigned sourceLocation = elab_type_spec->firstToken();
if (elab_type_spec->name)
sourceLocation = elab_type_spec->name->firstToken();
- Name *name = semantic()->check(elab_type_spec->name, _scope);
+ const Name *name = semantic()->check(elab_type_spec->name, _scope);
ForwardClassDeclaration *symbol =
control()->newForwardClassDeclaration(sourceLocation, name);
@@ -169,17 +170,20 @@ bool CheckDeclaration::visit(SimpleDeclarationAST *ast)
const bool isQ_SLOT = ast->qt_invokable_token && tokenKind(ast->qt_invokable_token) == T_Q_SLOT;
const bool isQ_SIGNAL = ast->qt_invokable_token && tokenKind(ast->qt_invokable_token) == T_Q_SIGNAL;
+#ifdef ICHECK_BUILD
+ const bool isQ_INVOKABLE = (ast->invoke_token > 0);
+#endif
List<Declaration *> **decl_it = &ast->symbols;
- for (DeclaratorListAST *it = ast->declarators; it; it = it->next) {
- Name *name = 0;
- FullySpecifiedType declTy = semantic()->check(it->declarator, qualTy,
+ for (DeclaratorListAST *it = ast->declarator_list; it; it = it->next) {
+ const Name *name = 0;
+ FullySpecifiedType declTy = semantic()->check(it->value, qualTy,
_scope, &name);
- unsigned location = locationOfDeclaratorId(it->declarator);
+ unsigned location = locationOfDeclaratorId(it->value);
if (! location) {
- if (it->declarator)
- location = it->declarator->firstToken();
+ if (it->value)
+ location = it->value->firstToken();
else
location = ast->firstToken();
}
@@ -195,6 +199,10 @@ bool CheckDeclaration::visit(SimpleDeclarationAST *ast)
fun->setMethodKey(Function::SignalMethod);
else if (isQ_SLOT)
fun->setMethodKey(Function::SlotMethod);
+#ifdef ICHECK_BUILD
+ else if (isQ_INVOKABLE)
+ fun->setInvokable(true);
+#endif
fun->setVisibility(semantic()->currentVisibility());
} else if (semantic()->currentMethodKey() != Function::NormalMethod) {
translationUnit()->warning(ast->firstToken(),
@@ -208,7 +216,7 @@ bool CheckDeclaration::visit(SimpleDeclarationAST *ast)
symbol->setType(control()->integerType(IntegerType::Int));
symbol->setType(declTy);
- if (_templateParameters && it == ast->declarators && ty && ! ty->isClassType())
+ if (_templateParameters && it == ast->declarator_list && ty && ! ty->isClassType())
symbol->setTemplateParameters(_templateParameters);
symbol->setVisibility(semantic()->currentVisibility());
@@ -226,8 +234,8 @@ bool CheckDeclaration::visit(SimpleDeclarationAST *ast)
else if (ty.isTypedef())
symbol->setStorage(Symbol::Typedef);
- if (it->declarator && it->declarator->initializer) {
- FullySpecifiedType initTy = semantic()->check(it->declarator->initializer, _scope);
+ if (it->value && it->value->initializer) {
+ FullySpecifiedType initTy = semantic()->check(it->value->initializer, _scope);
}
*decl_it = new (translationUnit()->memoryPool()) List<Declaration *>();
@@ -258,6 +266,28 @@ bool CheckDeclaration::visit(AccessDeclarationAST *ast)
return false;
}
+#ifdef ICHECK_BUILD
+bool CheckDeclaration::visit(QPropertyDeclarationAST *)
+{
+ return false;
+}
+
+bool CheckDeclaration::visit(QEnumDeclarationAST *)
+{
+ return false;
+}
+
+bool CheckDeclaration::visit(QFlagsDeclarationAST *)
+{
+ return false;
+}
+
+bool CheckDeclaration::visit(QDeclareFlagsDeclarationAST *)
+{
+ return false;
+}
+#endif
+
bool CheckDeclaration::visit(AsmDefinitionAST *)
{
return false;
@@ -265,10 +295,10 @@ bool CheckDeclaration::visit(AsmDefinitionAST *)
bool CheckDeclaration::visit(ExceptionDeclarationAST *ast)
{
- FullySpecifiedType ty = semantic()->check(ast->type_specifier, _scope);
+ FullySpecifiedType ty = semantic()->check(ast->type_specifier_list, _scope);
FullySpecifiedType qualTy = ty.qualifiedType();
- Name *name = 0;
+ const Name *name = 0;
FullySpecifiedType declTy = semantic()->check(ast->declarator, qualTy,
_scope, &name);
@@ -291,9 +321,9 @@ bool CheckDeclaration::visit(ExceptionDeclarationAST *ast)
bool CheckDeclaration::visit(FunctionDefinitionAST *ast)
{
- FullySpecifiedType ty = semantic()->check(ast->decl_specifier_seq, _scope);
+ FullySpecifiedType ty = semantic()->check(ast->decl_specifier_list, _scope);
FullySpecifiedType qualTy = ty.qualifiedType();
- Name *name = 0;
+ const Name *name = 0;
FullySpecifiedType funTy = semantic()->check(ast->declarator, qualTy,
_scope, &name);
if (! (funTy && funTy->isFunctionType())) {
@@ -315,11 +345,18 @@ bool CheckDeclaration::visit(FunctionDefinitionAST *ast)
const bool isQ_SLOT = ast->qt_invokable_token && tokenKind(ast->qt_invokable_token) == T_Q_SLOT;
const bool isQ_SIGNAL = ast->qt_invokable_token && tokenKind(ast->qt_invokable_token) == T_Q_SIGNAL;
+#ifdef ICHECK_BUILD
+ const bool isQ_INVOKABLE = (ast->invoke_token > 0);
+#endif
if (isQ_SIGNAL)
fun->setMethodKey(Function::SignalMethod);
else if (isQ_SLOT)
fun->setMethodKey(Function::SlotMethod);
+#ifdef ICHECK_BUILD
+ else if (isQ_INVOKABLE)
+ fun->setInvokable(true);
+#endif
checkFunctionArguments(fun);
@@ -356,14 +393,16 @@ bool CheckDeclaration::visit(FunctionDefinitionAST *ast)
bool CheckDeclaration::visit(MemInitializerAST *ast)
{
(void) semantic()->check(ast->name, _scope);
- FullySpecifiedType ty = semantic()->check(ast->expression, _scope);
+ for (ExpressionListAST *it = ast->expression_list; it; it = it->next) {
+ FullySpecifiedType ty = semantic()->check(it->value, _scope);
+ }
return false;
}
bool CheckDeclaration::visit(LinkageBodyAST *ast)
{
- for (DeclarationListAST *decl = ast->declarations; decl; decl = decl->next) {
- semantic()->check(decl->declaration, _scope);
+ for (DeclarationListAST *decl = ast->declaration_list; decl; decl = decl->next) {
+ semantic()->check(decl->value, _scope);
}
return false;
}
@@ -376,8 +415,9 @@ bool CheckDeclaration::visit(LinkageSpecificationAST *ast)
bool CheckDeclaration::visit(NamespaceAST *ast)
{
- Identifier *id = identifier(ast->identifier_token);
- Name *namespaceName = control()->nameId(id);
+ const Name *namespaceName = 0;
+ if (const Identifier *id = identifier(ast->identifier_token))
+ namespaceName = control()->nameId(id);
unsigned sourceLocation = ast->firstToken();
@@ -409,15 +449,26 @@ bool CheckDeclaration::visit(ParameterDeclarationAST *ast)
sourceLocation = ast->firstToken();
}
- Name *argName = 0;
- FullySpecifiedType ty = semantic()->check(ast->type_specifier, _scope);
+ const Name *argName = 0;
+ FullySpecifiedType ty = semantic()->check(ast->type_specifier_list, _scope);
FullySpecifiedType argTy = semantic()->check(ast->declarator, ty.qualifiedType(),
_scope, &argName);
FullySpecifiedType exprTy = semantic()->check(ast->expression, _scope);
Argument *arg = control()->newArgument(sourceLocation, argName);
ast->symbol = arg;
- if (ast->expression)
- arg->setInitializer(true);
+ if (ast->expression) {
+ unsigned startOfExpression = ast->expression->firstToken();
+ unsigned endOfExpression = ast->expression->lastToken();
+ std::string buffer;
+ for (unsigned index = startOfExpression; index != endOfExpression; ++index) {
+ const Token &tk = tokenAt(index);
+ if (tk.whitespace() || tk.newline())
+ buffer += ' ';
+ buffer += tk.spell();
+ }
+ const StringLiteral *initializer = control()->findOrInsertStringLiteral(buffer.c_str(), buffer.size());
+ arg->setInitializer(initializer);
+ }
arg->setType(argTy);
_scope->enterSymbol(arg);
return false;
@@ -427,8 +478,8 @@ bool CheckDeclaration::visit(TemplateDeclarationAST *ast)
{
Scope *scope = new Scope(_scope->owner());
- for (DeclarationListAST *param = ast->template_parameters; param; param = param->next) {
- semantic()->check(param->declaration, scope);
+ for (DeclarationListAST *param = ast->template_parameter_list; param; param = param->next) {
+ semantic()->check(param->value, scope);
}
semantic()->check(ast->declaration, _scope,
@@ -443,8 +494,10 @@ bool CheckDeclaration::visit(TypenameTypeParameterAST *ast)
if (ast->name)
sourceLocation = ast->name->firstToken();
- Name *name = semantic()->check(ast->name, _scope);
- Argument *arg = control()->newArgument(sourceLocation, name); // ### new template type
+ const Name *name = semantic()->check(ast->name, _scope);
+ TypenameArgument *arg = control()->newTypenameArgument(sourceLocation, name);
+ FullySpecifiedType ty = semantic()->check(ast->type_id, _scope);
+ arg->setType(ty);
ast->symbol = arg;
_scope->enterSymbol(arg);
return false;
@@ -456,8 +509,10 @@ bool CheckDeclaration::visit(TemplateTypeParameterAST *ast)
if (ast->name)
sourceLocation = ast->name->firstToken();
- Name *name = semantic()->check(ast->name, _scope);
- Argument *arg = control()->newArgument(sourceLocation, name); // ### new template type
+ const Name *name = semantic()->check(ast->name, _scope);
+ TypenameArgument *arg = control()->newTypenameArgument(sourceLocation, name);
+ FullySpecifiedType ty = semantic()->check(ast->type_id, _scope);
+ arg->setType(ty);
ast->symbol = arg;
_scope->enterSymbol(arg);
return false;
@@ -465,7 +520,7 @@ bool CheckDeclaration::visit(TemplateTypeParameterAST *ast)
bool CheckDeclaration::visit(UsingAST *ast)
{
- Name *name = semantic()->check(ast->name, _scope);
+ const Name *name = semantic()->check(ast->name, _scope);
unsigned sourceLocation = ast->firstToken();
if (ast->name)
@@ -479,7 +534,7 @@ bool CheckDeclaration::visit(UsingAST *ast)
bool CheckDeclaration::visit(UsingDirectiveAST *ast)
{
- Name *name = semantic()->check(ast->name, _scope);
+ const Name *name = semantic()->check(ast->name, _scope);
unsigned sourceLocation = ast->firstToken();
if (ast->name)
@@ -501,14 +556,14 @@ bool CheckDeclaration::visit(ObjCProtocolForwardDeclarationAST *ast)
const unsigned sourceLocation = ast->firstToken();
List<ObjCForwardProtocolDeclaration *> **symbolIter = &ast->symbols;
- for (IdentifierListAST *it = ast->identifier_list; it; it = it->next) {
+ for (ObjCIdentifierListAST *it = ast->identifier_list; it; it = it->next) {
unsigned declarationLocation;
- if (it->name)
- declarationLocation = it->name->firstToken();
+ if (it->value)
+ declarationLocation = it->value->firstToken();
else
declarationLocation = sourceLocation;
- Name *protocolName = semantic()->check(it->name, _scope);
+ const Name *protocolName = semantic()->check(it->value, _scope);
ObjCForwardProtocolDeclaration *fwdProtocol = control()->newObjCForwardProtocolDeclaration(sourceLocation, protocolName);
fwdProtocol->setStartOffset(tokenAt(ast->firstToken()).offset);
fwdProtocol->setEndOffset(tokenAt(ast->lastToken()).offset);
@@ -531,23 +586,23 @@ bool CheckDeclaration::visit(ObjCProtocolDeclarationAST *ast)
else
sourceLocation = ast->firstToken();
- Name *protocolName = semantic()->check(ast->name, _scope);
+ const Name *protocolName = semantic()->check(ast->name, _scope);
ObjCProtocol *protocol = control()->newObjCProtocol(sourceLocation, protocolName);
protocol->setStartOffset(tokenAt(ast->firstToken()).offset);
protocol->setEndOffset(tokenAt(ast->lastToken()).offset);
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);
+ for (ObjCIdentifierListAST *iter = ast->protocol_refs->identifier_list; iter; iter = iter->next) {
+ NameAST* name = iter->value;
+ const Name *protocolName = semantic()->check(name, _scope);
ObjCBaseProtocol *baseProtocol = control()->newObjCBaseProtocol(name->firstToken(), protocolName);
protocol->addProtocol(baseProtocol);
}
}
int previousObjCVisibility = semantic()->switchObjCVisibility(Function::Public);
- for (DeclarationListAST *it = ast->member_declarations; it; it = it->next) {
- semantic()->check(it->declaration, protocol->members());
+ for (DeclarationListAST *it = ast->member_declaration_list; it; it = it->next) {
+ semantic()->check(it->value, protocol->members());
}
(void) semantic()->switchObjCVisibility(previousObjCVisibility);
@@ -562,14 +617,14 @@ bool CheckDeclaration::visit(ObjCClassForwardDeclarationAST *ast)
const unsigned sourceLocation = ast->firstToken();
List<ObjCForwardClassDeclaration *> **symbolIter = &ast->symbols;
- for (IdentifierListAST *it = ast->identifier_list; it; it = it->next) {
+ for (ObjCIdentifierListAST *it = ast->identifier_list; it; it = it->next) {
unsigned declarationLocation;
- if (it->name)
- declarationLocation = it->name->firstToken();
+ if (it->value)
+ declarationLocation = it->value->firstToken();
else
declarationLocation = sourceLocation;
- Name *className = semantic()->check(it->name, _scope);
+ const Name *className = semantic()->check(it->value, _scope);
ObjCForwardClassDeclaration *fwdClass = control()->newObjCForwardClassDeclaration(sourceLocation, className);
fwdClass->setStartOffset(tokenAt(ast->firstToken()).offset);
fwdClass->setEndOffset(tokenAt(ast->lastToken()).offset);
@@ -592,7 +647,7 @@ bool CheckDeclaration::visit(ObjCClassDeclarationAST *ast)
else
sourceLocation = ast->firstToken();
- Name *className = semantic()->check(ast->class_name, _scope);
+ const 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);
@@ -601,20 +656,20 @@ bool CheckDeclaration::visit(ObjCClassDeclarationAST *ast)
klass->setInterface(ast->interface_token != 0);
if (ast->category_name) {
- Name *categoryName = semantic()->check(ast->category_name, _scope);
+ const Name *categoryName = semantic()->check(ast->category_name, _scope);
klass->setCategoryName(categoryName);
}
if (ast->superclass) {
- Name *superClassName = semantic()->check(ast->superclass, _scope);
+ const 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);
+ for (ObjCIdentifierListAST *iter = ast->protocol_refs->identifier_list; iter; iter = iter->next) {
+ NameAST* name = iter->value;
+ const Name *protocolName = semantic()->check(name, _scope);
ObjCBaseProtocol *baseProtocol = control()->newObjCBaseProtocol(name->firstToken(), protocolName);
klass->addProtocol(baseProtocol);
}
@@ -625,15 +680,15 @@ bool CheckDeclaration::visit(ObjCClassDeclarationAST *ast)
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());
+ for (DeclarationListAST *it = ast->inst_vars_decl->instance_variable_list; it; it = it->next) {
+ semantic()->check(it->value, klass->members());
}
}
(void) semantic()->switchObjCVisibility(Function::Public);
- for (DeclarationListAST *it = ast->member_declarations; it; it = it->next) {
- semantic()->check(it->declaration, klass->members());
+ for (DeclarationListAST *it = ast->member_declaration_list; it; it = it->next) {
+ semantic()->check(it->value, klass->members());
}
(void) semantic()->switchObjCVisibility(previousObjCVisibility);
@@ -647,30 +702,28 @@ bool CheckDeclaration::visit(ObjCMethodDeclarationAST *ast)
return false;
FullySpecifiedType ty = semantic()->check(ast->method_prototype, _scope);
- ObjCMethod *methodType = ty.type()->asObjCMethodType();
- if (!methodType)
+ ObjCMethod *methodTy = ty.type()->asObjCMethodType();
+ if (!methodTy)
return false;
Symbol *symbol;
if (ast->function_body) {
if (!semantic()->skipFunctionBodies()) {
- semantic()->check(ast->function_body, methodType->members());
+ semantic()->check(ast->function_body, methodTy->members());
}
- symbol = methodType;
+ symbol = methodTy;
} else {
- Declaration *decl = control()->newDeclaration(ast->firstToken(), methodType->name());
- decl->setType(methodType);
+ Declaration *decl = control()->newDeclaration(ast->firstToken(), methodTy->name());
+ decl->setType(methodTy);
symbol = decl;
+ symbol->setStorage(methodTy->storage());
}
symbol->setStartOffset(tokenAt(ast->firstToken()).offset);
symbol->setEndOffset(tokenAt(ast->lastToken()).offset);
symbol->setVisibility(semantic()->currentVisibility());
- if (semantic()->isObjCClassMethod(ast->method_prototype->method_type_token))
- symbol->setStorage(Symbol::Static);
-
_scope->enterSymbol(symbol);
return false;
@@ -684,21 +737,6 @@ bool CheckDeclaration::visit(ObjCVisibilityDeclarationAST *ast)
return false;
}
-enum PropertyAttributes {
- None = 0,
- Assign = 1 << 0,
- Retain = 1 << 1,
- Copy = 1 << 2,
- ReadOnly = 1 << 3,
- ReadWrite = 1 << 4,
- Getter = 1 << 5,
- Setter = 1 << 6,
- NonAtomic = 1 << 7,
-
- WritabilityMask = ReadOnly | ReadWrite,
- SetterSemanticsMask = Assign | Retain | Copy,
-};
-
bool CheckDeclaration::checkPropertyAttribute(ObjCPropertyAttributeAST *attrAst,
int &flags,
int attr)
@@ -716,54 +754,76 @@ bool CheckDeclaration::checkPropertyAttribute(ObjCPropertyAttributeAST *attrAst,
bool CheckDeclaration::visit(ObjCPropertyDeclarationAST *ast)
{
- int propAttrs = None;
+ semantic()->check(ast->simple_declaration, _scope);
+ SimpleDeclarationAST *simpleDecl = ast->simple_declaration->asSimpleDeclaration();
+
+ if (!simpleDecl) {
+ translationUnit()->warning(ast->simple_declaration->firstToken(),
+ "invalid type for property declaration");
+ return false;
+ }
- for (ObjCPropertyAttributeListAST *iter= ast->property_attributes; iter; iter = iter->next) {
- ObjCPropertyAttributeAST *attrAst = iter->attr;
+ int propAttrs = ObjCPropertyDeclaration::None;
+ const Name *getterName = 0, *setterName = 0;
+
+ for (ObjCPropertyAttributeListAST *iter= ast->property_attribute_list; iter; iter = iter->next) {
+ ObjCPropertyAttributeAST *attrAst = iter->value;
if (!attrAst)
continue;
- Identifier *attrId = identifier(attrAst->attribute_identifier_token);
+ const Identifier *attrId = identifier(attrAst->attribute_identifier_token);
if (attrId == control()->objcGetterId()) {
- if (checkPropertyAttribute(attrAst, propAttrs, Getter)) {
- // TODO: find method declaration for getter
+ if (checkPropertyAttribute(attrAst, propAttrs, ObjCPropertyDeclaration::Getter)) {
+ getterName = semantic()->check(attrAst->method_selector, _scope);
}
} else if (attrId == control()->objcSetterId()) {
- if (checkPropertyAttribute(attrAst, propAttrs, Setter)) {
- // TODO: find method declaration for setter
+ if (checkPropertyAttribute(attrAst, propAttrs, ObjCPropertyDeclaration::Setter)) {
+ setterName = semantic()->check(attrAst->method_selector, _scope);
}
} else if (attrId == control()->objcReadwriteId()) {
- checkPropertyAttribute(attrAst, propAttrs, ReadWrite);
+ checkPropertyAttribute(attrAst, propAttrs, ObjCPropertyDeclaration::ReadWrite);
} else if (attrId == control()->objcReadonlyId()) {
- checkPropertyAttribute(attrAst, propAttrs, ReadOnly);
+ checkPropertyAttribute(attrAst, propAttrs, ObjCPropertyDeclaration::ReadOnly);
} else if (attrId == control()->objcAssignId()) {
- checkPropertyAttribute(attrAst, propAttrs, Assign);
+ checkPropertyAttribute(attrAst, propAttrs, ObjCPropertyDeclaration::Assign);
} else if (attrId == control()->objcRetainId()) {
- checkPropertyAttribute(attrAst, propAttrs, Retain);
+ checkPropertyAttribute(attrAst, propAttrs, ObjCPropertyDeclaration::Retain);
} else if (attrId == control()->objcCopyId()) {
- checkPropertyAttribute(attrAst, propAttrs, Copy);
+ checkPropertyAttribute(attrAst, propAttrs, ObjCPropertyDeclaration::Copy);
} else if (attrId == control()->objcNonatomicId()) {
- checkPropertyAttribute(attrAst, propAttrs, NonAtomic);
+ checkPropertyAttribute(attrAst, propAttrs, ObjCPropertyDeclaration::NonAtomic);
}
}
- if (propAttrs & ReadOnly && propAttrs & ReadWrite)
+ if (propAttrs & ObjCPropertyDeclaration::ReadOnly &&
+ propAttrs & ObjCPropertyDeclaration::ReadWrite)
// Should this be an error instead of only a warning?
translationUnit()->warning(ast->property_token,
"property can have at most one attribute \"readonly\" or \"readwrite\" specified");
- int setterSemAttrs = propAttrs & SetterSemanticsMask;
+ int setterSemAttrs = propAttrs & ObjCPropertyDeclaration::SetterSemanticsMask;
if (setterSemAttrs
- && setterSemAttrs != Assign
- && setterSemAttrs != Retain
- && setterSemAttrs != Copy) {
+ && setterSemAttrs != ObjCPropertyDeclaration::Assign
+ && setterSemAttrs != ObjCPropertyDeclaration::Retain
+ && setterSemAttrs != ObjCPropertyDeclaration::Copy) {
// Should this be an error instead of only a warning?
translationUnit()->warning(ast->property_token,
"property can have at most one attribute \"assign\", \"retain\", or \"copy\" specified");
}
- // TODO: Check if the next line is correct (EV)
- semantic()->check(ast->simple_declaration, _scope);
+ List<ObjCPropertyDeclaration *> **lastSymbols = &ast->symbols;
+ for (List<Declaration*> *iter = simpleDecl->symbols; iter; iter = iter->next) {
+ ObjCPropertyDeclaration *propDecl = control()->newObjCPropertyDeclaration(ast->firstToken(),
+ iter->value->name());
+ propDecl->setType(iter->value->type());
+ propDecl->setAttributes(propAttrs);
+ propDecl->setGetterName(getterName);
+ propDecl->setSetterName(setterName);
+ _scope->enterSymbol(propDecl);
+
+ *lastSymbols = new (translationUnit()->memoryPool()) List<ObjCPropertyDeclaration *>();
+ (*lastSymbols)->value = propDecl;
+ lastSymbols = &(*lastSymbols)->next;
+ }
+
return false;
}
-
-