Changeset View
Changeset View
Standalone View
Standalone View
duchain/builders/typebuilder.cpp
Context not available. | |||||
358 | void TypeBuilder::visitParameter(ParameterAst *node) | 358 | void TypeBuilder::visitParameter(ParameterAst *node) | ||
---|---|---|---|---|---|
359 | { | 359 | { | ||
360 | AbstractType::Ptr type; | 360 | AbstractType::Ptr type; | ||
361 | if (node->isVariadic != -1) { | 361 | if (node->parameterType) { | ||
362 | if (node->parameterType) { | 362 | if (node->parameterType->objectType) { | ||
363 | //don't use openTypeFromName as it uses cursor for findDeclarations | 363 | //don't use openTypeFromName as it uses cursor for findDeclarations | ||
364 | DeclarationPointer decl = findDeclarationImport(ClassDeclarationType, | 364 | DeclarationPointer decl = findDeclarationImport(ClassDeclarationType, | ||
365 | identifierForNamespace(node->parameterType, editor())); | 365 | identifierForNamespace(node->parameterType->objectType, editor())); | ||
366 | if (decl) { | 366 | if (decl) { | ||
367 | IndexedContainer *container = new IndexedContainer(); | 367 | type = decl->abstractType(); | ||
368 | const IndexedString *containerType = new IndexedString("array"); | | |||
369 | container->addEntry(decl->abstractType()); | | |||
370 | container->setPrettyName(*containerType); | | |||
371 | type = AbstractType::Ptr(container); | | |||
372 | } | 368 | } | ||
373 | } else { | 369 | } else if (node->parameterType->arrayType != -1) { | ||
374 | type = AbstractType::Ptr(new IntegralType(IntegralType::TypeArray)); | 370 | type = AbstractType::Ptr(new IntegralType(IntegralType::TypeArray)); | ||
371 | } else if (node->parameterType->boolType != -1) { | ||||
372 | type = AbstractType::Ptr(new IntegralType(IntegralType::TypeBoolean)); | ||||
373 | } else if (node->parameterType->floatType != -1) { | ||||
374 | type = AbstractType::Ptr(new IntegralType(IntegralType::TypeFloat)); | ||||
375 | } else if (node->parameterType->intType != -1) { | ||||
376 | type = AbstractType::Ptr(new IntegralType(IntegralType::TypeInt)); | ||||
377 | } else if (node->parameterType->stringType != -1) { | ||||
378 | type = AbstractType::Ptr(new IntegralType(IntegralType::TypeString)); | ||||
375 | } | 379 | } | ||
376 | } else if (node->parameterType) { | 380 | | ||
377 | //don't use openTypeFromName as it uses cursor for findDeclarations | 381 | if (type && node->parameterType->isOptional != -1) { | ||
378 | DeclarationPointer decl = findDeclarationImport(ClassDeclarationType, | 382 | UnsureType::Ptr unsure(new UnsureType()); | ||
379 | identifierForNamespace(node->parameterType, editor())); | 383 | unsure->addType(type->indexed()); | ||
380 | if (decl) { | 384 | AbstractType::Ptr nullType = AbstractType::Ptr(new IntegralType(IntegralType::TypeNull)); | ||
381 | type = decl->abstractType(); | 385 | unsure->addType(nullType->indexed()); | ||
386 | | ||||
387 | type = AbstractType::Ptr(unsure); | ||||
382 | } | 388 | } | ||
383 | } else if (node->arrayType != -1) { | | |||
384 | type = AbstractType::Ptr(new IntegralType(IntegralType::TypeArray)); | | |||
385 | } else if (node->defaultValue) { | 389 | } else if (node->defaultValue) { | ||
386 | ExpressionVisitor v(editor()); | 390 | ExpressionVisitor v(editor()); | ||
387 | node->defaultValue->ducontext = currentContext(); | 391 | node->defaultValue->ducontext = currentContext(); | ||
Context not available. | |||||
403 | type = p.cast<AbstractType>(); | 407 | type = p.cast<AbstractType>(); | ||
404 | } | 408 | } | ||
405 | 409 | | |||
410 | if (node->isVariadic != -1) { | ||||
411 | IndexedContainer *container = new IndexedContainer(); | ||||
412 | const IndexedString *containerType = new IndexedString("array"); | ||||
413 | container->addEntry(type); | ||||
414 | container->setPrettyName(*containerType); | ||||
415 | type = AbstractType::Ptr(container); | ||||
416 | } | ||||
417 | | ||||
406 | openAbstractType(type); | 418 | openAbstractType(type); | ||
407 | TypeBuilderBase::visitParameter(node); | 419 | TypeBuilderBase::visitParameter(node); | ||
408 | closeType(); | 420 | closeType(); | ||
Context not available. |