diff options
Diffstat (limited to 'generator/parser')
-rw-r--r-- | generator/parser/binder.cpp | 15 | ||||
-rw-r--r-- | generator/parser/binder.h | 2 | ||||
-rw-r--r-- | generator/parser/codemodel.cpp | 10 | ||||
-rw-r--r-- | generator/parser/codemodel.h | 4 |
4 files changed, 31 insertions, 0 deletions
diff --git a/generator/parser/binder.cpp b/generator/parser/binder.cpp index 044c6d0..884a724 100644 --- a/generator/parser/binder.cpp +++ b/generator/parser/binder.cpp @@ -281,6 +281,8 @@ void Binder::declare_symbol(SimpleDeclarationAST *node, InitDeclaratorAST *init_ fun->setName(name_cc.name()); fun->setAbstract(init_declarator->initializer != 0); fun->setConstant(declarator->fun_cv != 0); + fun->setException(exceptionSpecToString(declarator->exception_spec)); + fun->setTemplateParameters(_M_current_template_parameters); applyStorageSpecifiers(node->storage_specifiers, model_static_cast<MemberModelItem>(fun)); applyFunctionSpecifiers(node->function_specifiers, fun); @@ -389,6 +391,7 @@ void Binder::visitFunctionDefinition(FunctionDefinitionAST *node) _M_current_function->setFunctionType(_M_current_function_type); _M_current_function->setConstant(declarator->fun_cv != 0); _M_current_function->setTemplateParameters(_M_current_template_parameters); + _M_current_function->setException(exceptionSpecToString(declarator->exception_spec)); applyStorageSpecifiers(node->storage_specifiers, model_static_cast<MemberModelItem>(_M_current_function)); @@ -920,4 +923,16 @@ void Binder::updateItemPosition(CodeModelItem item, AST *node) item->setFileName (filename); } +QString Binder::exceptionSpecToString(ExceptionSpecificationAST* exception_spec) +{ + QString exception; + if (exception_spec) { + const Token &start_token = _M_token_stream->token((int) exception_spec->start_token); + const Token &end_token = _M_token_stream->token((int) exception_spec->end_token); + + exception = QString::fromUtf8(&start_token.text[start_token.position], + (int)(end_token.position - start_token.position)); + } + return exception; +} // kate: space-indent on; indent-width 2; replace-tabs on; diff --git a/generator/parser/binder.h b/generator/parser/binder.h index f8413ca..f87247e 100644 --- a/generator/parser/binder.h +++ b/generator/parser/binder.h @@ -107,6 +107,8 @@ private: void updateItemPosition(CodeModelItem item, AST *node); + QString exceptionSpecToString(ExceptionSpecificationAST *exception_spec); + private: CodeModel *_M_model; LocationManager &_M_location; diff --git a/generator/parser/codemodel.cpp b/generator/parser/codemodel.cpp index 4eb0230..f709ffe 100644 --- a/generator/parser/codemodel.cpp +++ b/generator/parser/codemodel.cpp @@ -660,6 +660,16 @@ void _FunctionModelItem::setFunctionType(CodeModel::FunctionType functionType) _M_functionType = functionType; } +QString _FunctionModelItem::exception() const +{ + return _M_exception; +} + +void _FunctionModelItem::setException(QString exception) +{ + _M_exception = exception; +} + bool _FunctionModelItem::isVariadics() const { return _M_isVariadics; diff --git a/generator/parser/codemodel.h b/generator/parser/codemodel.h index 8878807..999b60d 100644 --- a/generator/parser/codemodel.h +++ b/generator/parser/codemodel.h @@ -541,6 +541,9 @@ public: CodeModel::FunctionType functionType() const; void setFunctionType(CodeModel::FunctionType functionType); + QString exception() const; + void setException(QString); + bool isVirtual() const; void setVirtual(bool isVirtual); @@ -571,6 +574,7 @@ protected: private: ArgumentList _M_arguments; CodeModel::FunctionType _M_functionType; + QString _M_exception; union { struct |