Changeset View
Changeset View
Standalone View
Standalone View
duchain/expressionvisitor.cpp
Show First 20 Lines • Show All 218 Lines • ▼ Show 20 Line(s) | 216 | { | |||
---|---|---|---|---|---|
219 | if (node->functionBody) { | 219 | if (node->functionBody) { | ||
220 | visitInnerStatementList(node->functionBody); | 220 | visitInnerStatementList(node->functionBody); | ||
221 | } | 221 | } | ||
222 | closureType->setReturnType(m_result.type()); | 222 | closureType->setReturnType(m_result.type()); | ||
223 | 223 | | |||
224 | if (node->parameters->parametersSequence) { | 224 | if (node->parameters->parametersSequence) { | ||
225 | const KDevPG::ListNode< ParameterAst* >* it = node->parameters->parametersSequence->front(); | 225 | const KDevPG::ListNode< ParameterAst* >* it = node->parameters->parametersSequence->front(); | ||
226 | forever { | 226 | forever { | ||
227 | AbstractType::Ptr type; | 227 | AbstractType::Ptr type = parameterType(it->element, {}, m_editor, m_currentContext); | ||
228 | if (it->element->parameterType) { | | |||
229 | //don't use openTypeFromName as it uses cursor for findDeclarations | | |||
230 | DeclarationPointer decl = findDeclarationImport(ClassDeclarationType, | | |||
231 | identifierForNamespace(it->element->parameterType, m_editor)); | | |||
232 | if (decl) { | | |||
233 | type = decl->abstractType(); | | |||
234 | } | | |||
235 | } else if (it->element->arrayType != -1) { | | |||
236 | type = AbstractType::Ptr(new IntegralType(IntegralType::TypeArray)); | | |||
237 | } else if (it->element->callableType != -1) { | | |||
238 | type = AbstractType::Ptr(new IntegralType(IntegralType::TypeMixed)); | | |||
239 | } else if (it->element->defaultValue) { | | |||
240 | ExpressionVisitor v(m_editor); | | |||
241 | it->element->defaultValue->ducontext = m_currentContext; | | |||
242 | v.visitNode(it->element->defaultValue); | | |||
243 | type = v.result().type(); | | |||
244 | } | | |||
245 | if (!type) { | | |||
246 | type = AbstractType::Ptr(new IntegralType(IntegralType::TypeMixed)); | | |||
247 | } | | |||
248 | | ||||
249 | if ( it->element->isRef != -1 ) { | | |||
250 | ReferenceType::Ptr p( new ReferenceType() ); | | |||
251 | p->setBaseType( type ); | | |||
252 | | ||||
253 | type = p.cast<AbstractType>(); | | |||
254 | } | | |||
255 | closureType->addArgument(type); | 228 | closureType->addArgument(type); | ||
256 | if ( it->hasNext() ) { | 229 | if ( it->hasNext() ) { | ||
257 | it = it->next; | 230 | it = it->next; | ||
258 | } else { | 231 | } else { | ||
259 | break; | 232 | break; | ||
260 | } | 233 | } | ||
261 | } | 234 | } | ||
262 | } | 235 | } | ||
▲ Show 20 Lines • Show All 557 Lines • Show Last 20 Lines |