Changeset View
Changeset View
Standalone View
Standalone View
duchain/expressionvisitor.cpp
Show First 20 Lines • Show All 389 Lines • ▼ Show 20 Line(s) | |||||
390 | { | 390 | { | ||
391 | DUChainReadLocker lock; | 391 | DUChainReadLocker lock; | ||
392 | auto type = typeObjectForIntegralType<ListType>("list"); | 392 | auto type = typeObjectForIntegralType<ListType>("list"); | ||
393 | lock.unlock(); | 393 | lock.unlock(); | ||
394 | ExpressionVisitor contentVisitor(this); | 394 | ExpressionVisitor contentVisitor(this); | ||
395 | if ( type ) { | 395 | if ( type ) { | ||
396 | foreach ( ExpressionAst* content, node->elements ) { | 396 | foreach ( ExpressionAst* content, node->elements ) { | ||
397 | contentVisitor.visitNode(content); | 397 | contentVisitor.visitNode(content); | ||
398 | if ( content->astType == Ast::StarredAstType ) { | ||||
399 | auto contentType = Helper::contentOfIterable(contentVisitor.lastType(), topContext()); | ||||
400 | type->addContentType<Python::UnsureType>(contentType); | ||||
401 | } | ||||
402 | else { | ||||
398 | type->addContentType<Python::UnsureType>(contentVisitor.lastType()); | 403 | type->addContentType<Python::UnsureType>(contentVisitor.lastType()); | ||
399 | } | 404 | } | ||
400 | } | 405 | } | ||
406 | } | ||||
401 | else { | 407 | else { | ||
402 | encounterUnknown(); | 408 | encounterUnknown(); | ||
403 | qCWarning(KDEV_PYTHON_DUCHAIN) << " [ !!! ] did not get a typetrack container object when expecting one! Fix code / setup."; | 409 | qCWarning(KDEV_PYTHON_DUCHAIN) << " [ !!! ] did not get a typetrack container object when expecting one! Fix code / setup."; | ||
404 | } | 410 | } | ||
405 | encounter(AbstractType::Ptr::staticCast(type)); | 411 | encounter(AbstractType::Ptr::staticCast(type)); | ||
406 | } | 412 | } | ||
407 | 413 | | |||
408 | void ExpressionVisitor::visitDictionaryComprehension(DictionaryComprehensionAst* node) | 414 | void ExpressionVisitor::visitDictionaryComprehension(DictionaryComprehensionAst* node) | ||
▲ Show 20 Lines • Show All 105 Lines • ▼ Show 20 Line(s) | |||||
514 | { | 520 | { | ||
515 | DUChainReadLocker lock; | 521 | DUChainReadLocker lock; | ||
516 | auto type = typeObjectForIntegralType<ListType>("set"); | 522 | auto type = typeObjectForIntegralType<ListType>("set"); | ||
517 | lock.unlock(); | 523 | lock.unlock(); | ||
518 | ExpressionVisitor contentVisitor(this); | 524 | ExpressionVisitor contentVisitor(this); | ||
519 | if ( type ) { | 525 | if ( type ) { | ||
520 | foreach ( ExpressionAst* content, node->elements ) { | 526 | foreach ( ExpressionAst* content, node->elements ) { | ||
521 | contentVisitor.visitNode(content); | 527 | contentVisitor.visitNode(content); | ||
528 | if ( content->astType == Ast::StarredAstType ) { | ||||
529 | auto contentType = Helper::contentOfIterable(contentVisitor.lastType(), topContext()); | ||||
530 | type->addContentType<Python::UnsureType>(contentType); | ||||
531 | } | ||||
532 | else { | ||||
522 | type->addContentType<Python::UnsureType>(contentVisitor.lastType()); | 533 | type->addContentType<Python::UnsureType>(contentVisitor.lastType()); | ||
523 | } | 534 | } | ||
524 | } | 535 | } | ||
536 | } | ||||
525 | encounter(AbstractType::Ptr::staticCast(type)); | 537 | encounter(AbstractType::Ptr::staticCast(type)); | ||
526 | } | 538 | } | ||
527 | 539 | | |||
528 | void ExpressionVisitor::visitDict(DictAst* node) | 540 | void ExpressionVisitor::visitDict(DictAst* node) | ||
529 | { | 541 | { | ||
530 | DUChainReadLocker lock; | 542 | DUChainReadLocker lock; | ||
531 | auto type = typeObjectForIntegralType<MapType>("dict"); | 543 | auto type = typeObjectForIntegralType<MapType>("dict"); | ||
532 | lock.unlock(); | 544 | lock.unlock(); | ||
▲ Show 20 Lines • Show All 175 Lines • Show Last 20 Lines |