Changeset View
Changeset View
Standalone View
Standalone View
duchain/builders/declarationbuilder.cpp
Show First 20 Lines • Show All 773 Lines • ▼ Show 20 Line(s) | 773 | { | |||
---|---|---|---|---|---|
774 | AbstractFunctionDeclaration* funDec = dynamic_cast<AbstractFunctionDeclaration*>(currentDeclaration()); | 774 | AbstractFunctionDeclaration* funDec = dynamic_cast<AbstractFunctionDeclaration*>(currentDeclaration()); | ||
775 | Q_ASSERT(funDec); | 775 | Q_ASSERT(funDec); | ||
776 | 776 | | |||
777 | if (node->defaultValue) { | 777 | if (node->defaultValue) { | ||
778 | QString symbol = m_editor->parseSession()->symbol(node->defaultValue); | 778 | QString symbol = m_editor->parseSession()->symbol(node->defaultValue); | ||
779 | funDec->addDefaultParameter(IndexedString(symbol)); | 779 | funDec->addDefaultParameter(IndexedString(symbol)); | ||
780 | if (node->isVariadic != -1) { | 780 | if (node->isVariadic != -1) { | ||
781 | reportError(i18n("Variadic parameter cannot have a default value"), node->defaultValue); | 781 | reportError(i18n("Variadic parameter cannot have a default value"), node->defaultValue); | ||
782 | } else if ( node->parameterType && symbol.compare(QLatin1String("null"), Qt::CaseInsensitive) != 0 ) { | 782 | } else if ( node->parameterType && node->parameterType->objectType && symbol.compare(QLatin1String("null"), Qt::CaseInsensitive) != 0 ) { | ||
783 | reportError(i18n("Default value for parameters with a class type hint can only be NULL."), node->defaultValue); | 783 | reportError(i18n("Default value for parameters with a class type hint can only be NULL."), node->defaultValue); | ||
784 | } | 784 | } | ||
785 | } else if ( !node->defaultValue && funDec->defaultParametersSize() ) { | 785 | } else if ( !node->defaultValue && funDec->defaultParametersSize() ) { | ||
786 | reportError(i18n("Following parameters must have a default value assigned."), node); | 786 | reportError(i18n("Following parameters must have a default value assigned."), node); | ||
787 | } | 787 | } | ||
788 | { | 788 | { | ||
789 | // create variable declaration for argument | 789 | // create variable declaration for argument | ||
790 | DUChainWriteLocker lock(DUChain::lock()); | 790 | DUChainWriteLocker lock(DUChain::lock()); | ||
▲ Show 20 Lines • Show All 737 Lines • Show Last 20 Lines |