| Summary: | Code import wizard: python wrong function return | ||
|---|---|---|---|
| Product: | [Applications] umbrello | Reporter: | Jessica <jess.jones.unitedkingdom> |
| Component: | importer | Assignee: | Umbrello Development Group <umbrello-devel> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | ||
| Priority: | NOR | ||
| Version First Reported In: | 2.32.0 (KDE releases 20.08.0) | ||
| Target Milestone: | --- | ||
| Platform: | Microsoft Windows | ||
| OS: | Microsoft Windows | ||
| Latest Commit: | https://invent.kde.org/sdk/umbrello/commit/126264fdacc53e6d209258115a5d977a1ac3c82e | Version Fixed/Implemented In: | 2.33.80 (KDE releases 22.03.80) |
| Sentry Crash Report: | |||
| Attachments: | Python source + umbrello file for this source | ||
Git commit 126264fdacc53e6d209258115a5d977a1ac3c82e by Oliver Kellogg.
Committed on 31/01/2022 at 20:57.
Pushed by okellogg into branch 'master'.
Fix "Code import wizard: python wrong function return"
umbrello/codeimport/pythonimport.{h,cpp}
- At function skipBody add optional argument foundReturn of type bool*.
If given then the variable pointed to will be set true if a 'return'
statement was encountered while skipping.
If no 'return' statement was encountered then the variable will be set
to false.
- In function parseStmt() handling of keyword "def" :
- Move local srcIndex and call to op->setSourceCode to before the call
to Import_Utils::insertMethod.
- Define local foundReturn of type bool.
- Define local QString bodyCode initialized to skipBody(&foundReturn).
- Define local QString returnTypeName which is left empty if
foundReturn is returned false and is set to "string" if foundReturn
is returned true.
- At call to Import_Utils::insertMethod provide returnTypeName as the
return type argument.
- At call to op->setSourceCode provide bodyCode as argument.
FIXED-IN:2.33.80 (KDE releases 22.03.80)
M +18 -4 umbrello/codeimport/pythonimport.cpp
M +1 -1 umbrello/codeimport/pythonimport.h
https://invent.kde.org/sdk/umbrello/commit/126264fdacc53e6d209258115a5d977a1ac3c82e
|
Created attachment 146016 [details] Python source + umbrello file for this source STEPS TO REPRODUCE 1. Import the file pong.py 2. Drag-and-drop classes ball and paddle to a class diagram 3. Compare pong.py to the class diagram and see that the class functions do not return a String, while in the class diagram they return a String. OBSERVED RESULT the class functions do not return a String but in the class diagram they return a String. EXPECTED RESULT The class diagram should not have an unexisting return type String for class functions. SOFTWARE/OS VERSIONS Windows: Microsoft Windows [Version 10.0.19044.1466] KDE Development Platform 4.14.65 ADDITIONAL INFORMATION Included in the zip file: pong.py and pong.xmi