Changeset View
Changeset View
Standalone View
Standalone View
duchain/builders/typebuilder.cpp
Show First 20 Lines • Show All 326 Lines • ▼ Show 20 Line(s) | 313 | if (node->methodName) { | |||
---|---|---|---|---|---|
327 | if (currentType<FunctionType>() && !currentType<FunctionType>()->returnType()) { | 327 | if (currentType<FunctionType>() && !currentType<FunctionType>()->returnType()) { | ||
328 | currentType<FunctionType>()->setReturnType(AbstractType::Ptr(new IntegralType(IntegralType::TypeVoid))); | 328 | currentType<FunctionType>()->setReturnType(AbstractType::Ptr(new IntegralType(IntegralType::TypeVoid))); | ||
329 | } | 329 | } | ||
330 | closeContextType(); | 330 | closeContextType(); | ||
331 | closeType(); | 331 | closeType(); | ||
332 | } else if (node->constsSequence) { | 332 | } else if (node->constsSequence) { | ||
333 | //class constant | 333 | //class constant | ||
334 | TypeBuilderBase::visitClassStatement(node); | 334 | TypeBuilderBase::visitClassStatement(node); | ||
335 | } else if (node->propertyType) { | ||||
336 | m_gotTypeFromTypeHint = true; | ||||
337 | AbstractType::Ptr phpDocTypehint = parseDocComment(node, QStringLiteral("var")); | ||||
338 | AbstractType::Ptr type = propertyType(node, phpDocTypehint, editor(), currentContext()); | ||||
339 | | ||||
340 | injectType(type); | ||||
341 | TypeBuilderBase::visitClassStatement(node); | ||||
342 | clearLastType(); | ||||
343 | m_gotTypeFromTypeHint = false; | ||||
344 | | ||||
345 | if (m_gotTypeFromDocComment) { | ||||
346 | clearLastType(); | ||||
347 | m_gotTypeFromDocComment = false; | ||||
348 | } | ||||
335 | } else { | 349 | } else { | ||
336 | //member-variable | 350 | //member-variable | ||
337 | parseDocComment(node, QStringLiteral("var")); | 351 | parseDocComment(node, QStringLiteral("var")); | ||
338 | TypeBuilderBase::visitClassStatement(node); | 352 | TypeBuilderBase::visitClassStatement(node); | ||
339 | if (m_gotTypeFromDocComment) { | 353 | if (m_gotTypeFromDocComment) { | ||
340 | clearLastType(); | 354 | clearLastType(); | ||
341 | m_gotTypeFromDocComment = false; | 355 | m_gotTypeFromDocComment = false; | ||
342 | } | 356 | } | ||
343 | } | 357 | } | ||
344 | } | 358 | } | ||
345 | 359 | | |||
346 | void TypeBuilder::visitClassVariable(ClassVariableAst *node) | 360 | void TypeBuilder::visitClassVariable(ClassVariableAst *node) | ||
347 | { | 361 | { | ||
348 | if (!m_gotTypeFromDocComment) { | 362 | if (!m_gotTypeFromDocComment && !m_gotTypeFromTypeHint) { | ||
349 | if (node->value) { | 363 | if (node->value) { | ||
350 | openAbstractType(getTypeForNode(node->value)); | 364 | openAbstractType(getTypeForNode(node->value)); | ||
351 | } else { | 365 | } else { | ||
352 | openAbstractType(AbstractType::Ptr(new IntegralType(IntegralType::TypeNull))); | 366 | openAbstractType(AbstractType::Ptr(new IntegralType(IntegralType::TypeNull))); | ||
353 | } | 367 | } | ||
354 | 368 | | |||
355 | TypeBuilderBase::visitClassVariable(node); | 369 | TypeBuilderBase::visitClassVariable(node); | ||
356 | 370 | | |||
▲ Show 20 Lines • Show All 280 Lines • Show Last 20 Lines |