Bug 375223 - C# importer doesn't support properties
Summary: C# importer doesn't support properties
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified All
: NOR normal
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-18 11:25 UTC by UnremarkableGuy
Modified: 2022-02-19 21:29 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 2.33.80 (KDE releases 22.03.80)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description UnremarkableGuy 2017-01-18 11:25:27 UTC
C# importer fails to parse property1 properly and doesn't import property2 and property3 at all

public class TestClass
{
   public int property1 { get; set; }
   public int property2 { get; set; }
   public int property3 { get; set; }
}
Comment 1 Oliver Kellogg 2022-02-12 13:44:34 UTC
Git commit 47e8a38a28f02bbafd437fb4038e055249d4441b by Oliver Kellogg.
Committed on 12/02/2022 at 13:44.
Pushed by okellogg into branch 'master'.

Finalize "C#: Windows Forms classes are not imported" and fix "C# importer doesn't support properties"

umbrello/codeimport/csharp/csharpimport.{h,cpp}
- Reimplement function preprocess(QString&); from NativeImportBase,
  currently only to discard preprocessor lines.
  Reason: If we don't do this then preprocessor lines are forwarded to
  the m_source token stream which creates problems on parsing.

umbrello/codeimport/csharp/csharpimport.cpp
- Cosmetic change in function joinTypename: Use lookAhead() in place of
  m_source[m_srcIndex + 1].
- In function resolveClass first call
    findObject(className, currentScope())
  and if this returns non null then return the found object.
- In function parseStmt :
  - Before testing isTypeDeclaration(keyword), while
    isClassModifier(keyword) returns true assign advance() to keyword.
  - Simplify if-statement testing isTypeDeclaration(keyword), use
    `keyword' in place of nextKeyword.
  - Remove handling of keyword "#", this is obsoleted by reimplementing
    preprocess(QString&).
  - Before expecting `keyword' to be a type name advance over possible
    modifiers using isCommonModifier(keyword).
  - In handling of nextToken "(", do not try resolving the return type
    if it is "void". In this case set typeName empty to avoid creation
    of a bogus type for "void".
  - Before handling a data member declaration add handling of nextToken
    "{" (property).
Related: bug 449268
FIXED-IN:2.33.80 (KDE releases 22.03.80)

M  +72   -44   umbrello/codeimport/csharp/csharpimport.cpp
M  +4    -2    umbrello/codeimport/csharp/csharpimport.h

https://invent.kde.org/sdk/umbrello/commit/47e8a38a28f02bbafd437fb4038e055249d4441b
Comment 2 Oliver Kellogg 2022-02-19 21:29:03 UTC
Git commit 9ac2ebbb56cea9d7f26d5dd4b2003187ddc5c842 by Oliver Kellogg.
Committed on 19/02/2022 at 20:18.
Pushed by okellogg into branch 'master'.

test/import/csharp/properties.cs : New file tests C# properties.

A  +24   -0    test/import/csharp/properties.cs

https://invent.kde.org/sdk/umbrello/commit/9ac2ebbb56cea9d7f26d5dd4b2003187ddc5c842